lemoncube.com Search: (normal)


Pablos User Mode Linux notes

These are basically notes for myself in getting it all installed and running.

  • Download a linux kernel source. These docs will generally refer to a 2.4.20 kernel. Extract in somewhere (ie. not in /usr/src) and rename it to something like uml-2.4.20
  • Patch the kernel with something like:
       cd uml-2.4.20
       bunzip2 -c /tmp/uml-patch.2.4.20.bz2 | patch -p1
  • Compile the kernel
       cd uml-2.4.20
       make menuconfig ARCH=um
    # The majority of the defaults are fine.
       make dep ARCH=um
       make linux ARCH=um
    You should end up with a file 'linux'. You can strip it with 'strip linux' to make it a bit smaller. You can probably even try the kernel by just running it as ./linux. You should see the normal startup gumpf and it should hang at some point (cannot mount the rootfs probably)
  • Installing Slackware 8.1. Create a big root filesystem file.
       # Create a sparse file
       dd if=/dev/zero of=root_fs_slack81 bs=1024k count=1 seek=1024
    Format it:
       mke2fs -F root_fs_slack81
    Mount it:
       mount -o loop root_fs_slack81 /mnt
    fdisk it:
       fdisk /dev/loop0
    # Press 'o' to create a new disk label
    # Press 'n' to create a new partition. Make it a primary one that takes up
      the whole disk.
    # Press 'w' to write out the partition info
    Remount it:
       mount -o remount /mnt
    Mount the slackware 8.1 cdrom :
       mount -t iso9660 /dev/sr0 /cdrom
    Now install all the packages
       cd /cdrom/slackware
       export ROOT=/mnt
       for i in `ls -F1 | grep /`
          cd $i && sh ./install-packages && cd ..
       # You'll get the usual Slackware pkgtool type menus now. Select or deselect the bits you want
       unset ROOT
    Running install-packages as above doesn't seem to work from Slackware 10.0 onwards. Possibel idea is something like:
       installpkg -root /mnt a/*.tgz ap/*.tgz n/*.tgz
    Now fix up Slackware so that it will work under UML
       chroot /mnt /bin/bash
       # You are inside the slackware install now
       vi /etc/fstab
       # Add the following into /etc/fstab
    /dev/ubd/0      /               ext2    defaults   1   1
    /proc           /proc           proc    defaults
       # Make sure the /dev/pts and swap entries are in your /etc/fstab too
       # Now set the root password
       passwd root
       # Now Fix the inittab so that the virtual console works better. 
       # Comment out all the virtual consoles except the first one and then 
       # change its terminal to ttys/0:
    c1:1235:respawn:/sbin/agetty 38400 ttys/0 linux
       # As a matter of fact you might want to change the termtype from linux
       # to vt100 or xterm or something
       # Edit /etc/securetty to allow root to login from ttys/0. You just need
       # to add a line with 'ttys/0' on it.
       # Edit some of the startup/shutdown scripts to get rid of the 
       # references to hwclock
    Now try booting it:
       ./linux ubd0=root_fs_slack81 con=pty con0=fd:0,fd:1
    You should be able to log in as root.

    pablo , 2005-03-26 04:21:08