Back to home
<<Back to Linux Notebook

Recompiling the Kernel
Now that the basic installation is complete, I wanted to recompile the kernel. There are several ways to recompile the kernel. I prefer to do it "the Debian way", because the debian package that contains the source code also contains a reasonable config file. So, you could theoretically make no changes to the config file and compile it, and it will work. As a result, I feel that I will have the highest probability of success using this method.
  1. Search to determine what the latest kernel available is

    # apt-cache search linux-image

    At the moment, it is 2.6.15-1-686.

    apt-get install linux-image-2.6.15-1-686

  2. If a new kernel image is installed, the lilo.conf has to be modified appropriately. Specifically, the

    image=/boot/vmlinuz-2.6.15-1-486

    line, and the

    initrd=/boot/initrd.img-2.6.15-1-486

    line in the above lilo.conf file have to be updated to match what is in the /boot directory. Then write it to the MBR again (# /sbin/lilo) and reboot.

  3. Reboot, and make sure that the new kernel and the LILO settings are correct. Assuming they are, continue on...

  4. Become root again

    $ su

  5. Download the kernel source and the patch for the debian logo (which will be displayed as the computer is booting into Linux)

    # apt-get install linux-source-2.6.15 kernel-patch-debianlogo

  6. Unpack the kernel source

    # cd /usr/src
    # tar -jvxf kernel-source-2.6.15.tar.bz2

  7. Create a symbolic link to the newly unpacked directory

    # ln -s kernel-source-2.6.15 linux

  8. Unpack the debian logo patch

    # cd /usr/src/kernel-patches/diffs/debianlogo
    # gunzip debian-logo-2.6.2.gz

  9. Patch the kernel

    # cd /usr/src/linux
    # patch -p1 < /usr/src/kernel-patches/diffs/debianlogo/debian-logo-2.6.2

  10. Copy the config file that comes with the kernel source to the appropriate directory so that it can be used to configure the kernel

    # cp /boot/config-2.6.15-1-686 /usr/src/linux/.config

  11. Get the necessary packages so that make menuconfig can run

    # apt-get install make libncurses5-dev gcc

  12. Now configure the kernel

    # make menuconfig

    Then choose the following options:
        Processor type and Features --->
            Processor family ... --->
                Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon
        Graphics support --->
            [*] Support for frame buffer devices
            [*] VESA VGA graphics support
            Console display driver support --->
                [*] Video mode selection support
                <*> Framebuffer Console support
            Logo Configuration --->
                [*] Debian GNU/Linux Open Use logo (NEW)
    Say "N" to all other video device drivers except vesa. The Debian configuration has lots of things built as modules here and it seems to cause problems (at least for me). Say "N" to all other boot logos except Debian.

  13. Get kernel-package

    # apt-get install kernel-package

  14. Compile the kernel

    # make-kpkg clean
    # make-kpkg --initrd --append-to-version=-2006-0720.01 kernel_image

    Note: this will take a while to finish (~60min?)

  15. Install the newly compiled kernel

    # cd /usr/src/
    # dpkg -i kernel-image-2.6.8-2006-0720.01.Custom_i386.deb

  16. Modify lilo.conf for the new kernel

    # nano -w /etc/lilo.conf

    Add the following stanza:
        image=/boot/vmlinuz-2.6.15-2006-0720.01
            label="2.6.15.01"
            root=/dev/hda5
            initrd=/boot/initrd.img-2.6.15-2006-0720.01
            vga=791
            read-only

  17. Write the lilo.conf to the MBR

    # /sbin/lilo

  18. Reboot into the new kernel
(written 7/26/2006)




Fixing What I Did Wrong
Normally, that's all you would need to do. However, I almost never compile a kernel correctly the first time. I noticed after I compiled this kernel that I could not mount vfat partitions. It turns out that I missed compiling a language support option that is needed. Under File Systems --> Native Language Support, the NLS_ISO8859-1 has to be set to be compiled as a module. So, here's what I had to do to recompile again.
  1. log in

  2. su

  3. Go back to the source directory

    # cd /usr/src/linux/

  4. Reconfigure the kernel properly

    # make menuconfig

    Then fix what I did wrong the first time (compile the NLS_ISO8859-1 language support as a module)

  5. Recompile the kernel (note that what I appending to the kernel filename is slightly different)

    # make-kpkg clean
    # make-kpkg --initrd --append-to-version=-2006-0720.02 kernel_image

  6. Install the kernel

    # cd /usr/src/
    # dpkg -i kernel-image-2.6.15-2006-0720.02.Custom_i386.deb

  7. Modify lilo.conf for the new kernel

    # nano -w /etc/lilo.conf

    Add the following stanza:
        image=/boot/vmlinuz-2.6.15-2006-0720.02
            label="2.6.15.02"
            root=/dev/hda5
            initrd=/boot/initrd.img-2.6.15-2006-0720.02
            vga=791
            read-only

  8. Write the lilo.conf to the MBR

    # /sbin/lilo

  9. Reboot into the new kernel

  10. It worked, so now the lilo.conf can be modified such that the new kernel gets booted by default.
(written 7/26/2006)


Now that the kernel has been recompiled, move on to compiling the NDIS wrapper.






Linux Notebook on FluggartFluggartEmail