Building a 2.6.6 kernel

Geoffrey Leach geoff at direcway.com
Tue May 25 20:23:49 UTC 2004


What follows is a short course on building your own kernel, using the released
sources from kernel.org.  Keep in mind, that with the freedom of DIY builds
comes responsibility.  If you don't build all of the SCSI controller modules,
for instance, you won't be able to drop in a new SCSI card and have it
"just work".  Also, you can't complain to the good folks who make the 
ernel rpms when your new kernel breaks.

OK.  With all of that in mind, you've installed FC2, and you want to roll your
own.  Here's what you do.

    o Check the functioning of your rescue disk.  Boot with "linux rescue"
      From the Fedora Core 2 Install disk 1 or DVD and make sure that you can
      get a your hard disk.  Nothing that I write here should make your
      system unbootable, unless, of course, you don't have a rescue disk. :-)

    o Go to ftp://ftp.kernel.org/pub/linux/kernel/2.6 and download the 
      latest kernel source.  This may or may not be the same thing as 
      found in the kernel-source-2.6.x rpm (when it becomes available),
      depending on whether or not it was build with patches.

    o Unpack the kernel source file into /usr/src/linux.

    o When your FC2 kernel was installed, a kernel config file was 
      installed in /boot.  Something like /boot/config-2.6.5-1.358
      Copy this file to /usr/src/linux/.config

    o Check that you have all of config options.  Cd to /usr/src/linux.

	# make oldconfig

      This will present any configuration options that are not in your
      .config file.  It's safe to accept the default (hit return) for
      all of them. 

    o nVidia users: check the configuration. If you say,
	# make help
      you'll see that there are a number of helpful make targets. 
      The one you want here is gconfig (if you run Gnome/gtk) or xconfig
      (if you prefer Qt). 

      	# make gconfig
      
      This opens a new window that permits you to fiddle the kernelr
      configuration.  Open the "kernel hacking" section and check that the
      "Use 4Kb for kernel stack instead of 8Kb 4KSTACKS" options is unchecked.
      If not, uncheck it by doubleclicking on the box. (This for gconfig.
      xconfig may be different). Now go to "Processor type and features",
      and within that to "Firmware Drivers".  Make sure that "Use register
      arguments (EXPERIMENTAL) REGPARM" is unchecked. 

    o Name the kernel.  Edit the Makefile.  At the top, you'll see:

	VERSION = 2
	PATCHLEVEL = 6
	SUBLEVEL = 6
	EXTRAVERSION = ...

      or something similar.  If you wish to tag you kernel, set EXTRAVERSION,
      otherwise, clear it.  I use "EXTRAVERSION=ex"

    o Compile the kernel.

        # make all

      You should not see any fatal errors.

    o Install the kernel.  I've appennded a script that I use that makes
      this easy to do. Copy the script to /usr/src/linux, and change 
      VERSION as appropriate. You want to use the same values as set in
      the kernel Makefile here.  DO NOT USE THE SAME NAME AS YOUR EXISTING
      KERNEL.

        # ./install

    o Make a backup copy of /boot/grub/grub.conf.  If you should somehow
      trash the file in the next step, you will need this (and your rescue
      disk) to restore the system.
      
    o Add a stanza to /boot/grub/grub.conf.  If you have a standard Fecora
      grub.conf, it should say default=0, which means that the default 
      kernel is the first title entry.  Copy the first entry somewhere below
      (so your new kernel is NOT the default) and modify the title, kernel
      and initrd entries to match your new version. You'll see the new title
      on the kernel-selection screen when you boot next.
      You should also replace "rhgb quiet" with vga=all.  This will allow you
      to select console properties maximize the amount of infromation you can
      see.  I use vga=780 which gets me 60 linex x 132 characters.

    o Reboot and select your new kernel.  If you're an nVidia user, nothings
      that you have done at this point affects your graphics. 
      One thing at a time.

==== The install script

#! /bin/sh
VERSION=2.6.6ex
make modules_install
cp -vf bzImage /boot/vmlinuz-${VERSION}
cp -vf System.map /boot/System.map-${VERSION}
mkinitrd -f -/boot/initrd-${VERSION}.img ${VERSION}





More information about the users mailing list