http://web2.clarkson.edu/class/cs644/kernel/setup/uml/uml.html
Creating your filesystem
Debian is suprisingly simple to install inside of user mode linux. To begin you must initialize the files using dd. This example assumes that your image files are /opt/uml/debian-root.
Now we will initialize the filesystems inside of each of these files. We will be using ext3 as our root filesystem.
Now we will need to mount the root filesystem before we run debootstrap.
Now we will install debootstrap and bootstrap a base Debian installation. This is a barebones installation that is less than 200 megs.
Example 8. Debian Installation
#
apt-get install debootstrap
#
debootstrap --arch i386 sarge /mnt/debian http://ftp.us.debian.org/debian
or you may want to use the breezy installation.
#
debootstrap --arch i386 breezy /mnt/debian http://archive.ubuntulinux.org/ubuntu
At this point your system is an unconfigured base system. You will need to edit the following files in order to have your system in a valid configuration.
/etc/fstab
/etc/hostname
/etc/hosts
/etc/network/interfaces
/etc/apt/sources.list
/etc/securetty
/etc/inittab
Example 10. Host configuration
You will need to make sure that /etc/hostname contains the following line or your nameing preference.
uml-one
You will need to make sure that /etc/hosts contains the following line.
127.0.0.1 localhost
At this point you will need to setup your network interface configuration. This is done by editing the file /etc/network/interfaces. This guest will have a loopback network device. More information on configuring network devices under Debian can be found in the Debian Reference.
The above should be in the file /etc/network/interfaces. You'll also need to add a mirror or cdrom image to /etc/apt/sources.list
Example 12. /etc/securetty Configuration
#
echo "tty0" >> /etc/securetty
#
echo "ttys/0" >> /etc/securetty
Example 13. /mnt/debian/dev
In the breezy debootstrap example no node was created for me to mount the file system too, you can check this by,
#
cd /mnt/debian/dev
#
ls ubd*
If this does not return ubd0 then,
#
mknod --mode=660 ubd0 b 98 0
#
chown root:disk ubd0
Example 14. Edit /etc/inittab
This will allow you to login immediately after the boot messages
Comment out the following lines:
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
Now modify tty1 to say tty0, the result should look like this:
1:2345:respawn:/sbin/getty 38400 tty0
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
why do we umount /mnt/debian before dong ./linux ubd0=/opt/uml/debian-root
ReplyDelete