Generate default .config
.
$ make defconfig ARCH=um SUBARCH=x86_64
Build the linux
ELF binary.
$ make -j8 linux ARCH=um SUBARCH=x86_64
Create the rootfs. Note the absolute path; supermin 5.1.9 fails with relative
paths. --use-installed
speeds up the --prepare
step but skips files that
are inaccessible to non-root users, like files in /usr/sbin
.
$ supermin -v --prepare bash coreutils mount -o $PWD/rootfs.template
$ supermin -v --build --format chroot rootfs.template -o $PWD/rootfs
Create a bootstrapper shell script.
$ cat > rootfs/boot/boot.sh
#!/bin/bash
mount -t sysfs /sys /sys
mount -t proc /proc /proc
exec /bin/bash
^D
$ chmod +x rootfs/boot/boot.sh
Start the UML instance with the rootfs mounted read/write. Note again the absolute path.
$ ./linux rootfstype=hostfs rootflags=$PWD/rootfs rw init=/boot/boot.sh