A small init system and set of scripts for debugging the Linux kernel in qemu.
qemu
- Used to virtualize the target kernel.- Install via
brew
on MacOS or through your package manager on Linux.
- Install via
dpkg-deb
- Used to extract packages into the initramfs.- Install via
brew
on MacOS or through your package manager on Linux.
- Install via
- Checkout and compile a Linux kernel + e1000 driver.
cd $KERNEL_PATH
make menuconfig
(Use default options: exit + save).make -j4 vmlinux
make drivers/net/ethernet/intel/e1000/e1000.ko
- Set
KERNEL_PATH
inMakefile
to the kernel repository. - Invoke
make
to compile the initramfs and setup symlinks for qemu.
- Invoke run in debug mode:
DEBUG=1 ./run.sh
. - Start
gdb
from the repository's root:gdb ./vmlinux
. - Connect
gdb
toqemu
:target remote :1234
. - And continue:
c
.
- Invoke run in normal mode:
./run.sh
. - Kernel will boot.