Creating a initramfs image from scratch
mkdir -p root cd root mkdir -p bin dev etc lib mnt proc sbin sys tmp var cd -
curl -L 'https://www.busybox.net/downloads/binaries/1.26.2-defconfig-multiarch/busybox-x86_64' >root/bin/busybox chmod +x root/bin/busybox
cat >>root/init << EOF #!/bin/busybox sh mount -t devtmpfs devtmpfs /dev mount -t proc proc /proc mount -t sysfs sysfs /sys mount -t tmpfs tmpfs /tmp sh EOF
Now to create the the initramfs.
cd root find . | cpio -ov --format=newc | gzip -9 >../initramfz cd -
and you're done.
If you also wanna test it out in qemu, get
qemu-system-x86_64 (or whatever other architecture you wanna work on) installed on your system.
You'll also need a linux kernel; if you're running linux already you can just get the one you're currently running, it's probably in
/boot/vmlinuz*, or some similar name.
If you're not on linux, you can snatch it up from some random distro, or compile it yourself.
qemu-system-x86_64 -kernel /boot/vmlinuz -initrd initramfz
If you want to run it in the current terminal instead of getting a new qemu window, you can add
-append 'console=ttyS0 to the