Tiny Kernel
build the tiniest possible kernel
today we gonna build the tiniest possible linux kernel, just for fun, and learning purposes. linux build system already comes with a config option, that leaves you with a very bare minimum kernel possible:
make tinyconfig
this will create .config
file, with the absolutly needed features only. then we should at least enable some other config just to have something logged in the screen, the features we gonna need are:
- tty
- printk
- initrd
- executable formats
- proc fs
you can easily find those, if you search with menuconfig, by pressing /
, and write what are you looking for.
let's compile it:
make -j$(nproc)
then we gonna need an initramfs, to test with, let's use the default one that comes with the distribution:
qemu -kernel arch/x86/boot/bzImage -initrd /boot/initramfs-linux.img -append "init=/bin/bash"
after that you should get a shell prompt. there you have it the smallest possible kernel.