Thursday, January 13, 2011

Compile Linux Kernel in Ubuntu with KernelCheck (and Nvidia drivers)

I've always recompiled Linux kernel on all my Linux installations, starting from the kernel sources of the Ubuntu repositories. Then I've heard about the famous 200 lines kernel patch, that I wanted to try, but it doesn't seem to apply to ubuntu linux sources (or at least I had this impression), and I didn't want to try the alternatives.

Then I stumbled upon this nice article about using KernelCheck (which I didn't know) to compile the linux kernel (not from the ubuntu repositories):

a graphical user interface program designed to make the kernel-compiling process as easy as the click of a button. KernelCheck will fetch the latest information from, which hosts the source packages for the Linux kernel, and ask the user which one they would like to compile into a .deb package (with the option of installing the kernel after the compilation).
The article also applies the 200 lines patch, so I decided to give it a try! The articles shows a video, but I'd like to blog about my experience with some screenshots.

Most important, I decided to blog about my experience because of the Nvidia drivers I have on some of my Linux computers, since the first experience with KernelCheck and nvidia drivers was really bad. I think I found a solution to deal with these drivers, so that I can compile the kernel, the patch, and have nvidia drivers work without a problem :)

After you installed kernelcheck, and run it you'll have some screens, and first of all you must retrieve available kernel information:

Then I select the custom compilation

Now, you can select some options.

At this point, it is crucial
  • NOT to select the reconfiguration of X server
  • NOT to install the nvidia driver
  • to select "apply custom patch to the kernel" (if you want to try the 200 lines patch)
  • I prefer not to install the kernel package after compilation: I'll do that myself

After the download of the needed packages is finished, you'll get a terminal window where you can apply manually the patch (that you can download it from here), and apply it, as it is shown in the screenshot (then you need to close the terminal window)

Then, you'll get the chance to configure the kernel before compilation. Make sure you have all the options you need set (it looks like kernelcheck starts from the current configuration, so, for instance, the processor family is already set as your current configuration).

To enjoy the 200 lines kernel patch, you must enable "Automatic process group scheduling" under "General setup", as shown in the following screenshot:

Then, the compilation starts, and, you know, it might take some time (though for my computer, and configuration it takes less than 1 hour)

Then, you'll be suggested to reconfigure the X server... DON'T DO THIS, and answer no

Then, the kernel deb packages (-image and -headers) will be ready in /usr/src, and you can manually install them.

Note that, during the installation, the Ubuntu kernel utilities will smartly compile and configure the current nvidia modules for you!

Now, reboot and enjoy :)

P.S. I cannot swear my computer is faster now with the 200 lines kernel patch... but I have the impression it is :)


Z06Gal said...

Excellent tutorial! I just have one question = what does "number of jobs to send to the cpu" mean? Thanks!

betto said...

I don't know for sure, so please try to take a look at the documentation for that option