Lab 1 : Compile Your Own UML
Kernel
Objective: You
will learn
how to install the Uesr-Mode-Linux which will be used in your future
kernel programming.
Background: Read
User-Mode-Linux
HOWTO, especially the first three chapters.
Exercise guide: Compile Your
Own UML
Kernel (You need a UML kernel and a root
filesystem to boot it on).
(Suppose you are now under your own
directory, e.g., ~/Uml)
- Download the root file system from SourceForge
to your directory, uncompress it and rename it:
bunzip2 root_fs.rh-7.2-full.pristine.20020312.bz2
mv root_fs.rh-7.2-full.pristine.20020312 root_fs
Or, you can directly copy it from my directory at elgate (you should do
this if you are using elkpc since we have made some changes to load the
modules inside UML) :
cp /elpc/cs700/grad/huli/courses/Spring04/Uml/root_fs ./
- Download Linux 2.4.23 kernel source (e.g., from kernel.org)
to your directory, and uncompress it:
tar -xjvf linux-2.4.23.tar.bz2
Or , you can copy it from my directory at elgate:
cp /elpc/cs700/grad/huli/courses/Spring04/Uml/linux-2.4.23.tar.bz2 ./
- Download the UML patch uml-patch-2.4.23-2.bz2 from SourceForge,
and apply the patch:
cd linux-2.4.23
bzcat ../uml-patch-2.4.23-2.bz2 | patch -p1
Also, from my directory:
cp /elpc/cs700/grad/huli/courses/Spring04/Uml/uml-patch-2.4.23-2.bz2 ./
- Compile the kernel:
make xconfig ARCH=um (click on "Save and Exit" in the window)
make dep ARCH=um
make linux ARCH=um
The result is the binary file "linux"
in this directory.
- If you configure to use kernel modules, you
can compile with (under linux-2.4.23 directory)
make modules ARCH=um
Since all modules that you want to load into this
kernel must be built inside UML, you can do as follows:
cd ..
mkdir mnt
mount root_fs mnt -o loop (to be as the host root to do these steps)
cd linux-2.4.23
make modules_install INSTALL_MOD_PATH=../mnt ARCH=um
umount ../mnt (exit the root)
Or, if you are using elkpc, after you boot the kernel, and
mount the host filesystem, you can simply do the following command
inside UML
make modules_install ARCH=um
- Now boot the kernel:
linux_2.4.23/linux (username: root, passwd: root)
- Mount the host file system:
mount -t hostfs none /mnt
Or, you
can modify the "/etc/fstab" file, just add one line (once done, it will
automatically mount the host file system every time you start the uml):
none /mnt hostfs defaults 0 0
How to hand in your documents: create
a directory named lab1.* under your Uml directory on elgate . Write
down
if you have done with this assignment on time, either on your own
machine or the elkpc. Also, tell us whatever you think that will
be helpful for this course.