resources:

  • grub info
  • Kernel.org repository
  • Digital Hermit detailed generic kernel rebuild HOWTO
  • Some instructions for using make-kpkg (we don't care about the patch on that page.)

    Follow these steps to install a new kernel under Debian:
    Login as root on Debian. There are a few tools you'll need to have to make this process as painless as possible. If we need to get a file over the web, we'll need a web browser, and we'll also need the ncurses library to use menuconfig. The kernel-package script will simplify our lives a lot. Using the 'apt-get' package manager, install lynx or links (text mode web browsers):

    apt-get install libncurses5-dev
    apt-get install lynx links
    apt-get install kernel-package 
    apt-get install bzip2
    
    Use one of these to obtain the kernel source from blowfish if you want the latest kernel.
    links http://blowfish.cs.csubak.edu/cs216
    
    Navigate to the most current source and download it. Unpack it into the /usr/src directory and then create a symlink /usr/src/linux:
    cd /usr/src
    tar jxvf ~student/linux-2.6.10.tar.bz2
    ln -s linux-2.6.10 linux
    cd linux
    
    or, if you want to use the stable source from Debian:
    apt-get install linux-source
    cd /usr/src
    tar jxvf linux-source-2.6.18.tar.bz2
    ln -s linux-source-2.6.18 linux
    cd linux
    
    Now we need to determine what our hardware is. To find out about our processor, we
    cat /proc/cpuinfo
    
    The '/proc' filesystem is a 'virtual' filesystem where nearly everything about the running system is stored. Remember, under Unix, everything is a file. To find out about what other hardware we have, we'll probe the pci bus:
    lspci
    lsmod | less
    
    Since we may reasonably assume that the running kernel has loaded modules appropriate to our hardware, we also listed all the currently running kernel modules. We now know that we have an VMware SVGA II card and an AMD 79c970 ethernet card (the module list tells us this is a 'pcnet32' driver), as well as an Intel PIIX4 chipset. We also know that we're running XFS, ReiserFS and ext3 filesystems (because we remember when we set the machine up.) If we didn't remember, the `mount` command will tell us.

    Now we start to configure the kernel:

    vi Makefile
       :%s/EXTRAVERSION =/EXTRAVERSION = steve/
       :wq
    make-kpkg clean 
    make menuconfig
    
    You will now be in a menu based configuration utility. The defaults are mostly what you want for now, especially if you're using the Debian kernel. There are a few things you should change though... Access to your running config is handy next time you build a kernel. You want your filesystems to be built into the kernel (not modules) so you don't have to boot using a ramdisk.
    Note that by default, modules are built for every sort of hardware you might ever encounter, causing the compile to take forever and a day. On the other hand, if you go crazy un-checking hardware drivers, you might find the kernel won't boot or some hardware won't work.
    General setup -> Kernel .config support [on]
                       Enable access through /proc/config.gz [on]
    Filesystem -> Reiserfs [*]
    Filesystem -> Ext3 [*]
    Filesystem -> XFS [*]
    
    Once you're done, choose "Exit". You do want to save your config. Now use the make-kpkg script to build your kernel.
    make-kpkg --initrd kernel_image
    
    If you're not using the script you'll go through the "make bzImage ; make modules ; make modules_install" routine, and then have to move the kernel to the appropriate place and edit the grub configuration.

    What make-kpkg does is create a Debian package for your new custom kernel. You now need to install that package:

    dpkg --install /usr/src/kernel-image-2.6.18-steve_10.00.Custom_i386.deb
    
    substituting, of course, the actual name of the package you just created.
    now you can reboot:
    /sbin/shutdown -r now