Tuesday, December 21, 2010

Rebuilding My Fedora 13 Kernel

When I would use Slackware I did Kernel rebuilds every six months. But the first time I tried to do one in Fedora 5 it did not go well. After spending 5 hours I decided to stick with the standard FC kernels. All of that changed about two weeks ago.

My laptop would keep crashing and the network modules would fail for some reason. It was doing this daily and I got so tire of it that I decided that I would have to do the following things:
  1. Remove unneeded modules and options from the kernel.
  2. If it still gave me problems first look in the logs for messages
  3. Run strace & ktrace on the applications that I was using during the panic.
  4. If its still giving me problems rebuild the kernel again but this time with logging.
To rebuild the kernel I mainly just followed the steps in Timme's Howtoforge article.

The Rebuild Process

First find out exactly what hardware I have by running the commands either one of these commands lspci, or lshw. I did not need to run lsusb to see the usb devices since either of the two latter commands will give you that. Then After I followed steps 2 - 2.5 of Howtoforge's fedora compilation guide. But during step 2.5 I would do the following;

As I was selecting options for each kernel subsystem the output of lswh -class & lswh -businfo the output of lshw guided me in choosing what to include or not in my kernel. This customization took sometime, it also involved me looking up what certain kernel features did to see if enabling them would be of benefit to me. It took sometime to verify specific hardware variants but after spending most of the night on that I was done with the kernel config.

After I followed steps 2.6 - 2.7 I was able to reboot the laptop with the custom kernel on the first try. The fact that my compile and build went so smoothly tells you that Falko Timme wrote a good article on the kernel build process and I am not going to duplicate his instructions here.

Recompile's Impact

After I did that the have been no kernel panics and power management is working again. Before the kernel recompile if the laptop got disconnected for more than 5 seconds it would shut down. Even though it was supposed to go into hibernate mode it would not instead processes would die an ugly groody death, the disk would need to be fscked and I would get irritated about the cable being jostled.

Now the battery's power levels are detected again so I can run it for half an hour on the battery. There are no kernel panics and the apps are running better. Unlike the times when I used to rebuild my kernel for Slackware I did not have to go through separate steps to make sure that the sound & wifi cards were working. I'm guessing that at least for the wifi card since its built in and not using the PCMCIA slot it makes it easier for Linux- kernel to handle it.

Possible Project

Since it took me so long to get done with make menuconfig I think I will try and automate that step by generating a list of a machine's hardware then using that list of hardware components and desired services to turn on options in the kernel .config file.

That might cut down on the time I have to review the hardware. Then to take it to the next level actually have the kernel be built and installed on VM to see if it boots the machine. And if the build fails I can review why. But since the system is a lot more stable right now I will not be doing anymore troubleshooting of crashes since there have not been any mission critical failures in the past two weeks.

No comments: