
To create an environment, we use Ubuntu 16.04 as the host operating system and Ubuntu 16.04 as the guest operating system. The host is an operating system where debugging is taking place. The guest is a Libvirt or QEMU-style virtual machine that we’ll debug. First of all, you need to set up the guest target. To conduct kernel debugging, you should prepare the necessary environment. You can either use one of these levels or dig deep and go through the whole process of kernel debugging. We’ll provide you with step-by-step instructions on how you can find errors in your Linux kernel module or kernel image at the development stage.
QEMU LINUX DRIVERS
Device drivers \(\rightarrow\) Block devices \(\rightarrow\) Virtio block driver Ī kernel module’s menu option may have three states:.Device drivers \(\rightarrow\) Network device support \(\rightarrow\) Virtio network driver.If you are later going to run & debug with QEMU, these options must be selected as built-in: Tweak any options you need (e.g., turning off KPTI, KASLR, …). # Tweak options & save the config to default name # If you are later going to run with QEMU, make sure to # read the paragraphs below.Ī graphical menu should now pop up in the terminal.
QEMU LINUX INSTALL
This workflow has been tested on x86_64 arch, Ubuntu 18.04/20.04 LTS, with Linux kernel versions 4.1 - 5.15.įirst, install the required dependencies (common things shipped with Ubuntu are not listed here):Ĭd linux-v.x.y # The root folder of the Linux source. This post lists a successful workflow of building and installing a custom Linux kernel under a Ubuntu 18.04/20.04 environment (deb), along with steps to debug the Linux kernel by running it over the QEMU emulator and attaching to GDB. When doing systems research, we sometimes need to modify/add new stuff into the Linux kernel. Hosted on GitHub Pages - Theme by orderedlist Building a Custom Linux Kernel & Debugging via QEMU + GDB Guanzhou's personal storage for lecture notes, blog posts, & good mood.
