Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis

bnoordhuis/uml-notes.md

Last active Oct 11, 2018
Embed
What would you like to do?
Setting up User Mode Linux on Fedora 20

user mode linux: build and run

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 -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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment