BACK TO LINUX

Kernel Compiling 1

This HowTo is an easy way to introduce new users to a quick and effortless kernel compiling.  I know that there are other easier and more efficient ways of doing this, but they aren't covered in this guide.  I should also mention that this guide is based on compiling a kernel for SuSE Linux, so you may have to research the locations of certain files.  Before you compile a new kernel or recompile your old kernel, make sure all important data is backed up as you can render your system inoperable if something goes wrong during the process.  You will also need to have root privileges and should make an entry, in /etc/lilo.conf, for your existing kernel to use as a back up incase your new kernel won't load  For example, if your kernel is located in /boot/vmlinuz and the label is Linux, first copy vmlinuz and rename it vmlinuz.old  (e.g.#cp /boot/vmlinuz  /boot/vmlinuz.old).  Next edit /etc/lilo.conf and copy the entry for the original but change the image to /boot/vmlinuz.old and change the label to old. After modifying lilo.conf you must run the #lilo command to update the Linux Loader's configuration files.  After you reboot and the LILO prompt comes up you can enter either Linux for the new kernel or old for the old kernel.

 

LEGEND

# Precedes the command
Bold The command to be entered
> Precedes the example in the file
Italicized File to be opened
Example Shows either syntax or example

 

  1. If you are in Xwindows, you must use a terminal or Konsole, all commands can be done at a command line with no GUI, except for #make xconfig which requires a GUI.  

  2. After you have acquired the latest kernel from www.kernel.org or its mirror site, or from a disk.

  3. untar and unzip the new kernel into the /usr/src directory using the command:

  4. #gzip -cd linux-2.4.0-test9.tar.gz | tar xvf - 

  5. #cd linux

  6. Run one of the following three to choose options for your kernel:

    • #make xconfig            (for Xwindows GUI setup, must have Xwindows running)

    • #make menuconfig     (for command line prompts)

    • #make config              (for command line text menus)

  7. After you have chosen all your options, save and exit the menu.

  8. #make dep                                           (finds dependencies)

  9. #make bzImage                                   (for large kernels)

  10. #make modules                                   (makes loadable modules)

  11. #make modules_install                       (installs modules)

  12. Copy the bzImage to the boot image location you will use to boot Linux, in this instance the image is in /boot/vmlinuz, You can verify the boot image in /etc/lilo.conf.

  13. #cp /usr/src/linux/arch/i386/boot/bzImage  /boot/vmlinuz  

  14. #lilo                                                       (updates lilo)

  15. #shutdown –r now                                (reboots)

  16. After logging in enter:

  17. #uname –a                                           (shows kernel version)

 

BACK TO LINUX