I'm using dmesg
as a part of studying the android kernel (v3.10.49).
I edited the line
#define KLOG_DEFAULT_LEVEL 3
to
#define KLOG_DEFAULT_LEVEL 7
in the source code android/system/core/include/cutils/klog.h
to acquire all kernel log messages including,
- ERROR_LEVEL
- WARNING_LEVEL
- NOTICE_LEVEL
- INFO_LEVEL
- DEBUG_LEVEL
And I hard-coded void klog_set_level(int level)
function in
android/system/core/libcutils/klog.c
to make sure anyone can't change the klog_level
from the value 7.
But the problem is because the kernel uses a ring buffer, it always partially overwrite by the time I get the root shell necessary to run dmesg
on the device.
The book I'm referring Android Internals A Confectioner's Cookbook (Volume I: The Power User's View) With updates for Android M, Preview Release 1 (6/2015) By Jonathan Levin states that
"The size of the kernel ring buffer can be configured when the kernel is built"
But I could not find a clear path to do it in the book or in the web. Can someone please explain the steps?