The linux.conf.au Kernel Hacking tutorial is interactive: you will be
doing work in assigned groups. You must install the software you need
on your laptop running Linux BEFORE the tutorial, or we will leave you
behind! PowerPC laptop users will need to deviate a little from these
instructions.
Please contact rusty@rustcorp.com.au if you have any questions.
So, before the tutorial, do the following:
0) Make sure you have GCC, make, patch, an editor, and other normal
development tools installed. If you can complete these steps, you
have enough.
1) Download the QEMU source code, the patch supplied with this README,
the 2.6.11 kernel source, the config-qemu file supplied with
this README, and the example root image suppled with this README.
Example:
mkdir lca-2005-khacking
cd lca-2005-khacking
wget http://fabrice.bellard.free.fr/qemu/qemu-0.6.1.tar.gz
wget http://www.au.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.tar.bz2
wget http://linux.conf.au/kernel-tute/qemu-lr3k.patch
wget http://linux.conf.au/kernel-tute/config-qemu
wget http://linux.conf.au/kernel-tute/debian.gz
2) Unpack the QEMU source code.
Example:
tar xvfz qemu-0.6.1.tar.gz
3) Apply the lr3k QEMU patch.
Example:
cd qemu-0.6.1
patch -p1 < ../qemu-lr3k.patch
4) Build qemu. You will need to have the SDL development libaries installed,
otherwise qemu will be non-graphical only.
Example:
./configure
make
make install
5) Unpack the base disk (a cut-down Debian).
Example:
cd ..
gunzip debian.gz
6) Unpack the kernel source:
Example:
tar xvfj linux-2.6.11.tar.bz2
7) Copy the config-qemu file into the kernel source directory, and
call the file ".config".
Example:
cd linux
cp ../config-qemu .config
8) Build the kernel source.
Example:
make oldconfig
make bzImage
9) Test that your kernel works with qemu.
Example (graphical, then non-graphical):
qemu -user-net -hda ../debian -kernel arch/i386/boot/bzImage -append "ro root=/dev/hda1"
qemu -user-net -nographic -hda ../debian -kernel arch/i386/boot/bzImage -append "ro root=/dev/hda1 console=ttyS0"
You should see a window come up, and Linux boot inside it to the
login prompt. The only account is "root" with a password of
"root".
10) You are now ready for the tutorial!