Originally Published: Wednesday, 20 June 2001 Author: Subhasish Ghosh
Published to: develop_articles_tutorials/Development Tutorials Page: 2/2 - [Printable]

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!

makefile  << Page 2 of 2  

Step 9: Perform a "ls -al" from within the path: /usr/src/linux.

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 /usr/src/linux) vi Makefile

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 /usr/src/linux type: 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:

image=/boot/vmlinuz-2.2.16-22ghosh
label=GhoshKernel
initrd=/boot/initrd-2.2.16-22ghosh.img
root=/dev/hdc5
read-only

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/reboot or /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: auspicious_blessingsindia@hotmail.com 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.





makefile  << Page 2 of 2