Wednesday, September 17, 2014

Capture and monitor dmesg continuously

Greetings folks!

If you are working on device drivers for Linux/Android we do rely on dmesg for almost all of the times. But you know the dmesg buffer is limited, its circular buffer. So what ever overflows the buffer is lost for good (?). We feel need to increase the buffer size but its not trivial task and also most of the times enough is just not enough!

Here are some simple scripts for Linux to log dmesg continuously and dump into file and at the same time you can monitor changes in dmesg!

Give exe permissions to script and run as bellow,
$sudo ./ldmesg.sh

Now, dmesg is getting continuously logged in dmesg.log file in current directory. Next script needs to be run in another terminal tab/window which will monitor changes in dmesg (actually dmesg.log).

Give exe permissions to script and run as bellow,
$./mdmesg.sh


Image bellow shows dmesg being monitored.

For Android developers, here is ldmesg modified to use it over adb,
 
-- Cheers!!

Monday, June 2, 2014

Linux Experience on Windows!

Yes, I love Linux and Windows too (yaah!..lets just say that!, as I use windows phone :)). Almost all engineers works most of the time on Linux and likes to fly VIM and similar editing tools. But sometimes sh*t happens and we forced to work on Windows and believe me it really feels like trapped in hell. Yes, I have been there, So here is your door to Heaven through the Hell!

Cygwin , Its your door way. It gives same experience as Linux shell. It includes most of the packages engineer/programmers need. Even you can ssh to remote Linux system using same command as in Linux shell, do you believe! and list goes long, Let curiosity be your guide!

Here are some basic instructions for setup...

1. Installation
 Download installer according to your system needs (32/64bit) and start installation.
 Just go through usual installation steps,


Next...Next...


Choose any site to download from...
Wait for a minute...


Now you need to search packages you need and mark them for installation. 
There long list but I'll install vim for reference.
Search for it...
 Mark VIM for installation and go next...


It will find package dependencies and start downloading it, give it a time...

Click 'Finish' and installation is done.

2. Running VIM in Cygwin:
Now, go to start menu and start Cygwin. It will open shell similar to Linux shell. Your root directory will be installation directory (C:\cygwin64\)


Now, you can put your vimrc in your $HOME directory (i.e. C:\cygwin64\home\user.name\.vimrc) and it works just perfectly.

Here is bashrc file in vim ($vim .bashrc)

Cheers!