|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Wednesday, 20 June 2001||Author: Subhasish Ghosh|
|Published to: develop_articles_tutorials/Development Tutorials||Page: 1/1 - [Std View]|
Compiling, Configuring and Installing a Kernel
Linux.com contributor Subhasish Ghosh gives us 27 simple steps to working with the Red Hat Linux Kernel. Learn how to compile a kernel to your liking, and then actually get it running!
This article provides you with an extremely detailed and step-by-step process describing how to Compile, Configure and then install a Kernel.
Please note that I have performed all the steps mentioned below on a computer system with the following configurations: Compaq Presario 4010 Series computer system, 15.5 GB Hard Disk Space, 96 MB RAM, 400 MHz Intel Celeron Processor, Red Hat Linux 7.0 Distribution Release underlying Kernel: 2.2.16-22
Our aim is to obtain a fully working Kernel after all the steps mentioned below have been completed. For example, I have a Customized Kernel named "2.2.16-22ghosh" (cause my name is Subhasish Ghosh but you could have anything else obviously) running on my system (in fact a couple of them running together). So, happy hunting and compiling the Linux Kernel!
The steps to be followed are as follows:
Step 1: Login as "root" and then perform these steps.
Step 2: At the command prompt, type in: rpm -q kernel-headers kernel-source make dev86
Step 3: If these RPMs are already installed, then proceed to step 4. Otherwise, mount the Red Hat Linux 7.0 CD-ROM and then perform a
rpm -Uvh for installing these RPMs.
Step 4: If you have a fully working X Window System, then type in "startx" at the command prompt. In case you don't have an X Window System configured, I personally would suggest you do it now because it helps a lot. If X Window System is NOT configured, then type in "make config" or "make menuconfig" at the command-prompt. I have assume you have an X Window System running on your system, and for that reason, just type in "startx".
Step 5: Once within the GNOME environment, open the GNOME Terminal and type in:
and press enter.
Step 6: Then from within
/usr/src/linux, type in "make xconfig".
Step 7: The GUI version of "make config" should come up on the screen. It provides you with the various options you have for obtaining a Customized Kernel.
Step 8: Now, I would suggest you leave most of the default options just as they are. Just don't try to fiddle around right here because most of the options are sensitive and require expert handling. You can always come back later when you have something specific you want to compile. At this point though, just make the following changes:
1. Processor Type and Features: Choose the correct Processor depending on whether you are working on a Pentium 2, 3, or Intel Celeron like me. For example, I did the following:
Processor Family: PPro/686MX
Maximum Physical Memory: 1 GB
Math Emulation: Yes
2. Open the Filesystems dialog and then make the following changes to it: For example I did:
DOS FAT fs support: Yes(y)
MSDOS fs support: Yes(y)
UMSDOS: m, VFAT(Windows 95) support: Yes(y)
NTFS filesystem support (read-only): Yes(y)
NTFS read-write support(DANGEROUS): No(n)
After you have made these changes, please make sure you haven't changed the others in the process. All these above-mentioned changes are quite harmless and won't cause any harm to your existing Linux Kernel.
3. Save and Exit from the Main dialog.
Step 9: Perform a "ls -al" from within the path:
Step 10: You will see a file called: "Makefile". Makefile is an extremely important file for this entire Compilation process. So, make sure you create a backup of this file, by using:
cp Makefile Makefile.bak
Step 11: Now, do: (from within
Step 12: Go to line EXTRAVERSION and change it to something you like. For example, I changed EXTRAVERSION=-22, to EXTRAVERSION= "-22ghosh". You are free to name it any way you wish.
Step 13: Save and exit the file.
Step 14: All the following steps should be done from within:
/usr/src/linux. Type in: "make dep clean", and press enter.
Step 15: Then type in: "make bzImage modules". This could take some time, go and have a drink while it compiles all the necessary files. I usually take a nap during this time, cause I do all this stuff in the middle of the night.
Step 16: After this step is over, a "bzImage" file would be created in the directory
/usr/src/linux/arch/i386/boot, just go to this directory and check whether a file called "bzImage" has been produced or not. IF AND ONLY IF all the compilation steps have been executed correctly and all the options that we have had chosen in "make xconfig" are correct, this file would be produced. If you can find this file, which I am sure you will be able to, well, you can start enjoying life already, cause you have won 75% of the battle. If you can't see this file, I am sorry, but you must have had made a mistake somewhere: Take a break and carry out all the steps again from the start. I am sure you will eventually succeed.
Step 17: From within
cp ./arch/i386/boot/bzImage /boot/vmlinuz-2.2.16-22ghosh and press enter.
Step 18: Then type in:
cp System.map /boot/System.map-2.2.16-22ghosh
Step 19: Then type: "make modules_install" and press enter. You would see all the modules being installed in a new customized directory.
Step 20: Now type:
mkinitrd /boot/initrd-2.2.16-22ghosh.img 2.2.16-22ghosh
Step 21: Then, type in:
vi /etc/lilo.conf and then add the following entry:
Step 22: Save and exit. Please note that you can also change the entries in the
lilo.conf file as you desire, and the root should be the root in your system: in my machine, it's at
/dev/hdc5. Insert the correct info from your system.
Step 23: Type in:
/sbin/lilo -v -v
Step 24: Read all the info on the screen. If there are no errors, well, the job's all done. Congratulations!
Step 25: Reboot the system by typing in:
/sbin/shutdown -r now.
Step 26: In the start-up screen, press Tab (or Control-X, if you have the LILO start-up screen), and you can see the entry: GhoshKernel along with the other pre-existing entries.
Step 27: Type in: GhoshKernel and press enter. The fully working Customized Kernel will boot your system.
So, you have a fully working Customized Kernel working on your system. After logging in as "root", type in:
uname -r and press Enter. You can see the following entry on the screen: 2.2.16-22ghosh that proves that you are running a Customized Kernel. That's all. Also remember, that you can have as many Kernel versions as you like.
That's all there is to it. In case this doesn't work out or you guys and gals face problems, make sure you e-mail me at: firstname.lastname@example.org for questions and suggestions. I would really like to hear from you and help you and I hope this article helps everyone out there who wants to run a fully working Customized Kernel.