justlinux.com
Thu, 18-Mar-2010 04:17:20 GMT
internet.com
Forum: Registered Users: 73706, Online: 101
nhfs Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home Home

Help File Library: Building and Installing a Linux Kernel in Red Hat


Written By: Brian Jones (a.k.a njcajun)

I was getting really frustrated building this kernel using the online and hard copy resources, because they are sketchy in some parts (i.e., "depends on the system," "if you want," "might be a good idea"). So I got together all of my resources in one place, sat down with the README and CHANGES docs that come with the kernel, and decided to document, step by step, the process I went through. Of course I don't go through every config option the kernel has to offer, but if you need information on each choice you have, enter 'xconfig' like I do below, and there's help all along the way.

This was done on a fresh install of Red Hat Linux 7.0 on an AMD 700MHz, with a Voodoo 3 3000 PCI, and 128MB RAM....

To accompish this task, perform the following steps.

  1. Log in as root.
  2. Download linux-2.4.0.tar.gz (or any other kernel) to your home directory. Since you should root, that's the /root directory.
  3. Unpack the tarball with the following command:
    tar xvzf linux-2.4.0.tar.gz
    

    This will create a new directory in /root called linux.
  4. Move to the diretcory with this command:
    cd linux
    
  5. Type
    make mrproper
    

    (This is per the instructions in the README that come with the kernel.)

  6. Download an updated gcc from Red Hat or your distribution's site. The newser the gcc, the better the compiliation session will go. In this example, we will step through the sub-steps needed to install gcc from an RPM package.
    1. In the directory where you stored the gcc RPM file, type:
      rpm -Fvh gcc-2.96-69.i386.rpm
      
    2. Verify the installation took effect by typing:
      gcc --version
      
  7. Next, surf to http://www.kernel.org and download the latest version of util-linux, which ever version is recommended in the Changes file that comes with the kernel.
    1. After unzipping the util-linux package, install util-linux using these commands:
      ./configure
      make
      make install
      
    2. Verified your version by typing:
      fdformat --version
      
  8. Also download the latest version of modutils from kernel.org.
    1. Install modutils by typing:
      rpm -Fvh modutils-2.4.0.i386.rpm
      
    2. Verify the version:
      'insmod -V'

      (This output looks like default USAGE output, but the first line of all this is the version.)

  9. Repeat the RPM download and installation procedure for the latest versions of ksymoops and e2fsprogs.
  10. If necessary (as specicifed in the CHANGES file), download and install the latest mkinitrd version
    1. Type the following command:
      rpm -Fvh mkinitrd-2.9-1.i386.rpm
      
    2. Verify the version.
  11. Type
    make xconfig
    

    to create the .config file in the /linux directory.
  12. Examine the top-level Makefile (using vi or emacs) to confirm special issues. In this example, the line export INSTALL_PATH=/boot was commented out, so it was uncommented, as Red Hat puts its kernel and files in /boot, not root (/).
  13. Type
    make dep
    

    Ideally, there should be no errors as you will have downloaded and installed all the needed files by now.

  14. Type
    make bzImage
    
  15. Type
    make modules
    
  16. Make a backup copy of your module directory before entering the next command:
    make modules_install
    
  17. Copy your new kernel (called bzImage) to the /home directory as a backup using this commands:
    cp /root/linux/arch/i386/boot/bzImage /home/bzImage
    
  18. Copy the new kernel to the /boot directory and rename it:
    mykernel-2.4.0
    cp /root/linux/arch/i386/boot/bzImage /boot/mykernel-2.4.0
    
  19. Using vi or Emacs, edit /etc/lilo.conf to boot from either image, with the new one as the default.
    Here's an example lilo.conf file:
            boot=/dev/hda
            map=/boot/map
            install=/boot/boot.b
            prompt
            timeout=50
            message=/boot/message
            linear
            default=new
    
            image=/boot/mykernel-2.4.0
            label=new
            root=/dev/hda1
            read-only
    
            image=/boot/vmlinuz-2.2.16-22
            label=old
            root=/dev/hda1
            read-only
    

  20. Type
    lilo
    
  21. As an extra precaution, email this file to yourself at an account you can get to from another machine if you have to.
  22. Reboot your machine.

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
internet.commerce
Be a Commerce Partner












The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers