Building and Installing the Linux Kernel

What is a kernel?

Linux Architecture

Root of filesystem

/
  /etc
  /bin
  /tmp
  ...
  /boot

LILO options LILO = LInux LOader and is a boot loader for linux. It is equivalent to GRUB which several people in the class had used in the past. The main configuration file for the boot loader is available at /boot/lilo.conf. This was automatically generated when we first installed the system, but we can also edit it later on for further customization.

/boot/lilo.conf

boot

/boot

Let's mess with the kernel:

mount /dev/hda1
cd /mnt/tmp

gunzip oldVmlinuz
mv oldVmlinuz /mnt/boot/vmlinuz

chroot . /sbin/lilo

umount /mnt

Getting the Linux source code:

/usr/src

Other Notes:

Some notes that were sent out to the class

Hi All,
I wanted to send out a note on a couple things we found were useful today and might help others.

If you are compiling a kernel with the same revision as the kernel you're currently running (can be found by running `uname -r`) when you run `make modules_install`, you will overwrite any of your current modules for the stable kernel you were previously running. As Prof. Herman mentioned, it's possible to make a copy of /lib/modules and restore these if you run into problems by using a boot CD. Another option which allows you to boot up from the previous stable kernel with no effort is to instead re-name the new kernel you're compiling while you're testing.

To make a custom name for the new kernel, you can edit the MakeFile within /usr/src/linux. In the file, you should see a definition for EXTRAVERSION. You can append any string (containing letter, number, dash, period but no spaces or other symbols or you'll be in worlds of pain later) to EXTRAVERSION -- we did something like try1, etc. When you boot from your new kernel, the kernel name will include anything in EXTRAVERSION at the end of the kernel revision name. Make sure you have the `prompt` keyword in your lilo.conf file though so that you can choose the old kernel instead of just booting to the new default. 

One other note. If you for some reason, mess up your .config file or believe the file /boot/configure is incorrect, you can find the .config file of the currently running kernel in /proc/config.gz.

Jan28Notes (last edited 2014-05-25 18:15:49 by localhost)