Debugging Linux Kernel using QEMU

In this article we will learn to setting up and Debugging Embedded Linux Kernel using Qemu.

1. zImage
2. Rootfs
3. dtb file

Above images and rootfs can be compiled and built from these Tutorial

In 1st terminal execute below command:

qemu-system-arm -M vexpress-a9 -dtb linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -kernel linux/arch/arm/boot/zImage -append "root=/dev/nfs nfsroot= rw ip= init=/linuxrc console=ttyAMA0" -serial stdio -s -S


Using the “-s” option: makes qemu listen on port tcp::1234, which you can connect to as localhost:1234 if you are on the same machine.

Qemu’s “-S”option: makes Qemu stop execution until you give the continue command.

Open one more terminal i.e in 2nd terminal execute below command as shown in image

arm-none-linux-gnueabi-gdb path to vmlinux

arm-none-linux-gnueabi-gdb linux/vmlinux
target remote :1234
b start_kernel



For more options and debugging please refer online gdb tutorial.

Happy debugging





About VinayMahadev

I am passionate about Embedded Linux systems . I believe in "If you want to learn something, read about it. If you want to understand something, write about it. If you want to master something, teach it". Here I am just trying to connect the Dots.
Gallery | This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s