kdevbox is an ultra lightweight linux kernel development toolkit.
Point it to a kernel image and it will be executed inside a local KVM instance, with a very small ramdisk as its root filesystem containing only Busybox.
I use this to hack on the Linux kernel with an extremely fast feedback cycle, around ~20s.
- a Linux box
apt-get install qemu-system-x86
- busybox (statically compiled):
apt-get install busybox-static
- cpio, to generate initrd image files:
apt-get install cpio
get a linux kernel source tree
build it (eg.:
make oldconfig && make), and make sure it produced an
run your kernel into a lightweight KVM instance with a very small ramdisk as the root filesystem containing only busybox:
cd kdevbox ./run-kernel path/to/arch/x86/boot/bzImage
KVM will be started and the VM output (serial console) will be multiplexed to the
your terminal, via a termunal emulator implemented by QEMU. Use
C-a h for a
list of available control commands (hint:
C-a x terminates the VM). This is
nice because all your
printks will be right there at your face. No need to
inspect log files.
All files inside the image directory will be available at
/ inside the VM. Feel
free to tweak
image/init and add your own custom initialization tasks
(such as mounting filesystems, configuring network or loading modules).
This is inspired on Nelson Elhage's blog post: Lightweight Kernel Development with KVM.
This work is licensed under a Creative Commons Attribution 4.0 International License.
Copyright 2014 Fabio Kung email@example.com