Day 1 — Trying to get the QEMU kernel sandbox going
Time to setup the environment for kernel development. Rather than risk shooting myself in the foot on my bare host, I decided to: build a custom kernel + minimal user land, and boot it inside QEMU.
What I thought would be a straightforward path — went somewhat astray, or at least was different than what I'd expected it would be.
What I did
Clone a recent upstream Linux kernel source tree.
Installed dependencies (compiler, build tools, kernel-dev libs, etc.).
QEMU
Configure the kernel (make defconfig), enabled built-in drivers I expected to need (make kvm_guest.config). Which the built in configs for kvm was nice to find instead of having to menuconfig and change them all myself, or write config snippets and merge them with merge_config
init
Built a minimal root filesystem using BusyBox + a tiny initramfs / minimal userland. This provided a good refresher of how booting the kernel works.
Launched QEMU: point it to the kernel image, attach the rootfs, set console/serial, etc.
What I expected
A quick "hello world" environment. Boot → get a kernel log on serial → minimal root shell → experiment with loading modules / tinkering / debugging — all safely sandboxed, without risking my host’s stability.
What followed was… a lot of head-scratching.
Mostly I spent a ton of time digging through forums and reading posts about how the systems worked, but it really wasn't all that bad. Starting with some kernel panics as init wasn't built properly or I was pointing to the wrong bzImage. Once I got all the pieces properly laid out it all worked perfectly. A nice safe environment where I don't have to worry about crashing my daily driver.
What’s next
Build and test a trivial kernel module, load it, unload it.
Top comments (0)