2

I tried to build Linux Kernel versions 3.10.107 and 4.13.8 in debug mode. I have used following steps to build the kernel.

Host machine with Ubuntu 16.04 OS and trying to update its kernel to latest version(4.13.8) with debug info.

Get the latest kernel source code

wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.13.8.tar.xz
mkdir linux-4.13.8 && tar xvf linux-4.13.8.tar.xz -C $(pwd)/linux-4.13.8/
cd linux-4.13.8

Copy .config from the host linux

cp /boot/config-`uname -r`* .config

Below options are enabled to build kernel in debug mode

gedit .config
CONFIG_DEBUG_KERNEL=y
CONFIG_FRAME_POINTER=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_DEBUG_INFO=y

Verified a gui menu of menuconfig

make menuconfig

Inside the Kernel hacking option, (kernel debugging, compile the kernel debug info, Printk options) are enabled and default debug message and console level is 7.

Executed the make command. kernel builds successfully.

make -j4

Installing the kernel

sudo make modules_install install 

Updated the Grub2

sudo update-grub2

Reboot the OS

reboot

OS updated with the latest Kernel 4.13.8 and works well, but debug info and printk outputs are not seen in dmesg console output and log files like(var/log/kern.log, dmesg, syslog)

I have also tried to debug the kernel image with gdb and it show (no debugging symbols found)

Please help to debug kernel. My intention is to debug and analyse system calls,traps, user space to kernel space switching, memory management in detail. (Expected more debug information than with strace output)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.