Tuesday, January 3, 2012

Kernel Easy Debugging Setup in QEMU

make sure you have the virtual disk (e.g.,miniub1010.img) in directory kvmimage

compile and install kernel, make initrd
make links from /boot... 1. vmlinuz, 2. sysmap, 3. config
make links from build... 1. vmlinux

put all these links in kvmimage directory.

found a better way: use custom installation path for the kernel and the ramdisk.(link)

now from kvmimage directory command:
kvm -smp 4 -m 1024 -hda ../miniub1010.img -kernel vmlinuz-3.1.6 -initrd initrd.img-3.1.6 -append "root=/dev/sda1 kgdbwait console=ttyS0" -serial pty -S -gdb pty

this will start qemu but it will wait for gdb client to connect

now run gdb with the symbol file from vmlinux

No comments:

Post a Comment