Compiling the Kernel


When you've downloaded a fresh kernel, or patched your existing sources, you need to compile the new kernel to use the new functionality. Compiling from source means transforming human-readable text/code into binary, machine-readable form. Compiling a kernel also means taking those binary files and putting them where they belong in /boot and /lib and then notifying GRUB (or LILO) of the changes.

The good news is that you have your old buddy make to automate nearly the whole compile process for you. By following these steps, you can compile and install a custom kernel just for you.

  1. Back up your data, just in case.

  2. Make sure you have a working boot disk with the old kernel on it, just in case something goes wrong. See the following note to learn how to create one.

    Note

    Before making any changes to your current, running kernel, make sure you have a backup copy. SUSE recommends using the installation CD to boot in an emergency, but what if the CD drive is inaccessible? It's good to have a floppy backup as well.

    YaST once allowed you to make a boot disk directly, but the kernel has grown too large to fit on a single floppy, complicating the task. It is still possible to create a bootable kernel with five floppies, using this process:

    If you need to format the disks first, use

    fdformat /dev/fd0u1440 

    Mount the SUSE Linux CD1 (for example, to /media/cdrom):

    mount -tiso9660 /dev/cdrom /media/cdrom 

    Change to the boot directory on the CD:

    cd /media/cdrom/boot 

    Create the boot disk with the following command:

    dd if=/media/cdrom/boot/bootdisk of=/dev/fd0 bs=8k 

    The README file in the CD's /boot directory will give you more information on including kernel modules on additional floppies.


  3. Backup the .config file, if it exists, just in case. Type (as SuperUser) cp .config .config.bak.

  4. Run make mrproper to prepare the kernel source tree, cleaning out any old files or binaries. make mrproper will delete the .config file. Restore it.

  5. Edit the makefile to change the EXTRAVERSION number.

  6. Modify the kernel configuration file with make xconfig (or the interface of your choice).

  7. Run make dep to create code dependencies used later in the process.

  8. Run make clean to prepare the sources for actual compilation.

  9. Run make bzImage to create a binary image of the kernel.

    Note

    Several make directive choices exist to create this image, but the most common are the following:

    • zImage makes an uncompressed kernel image.

    • bzImage creates a compressed image. Some BIOS's cannot parse large images, and this image accommodates that requirement.

    • bzDisk creates a compressed image and places it on a floppy disk for testing purposes. Make sure you have a floppy in your drive before running this directive. You won't be prompted.


  10. Run make modules to compile any modules your new kernel needs.

  11. Run make modules_install to install the modules in /lib/modules and create dependency files.

  12. Run make install to automatically copy the kernel to /boot, create any other files it needs, and modify the bootloader to boot the new kernel by default.

  13. Open a text editor and verify the changes made to /boot/grub/grub.conf; fix if necessary. If you happen to be running LILO as your bootloader, check /etc/lilo.conf and rerun /sbin/lilo if you make any changes.

  14. Reboot and test the new kernel.



SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net