
07-21-2008
|
|
Registered User
|
|
|
Join Date: Jul 2008
Posts: 2
|
|
|
how to compile linux kernel on redhat
Hello,
Please let me know how to compile a linux kernel on redhat. I am relatively new in this area so please be a little patient with me. Here is the file I was consulting with the following details:
Compiling the Linux Kernel on Redhat 7.1
This page describes how to install the latest Linux version 2.4 kernel on Redhat 7.1. In particular, it describes how to compile the official kernel sources with Redhat's default configuration.
Motivation
It can be quite tricky for a typical Linux user to configure the official linux kernel source from www.kernel.org to work with Redhat. For example, I once compiled a kernel that didn't work with my sound card. The best way to avoid such headaches is to get the kernel source config file from the Redhat source RPM, and to use this config with the official kernel source from kernel.org. The following instructions outline how this can be done. I suggest using this guide as a supplement to the usual documentation, not as a replacement.
Download the Sources
- Download latest stable kernel source from kernel.org. Don't try to compile the same version that you are already using unless you know what you are doing, or you risk messing up your kernel modules. You can figure out what kernel you are already running with $ uname -r
- Unpack the sources. Older versions had to be unpacked in /usr/src, but now days you are probably better off compiling the source in your own home directory logged in as a normal user. $ tar xzf linux-2.4.3.tar.gz
- You can get the config files from the kernel source RPM. Unfortunately, this implies installing over 100 MB of kernel source just to get a single 30 kB file. Be aware that there are two different source RPMs, i.e. kernel-xxx.xxx.srpm and kernel-source.xxx.xxx.rpm. Once you have these files, it is probably possible to uninstall the source RPM to save disk space. To save you the time and hassle, here are the config files for kernel 2.4.2, as shipped with the Redhat 7.1 source RPM. $ tar xzf configs.tar.gz
Configure
- In top directory of your kernel source from kernel.org, run $ make mrproper
- Copy the most appropriate config file for your system into .config in the top directory of the kernel source. $ cp configs/kernel-2.4.2-i586.config linux-2.4.3/.config
- Your config file is for an older version of the kernel, and so must be updated. The following command will only ask questions about new features. Most of the time you can safely leave out these new features unless they specifically interest you. $ make oldconfig
- As configured, your kernel and modules will support a huge variety of hardware and features that you don't need. You might want to turn off some of things to speed up the compile and save disk space. Or you may want to enable some feature that was turned off in the default. To do so, run $ make xconfig
- Make a backup copy of .config. $ cp .config ~/backup-kernel-config
Compile the kernel and modules
- This part is easy. You'll have plenty of time to go get a cup of coffee.... $ make dep
$ make bzImage
$ make modules
Install your new kernel
- Up to now, you have hopefully been logged in as a normal user. Now you'll need to become root. $ su
- Copy the kernel into its final destination. Don't overwrite your working kernel!!! # cp ~user/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.3
- Install the modules. # make modules_install
- Edit /etc/lilo.conf so that you can boot the new kernel. Don't take out the lines for your working kernel until you have booted the new one!!! In the following example, you'll probably have to change the location of the root partition. image=/boot/vmlinuz-2.4.3
label=linux-2.4.3
read-only
root=/dev/hdc2
- Run lilo # /sbin/lilo
- If you want a rescue disk, do $ make bzdisk
continued: I went to the kernel.org site downloaded the the latest stable version of linux, untarred the file, I also downloaded configs.tar.gz and untarred it. i am now confused, what to do next? Thanks in advance. What is the top directory of my kernel source, getting a bit confused from hereon. Please explain or you can explain the whole process from the beginning. Also I am not working with linux 7.1, but with Linux 4.0, however, i am hoping they would be same. Thanks! 
|