| Originally published: Friday, 6 July 2001 | Author: Subhasish Ghosh |
| Published to: develop_articles_tutorials/Development Tutorials | Page: 1/1 [Standard view] |
Compiling a Linux Kernel: Some Pitfalls ReviewedSubhasish Ghosh returns with a quick look at some common problems with compiling a kernel, and what to do about them.
|
|
Please note, the discussion mentioned below was carried out 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
Introduction
Once our Custom Linux Kernel has been built, our aim would be to properly configure it. That includes identifying the Common Mistakes, and general Troubleshooting.Common Mistakes & Remedies
Compilation and configuration of a Custom Linux Kernel involves a number of complicated steps. Fortunately, the user is abstracted from all these by the Shell. But, when the Compilation and Configuration steps have not been carried out in a perfect manner, one is bound to get error messages on the screen. Though these can vary from as simple as "typos in /etc/lilo.conf", but can be as complicated as "bad cache memory" and others. Here, I would categorize a few common problems one may face while Building a Custom Linux Kernel including:
- Kernel will not Boot.
- Strange I/O Problems.
- Extremely Slow Kernel.
- Kernel will not Compile.
- System will not Boot.
Kernel will not Boot
You have created a new Custom Linux Kernel, made an entry in /etc/lilo.conf and then rebooted the computer system. But, your new Kernel won't boot, and instead you get:
Warning: unable to open an initial console
Kernel panic: no init found. Try passing init= option to kernel
The most likely problem is that you didn't set the "root=" parameter in /etc/lilo.conf properly. For example, on my system, I have root=/dev/hdc5, which is sets the root partition: "/". The Kernel looks for the init command is located in /sbin/init and the /sbin directory resides on /. Thus, when the / is not set correctly, the Kernel cannot initiate the init process, and as a result we get a "Kernel panic".
Strange I/O Problems
If you get weird performance from it a newly compiled kernel, such as system crashes often, strange I/O errors, or an overall degraded performance from the Custom kernel, then chance are that you did not do "make dep clean" after changing and saving Kernel configuration options in "menuconfig" or "xconfig". Everytime you build a new Custom Kernel, always make sure that you do "make dep clean".Extremely Slow Kernel
You have a fast processor and an adequate amount of RAM, but it takes forever to compile the Kernel. In such case the chances are that you selected too many options in "menuconfig" or "xconfig", and it is taking forever to compile all the necessary files. If the computer system is using up too much memory the best way out is to remove all the unnecessary options that you earlier selected. Also, if while compiling the Kernel your disk is making a lot of noise, then make sure you reconfigure your Kernel configuration options once again.Kernel will not Compile
If, after you type in "make bzImage modules" and press enter, the Kernel simply doesn't compile then something is "seriously" wrong with the computer system. The best way out would be to reboot the system, and issue a "rpm -e" command and remove all the Kernel configuration tools. Then, reinstall them, using an "rpm -I". Or, simply use "rpm -Uvh". If it works, well, then fine enough. Otherwise, you need to check the Hardware configurations of the system.System will not Boot
Chances are that you created an entry in /etc/lilo.conf, but forgot to run the "The LILO Map Installer" i.e. /sbin/lilo. Always make sure you run /sbin/lilo with the options "-v -v" for initiating the LILO Map installer. Otherwise, your system may not boot at all if your Custom Kernel is the only Kernel running on your system.Conclusion
These five above-mentioned problems are the most common ones that one faces while compiling, configuring and installing a Custom Linux Kernel. Though a varied number of other problems may arise, but most of them are due to incorrect selections in "menuconfig" or "xconfig" required for Kernel compilation. That's all. In case this doesn't work out or you guys (and gals) face some other specific problems, make sure you do 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.About the Author: My name is Subhasish Ghosh, I'm 20 years old, and currently living in India. I am a computer-systems engineering student and a Computer Professional as well. I currently hold 6 Microsoft Certified Professional (MCP) Certifications, and also a Microsoft Certified Professional Certified on NT 4.0 Track. I have been working with Linux for a long time, especially Red Hat Linux. I am currently preparing for the Red Hat Linux Certified Engineer (RHCE) certification Exam and plan to work primarily with the Linux operating system in the future.