Wednesday, February 23, 2011

dmesg and kernel hacking

I came across a lot of interesting stuff on kernel hacking:
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch09s07.html

It says:
     To enable timestamp options on kernel messages:
     Kernel hacking
         [*] Show timing information on printks

But it doesn't say where these [bracketed] options are being set.

It turns out that they are set with
    cd /usr/src/linux
    make menuconfig

and this particular option is already set. So this does not help, but the rest is interesting:

http://help.soft30.com/manual/SUSE-Linux-Administration-Guide/ch11s03.html
gives details on kernel configuration for SuSE.

    To configure the kernel, change to /usr/src/linux and enter the command make config. Choose the features you want supported by the kernel.

So out of curiosity I did that.

Woh! I hope I haven't done myself in, as this responded with:

  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf arch/x86/Kconfig
#
# using defaults found in /boot/config-2.6.34.7-0.7-desktop
#
*
* Linux Kernel Configuration
*

at which point I bailed out.

So I better go back and finish it, perhaps by hitting return at each prompt unless I want to change it...

Uggh!.

It's all coming back to me, kernel hacking back in 2002. And making a mess and having to reinstall...

But wait! It goes on:

“menuconfig” is a more comfortable way to configure the kernel. If necessary, install ncurses-devel with YaST. Start the kernel configuration with the command make menuconfig.

This does indeed require ncurses-devel. So we install that and try again.

Aha! Now this shows the options in the [*] and [ ] formats. The Kernel Hacking option (highlight and hit Enter) is where we want to go.

So we check it all out, exit without saving changes, and (fingers crossed) reboot.

It comes back up just fine.

Whew.

=====
All this occurred while trying to figure out how to convert the dmesg timestamp to real time.
/var/log/messages has system events that may be able to be correlated with dmesg output. There are allusions to a /var/log/kern.log having real times, but I don't have such a file.

So tomorrow is another day.

No comments: