RHCE2B.COM Kernel Recompilation Study Guide


References

Steve's RHCE ® Study Guide Section on Kernels
Red Hat's ® Configuration Guide section on Recompiling the Kernel

"Amazon.com logo"
"Amazon.com" RHCE
Michael Jang
"Amazon.com" RHCE Red Hat Certified Engineer Stud...
Bill McCarty

Used $6.58!
"Amazon.comj" RHCE Red Hat Certified Engineer Linu...
Syngress Media

Used $9.95!
"Amazon.com" RED HAT EXPANDS RHCE TRAINING/CERTIF...
Worldwide Videotex...
New $5.95!
(Prices May Change)
Privacy Information


Why Recompile the Kernel?

You may need to recompile the kernel in order to support new hardware. You also may wish to optomize your kernel for a particular purpose.


What You need to begin

You will need the source code for the kernel. Make sure you install both the headers and the source.

rpm -ivh binutils*.rpm
rpm -ivh cpp*.rpm
rpm -ivh dev86*.rpm
rpm -ivh gcc*.rpm
rpm -ivh glibc-devel
rpm -ivh kernel-headers.*.rpm
rpm -ivh kernel-source.*.rpm
rpm -ivh make
rpm -ivh ncurses
rpm -ivh ncurses-devel

Note: Red-Hat's kernel source is slightly different than the code you will find at kernel.org. Unless you have some compelling reason not to, you should use Red Hat's version.


Building the Kernel

cd /usr/src/linux-2.4

If you check, linux-2.4 should be a symbolic link to the newest version of the kernel source code. For example, on my machine, it it a link to linux-2.4.9-31.

make mrproper

This command gets rid of anything that may have been left over from pevious builds of the kernel.

Now you have a choice of configuration programs to use.

  • make oldconfig: This sets up the default settings that Red Hat shipped with.
  • make xconfig: This brings up a menu in X-Widows that allows you to set kernel configuration parameters.
  • make menuconfig: This brings up a text menu-based configuration program
  • make config: This will ask you a series of questions.
  • I usually start with make "old config" and then do a "make xconfig".


    What should I change when configuring the Kernel?

    Under "Processor Type and Features", you wil find the "Processor Family" menu. By selecting the correct processor for your machine, you can optomize the kernel for your machine. Under "File Systems", make sure to enable any file systems that you want recognized. For example, on a dual-boot machine, you may wish to enable NTFS. There are a lot of possabilities here. Look around.

    What do I do after configuring the Kernel?

    make dep

    this sets up all the dependencies correctly

    make clean

    This cleans up the source directory.


    Setting up the EXTRAVERSION flag

    Edit the Makefile. You will find a line that says something like this:

    EXTRAVERSION = -31

    Change it to read something like this:

    EXTRAVERSION = -31-randy

    This will be the name for our new kernel. If you named the kernel exactly the same thing as the kernel you currently boot up with, you would risk screwing up your current configuration. Hence you should name it something unique.


    Building the Kernel

    make bzImage

    This builds the actual kernel. It is found in /usr/src/linux-2.4/arch/i386/boot/bzImage

    make modules

    This creates all the Kernel modules

    make modules_install This installs the modules.


    Mkinitrd

    If you want to boot from a SCSI adapter, and you have SCSI in a module, then you need to make a new initrd file for your kernel.

    mkinitrd 2.4.9-31-randy


    How do I install the Kernel?

    cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot/vmlinuz-2.4.9-31-randy

    If you are using GRUB, add the following lines:

    title Red Hat Linux (2.4.9-31-randy)
            root (hd0,1)
            kernel /vmlinuz-2.4.9-31-randy ro root=/dev/hda6
            initrd /initrd-2.4.9-31-randy.img
    

    If you have LILO, then add the following lines, substituting the correct value for you root partition:

    image=/boot/vmlinuz-2.4.9-31-randy
            label=linux-2.4.9-31-randy
            initrd=/boot/initrd-2.4.9-31-randy.img
            read-only
            root=/dev/hda6
    

    Take Quiz on Kernel Recompilation

    Linux Waves Banner Exchange
    Linux Waves Banner Exchange

    Search Amazon.com:
    In Association with Amazon.com


    www.NoMonthlyFees.com
    RHCE2B.COM Home Page
    RHCE2B.COM Practice Test for the RHCE exam
    This site is not authorized or reviewed by Red Hat, Inc.
    Legal stuff

    Books : Kernel Linux

    In association with Amazon.com
     
     

    1. Books : Linux Kernel Development (2nd Edition) Linux Kernel Development (2nd Edition)
    by: Robert Love
    12 January, 2005
    List Price: $44.99
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    2. Books : Understanding the Linux Kernel Understanding the Linux Kernel
    by: Daniel Bovet, Marco Cesati
    17 November, 2005
    List Price: $49.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    3. Books : Linux Pocket Guide Linux Pocket Guide
    by: Daniel J. Barrett
    01 March, 2004
    List Price: $9.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    4. Books : Linux Device Drivers, 3rd Edition Linux Device Drivers, 3rd Edition
    by: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
    07 February, 2005
    List Price: $39.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    5. Books : The Debian System: Concepts and Techniques The Debian System: Concepts and Techniques
    by: Martin Krafft
    19 September, 2005
    List Price: $44.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    6. Books : Building Embedded Linux Systems Building Embedded Linux Systems
    by: Karim Yaghmour
    22 April, 2003
    List Price: $44.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    7. Books : Understanding the Linux Kernel (2nd Edition) Understanding the Linux Kernel (2nd Edition)
    by: Daniel P. Bovet, Marco Cesati
    December, 2002
    List Price: $49.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    8. Books : Linux Cookbook Linux Cookbook
    by: Carla Schroder
    29 November, 2004
    List Price: $44.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    9. Books : How Linux Works How Linux Works
    by: Brian Ward
    14 May, 2004
    List Price: $37.95
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    10. Books : The Linux(R) Kernel Primer : A Top-Down Approach for x86 and PowerPC Architectures The Linux(R) Kernel Primer : A Top-Down Approach for x86 and PowerPC Architectures
    by: Claudia Salzberg Rodriguez, Gordon Fischer, Steven Smolski
    19 September, 2005
    List Price: $49.99
    Amazon.com's Price: price not available
    Amazon.com prices subject to change.

    page 1 of  4
     1  2  3  4 

     
    script by MrRat