This is, what rootstrap does, however simplified so one can do it by hand. Why is this useful? It is very simple to get a running user-mode-linux by just copying the linux.uml
and slirp-fullbolt
binaries to some target system. Of course, you then don't have rootstrap. So this is, how that works:
$ dd if=/dev/zero of=rootimage bs=1 seek=1G count=0 $ /sbin/mke2fs -F rootimage $ dd if=/dev/zero of=swapimage bs=1M count=128 $ /sbin/mkswap swapimage $ /path/to/linux.uml \ root=/dev/root rootflags=/ rootfstype=hostfs \ ubda=rootimage \ ubdb=swapimage \ eth0=slirp,,/path/to/slirp-fullbolt \ init=/bin/bash
Now we continue within the uml boot. We are root now (within uml):
# mount -t tmpfs tmpfs /etc # mount -t tmpfs tmpfs /dev # mount -t tmpfs tmpfs /tmp # mount -t proc proc /proc # mkdir /tmp/host # mount -t hostfs hostfs /tmp/host # cp /tmp/host/etc/passed /etc # cp /tmp/host/etc/group /etc # cd /dev # /tmp/host/dev/MAKEDEV ubd # swapon /dev/ubdb # mkdir /tmp/target # mount /dev/ubda /tmp/target # echo 'nameserver 10.0.2.3' >/etc/resolv.conf # ifconfig eth0 10.0.2.15 netmask 255.255.0.0 # route add default gw 10.0.2.2 # cd /tmp # export PATH # debootstrap <suite> /tmp/target # umount /tmp/target # /sbin/halt -f
We now have a basic filesystem image in rootimage
. We can now contine as in Simple User Mode Linux Setup On Debian (after the rootstrap
step) and boot into this new image to configure it.