This project is heavily inspired by Nir Lichtman's awesome YouTube video about hacking your own tiny Linux kernel with a static init userspace.
For Ubuntu on WSL 2:
sudo apt install make build-essential flex bison libncurses-dev libelf-dev cpio syslinux isolinux genisoimage
Use the tinyconfig
option along with the other config options shown in the video.
gcc -c userspace.c
as sys.S
ld -o init userspace.o a.out --entry main -z noexecstack
echo init | cpio -H newc -o > init.cpio
make isoimage FDARGS="initrd=/init.cpio" FDINITRD="~/tinylinux/init.cpio"