This script creates a very simple rootfs. It uses BusyBox[https://busybox.net/], in order to provide basic UNIX utilities.
A cross-compilation toolchain is needed for building. The script was tested with an ARM toolchain, with glibc C library, for Linux.
Please note the requirement about fakeroot
, to set correct files permissions.
The output is an initramfs CPIO archive, initramfs.cpio.gz
, as small as about 3MB.
fakeroot ./minirootfs.sh arm-buildroot-linux-gnueabi-
The rootfs may be tested with an actual Linux Embedded board, or with a development machine using:
qemu-system-arm -m 128M -M virt -nographic -kernel /path/to/linux-6.8.7/arch/arm/boot/zImage -initrd ./initramfs.cpio.gz -append "root=/dev/ram0"
The Linux kernel may be compiled with the same toolchain:
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.7.tar.xz
tar xf linux-6.8.7.tar.xz
cd linux-6.8.7
make ARCH=arm CROSS_COMPILE=arm-buildroot-linux-gnueabi- defconfig
make ARCH=arm CROSS_COMPILE=arm-buildroot-linux-gnueabi- kvm_guest.config
make ARCH=arm CROSS_COMPILE=arm-buildroot-linux-gnueabi- zImage