Minimal QEMU + Buildroot example
Here is a minimal concrete example that shows that initrd is not mandatory: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/0b4f156b1b536a89c90882ed8ce551abcd3780af#initrd
With that setup, we can easily run two working QEMU commands of type:
qemu-system-x86_64 -drive file=rootfs.ext2
and:
qemu-system-x86_64 -initrd rootfs.cpio
Where:
rootfs.ext2
and rootfs.cpio
are basically the same root filesystem, but in different formats
- the first command has a hard drive and no
-initrd
- the second command an
-initrd
but no hard drive
In both cases, Linux boots fine, except that in the -initrd
system, file writes are not persistent since everything is in memory.