Home arrow Site Administration arrow Page 8 - Kernel, Cron, and User Administration, Part 2

Compiling and Installing a Custom Kernel - Administration

Today, continue on your path to RHCE certification. Learn about creating a new kernel the easy way, kernel sources, recompiling a kernel, and the cron and at systems. Take notes, because there's a test at the end. This comes from chapter five of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7).

TABLE OF CONTENTS:
  1. Kernel, Cron, and User Administration, Part 2
  2. Updating Your Boot Loader
  3. The Kernel Source Tree and Documentation
  4. The Kernel RPMs
  5. GUI Kernel Source Management
  6. The Linux Kernel tar File
  7. Understanding Kernel Configuration Options
  8. Compiling and Installing a Custom Kernel
  9. The cron and at Systems
  10. Setting Up cron for Users
  11. Certification Summary
  12. Self Test
  13. Lab Questions
  14. Self Test Answers
  15. Lab
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 7
October 06, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

After setting up all the options you want from one of the Kernel configuration programs, make sure to save your changes. The changes are saved in the appropriate .config file. Next, you can compile your kernel. Compiling a new kernel can be a long and tedious process. The following is a list of things you should do to successfully compile your kernelóinorder:

  1. If you havenít already done so, create a custom boot floppy disk with the following command. Test the floppy thatís created.

    # mkbootdisk `uname -r`

  2. Run the cd /usr/src/linux-2.4 command to reach the proper directory. Youíll need to run your commands to modify and compile the kernel in this directory. This assumes that youíve installed the appropriate kernel-source RPM. In RHEL 3, this directory is linked to the directory with the source code, /usr/src/linux-2.4.21-4.EL.

  3. Open /usr/src/linux-2.4/Makefile in a text editor. In RHEL 3, the EXTRAVERSION variable is already set to identify a custom kernel. If necessary, change the value of this variable to uniquely identify your kernel. Record the value of this variable.

    EXTRAVERSION= -4.ELcustom

  4. Save your current kernel configuration file. Itís stored in the /boot directory. For RHEL 3, itís the /boot/config-2.4.21-4.EL file. Have it ready with a rescue floppy in case disaster strikes. Copy it to the /usr/src/linux-2.4/.config file.

    • Alternatively, you can start from a standard configuration file in the /usr /src/linux-2.4/configs/ directory. You can also run the make oldconfig command.

  5. Run the make mrproper command to ensure your source files are in a consistent and clean state.

  6. Now you can customize your kernel with one of the following three utilities: the make config command runs the text-based configuration script; the make menuconfig command runs a low-level graphical configuration script; and the make xconfig command starts the X Window System configuration tool.

  7. Make any changes as required by your hardware and/or the RHCE exam. Before you exit from the kernel configuration utility, make sure to save your changes!

  8. The make dep command will set up all your dependencies correctly. This takes the settings from /usr/src/linux-2.4/.config and pushes them down into the correct source code subdirectory. This will take some time, as there are nearly 1,500 possible kernel settings on a RHEL 3 system!

    ON THE JOB!  The make dep process took about 20 minutes on my computer with a 1.2GHz CPU.

  9. Run the make clean command to prepare the source code directories to build your new kernel.

  10. The make bzImage command compiles the kernel and creates a gzip compressed kernel image file.

    ON THE JOB!  The make bzImage process took about 20 minutes on my computer with a 1.2GHz CPU.

  11. Now you need to build your modules (you did include kernel module support, didnít you?). Use make modules to build all your modules.

    ON THE JOB!  The make modules process took about 50 minutes on my computer with a 1.2GHz CPU.

  12. Now you need to install your newly made modules, which will install all your loadable modules into a new subdirectory of the /lib/modules/kernelversion directory. The kernelversionshould correspond to the EXTRAVERSION variable in your Makefile. Use make modules_install to install your modules.

  13. With our kernel now built, we need to move it to /boot before we can boot from it. Run the make install command to copy the new kernel and create a new Initial RAM Disk file (initrd) in the /boot directory. It also updates the default GRUB boot loader.

    ON THE JOB!  The make install command copies your new kernel from the /usr/src/linux-2.4 /arch/i386/boot to the /boot directory. It also uses the mkinitrd command to create a new Initial RAM disk in the /boot directory.

  14. Verify the changes to the /boot directory.

Building a kernel is an involved process, but it follows a standard pattern. It is very important that you become familiar with kernel construction procedures and troubleshooting. Refer to the following Scenario & Solution for some common problems encountered and their recommended solutions.

Scenario & Solution
You looked under /usr/src/ but did not see the Linux kernel source code. What did you do wrong?You did not install the kernel source code. Install the kernel source and related RPMs or use the Red Hat Package Management utility to install the Kernel Development package group.
You configured the kernel as a monolithic kernel but when you run make bzImage, it fails, saying the kernel is too big. What should you do?You must reconfigure your kernel to use modules. There are limits on the size of a compressed kernel, so you should always build a modular kernel.
You can't find your new kernel.Did you create an appropriate EXTRAVERSION cariable in your Makefile? Did you use this cariable throughout this process? If not, then you may not be able to correctly locate the kernel or its modules.

This is part one from the fifth chapter of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7). Check it out at your favorite bookstore today. Buy this book now.



 
 
>>> More Site Administration Articles          >>> More By McGraw-Hill/Osborne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: