Quick HOWTO for UserModeLinux on Sourcemage ------------------------------------------- Any comments direct towards me at tusker@tusker.org Important websites: http://www.stearns.org/mkrootfs/rootfs.html http://user-mode-linux.sourceforge.net/UserModeLinux-HOWTO.html NOTES: * Make sure your host kernel has TUN/TAP and/or ethertap support built in or module * modprobe iptable_nat * iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE * echo 1 > /proc/sys/net/ipv4/ip_forward 1) Get the following files: cd /usr/src/uml wget http://unc.dl.sourceforge.net/sourceforge/user-mode-linux/uml-patch-2.4.20-4.bz2 wget ftp://ftp.sg.kernel.org/pub/linux/kernel/v2.4/linux-2.4.20.tar.bz2 wget http://unc.dl.sourceforge.net/sourceforge/user-mode-linux/uml_utilities_20030312.tar.bz2 2) Uncompress them into a directory, and apply the patch cd /usr/src/uml bzip2 -dc uml_utilities_20030312.tar.bz2 | tar -xvf - cd tools make; make install (will dump them into /usr/bin) # now make the kernel with the UM patches bzip2 -dc linux-2.4.20.tar.bz2 | tar -xvf - cd linux cat uml-patch-2.4.20-4.bz2 | bunzip2 - | patch -p1 # you will need to edit ./fs/reiserfs/super.c and add a \ at the end of line 944 [or wherever the line is when the compile fails] 3) Build the "linux" binary: Make sure you add network device support! :) make menuconfig ARCH=um make dep ARCH=um make linux ARCH=um 4) Grab the empty filesystem and mount it wget http://www.stearns.org/mkrootfs/emptyfs.ext3.1536.bz2 cp -p --sparse=always <( cat emptyfs.ext3.1536.bz2 | bunzip2 -c - ) emptyfs.ext3.1536 mv emptyfs.ext3.1536 root_fs mkdir /mnt/sm-root mount -o loop root_fs /mnt/sm-root 5) Mount the current ISO and extract image.tar.bz2 mkdir /mnt/sm-iso mount -o loop ~/sm-latest.iso /mnt/sm-iso cd /mnt/sm-root bzip2 -dc /mnt/sm-iso/image.tar.bz2 | tar -xvf - 6) Install the Kernel modules that you created in step 3 make modules ARCH=um make modules_install INSTALL_MOD_PATH=/mnt/sm-root ARCH=um 7) Make some changes to set the rootfs Add /dev/ubd/0 / ext3 defaults 0 0 to /mnt/sm-root/etc/fstab Also remove the tmpfs stuff for now 8) unmount your loop devices, and boot the image :) umount /mnt/sm-root umount /mnt/sm-iso ./uml/linux-2.4.20/linux ubd0=uml/root_fs con0=fd:0,fd:1 con1=port:9000 con=pts eth0=tuntap,,,192.168.0.1