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 ./

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,

Image bellow shows dmesg being monitored.

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


Post a Comment