Of Late, I have been very interested in compiling and installing my own Kernel. I tried once or twice earlier on virtual machines, which didnt boot after installation. So, I was not sure how it would work this time. This time, I compiled the 3.12 kernel on my openSUSE 12.3 system. Though not a big risk (I could always boot into the earlier 3.11 kernel), it was still a frightening task for me, who is just learning to find his feet around the kernel.
Installing a kernel from source is not a particularly hard task. The hardest part is configuring it to tweak it to your needs. The fact that there are thousands of options to configure is intimidating in itself. Fortunately, there are a variety of options you could use, to get your system up and running in no time. The purpose of this post is to put the simplest and shortest steps which you could use to configure and install the kernel on openSUSE.
1.) Get the latest kernel source from https://www.kernel.org/
2.) Install the dependencies required to compile and instal the kernel. The easiest way to do this on openSUSE is to install the ‘Linux Kernel Development’ pattern on openSUSE.
3.) Create a configuration file. This is the task that is going to take up most of the time in installing the kernel. The kernel configuration is in the .config file of the kernel source tree.
To create and edit the options, either of the following commands can be used:
-> make menuconfig (console based)
-> make gconfig (GTK+ needed)
-> make xconfig (needs Qt installed)
A default configuration file can also be used, which contains most of options enabled. This is probably the configuration used by Linus to build the kernel.
The easiest way to set the configuration file, is to copy the configuration file for the currently running kernel (it is in /proc/config.gz), and use it for the custom kernel. This was the approach I used.
4.) If you want to make additional changes to the config file, you can fire up the above tools, and make those changes before proceeding.
5.) Run the ‘make’ command to compile the kernel. Now grab a cup of coffee, as it takes quite a while.
6.) In all probability, you will get no compile errors. After the compilation is done, run ‘make modules_install’, to install all the modules built during compilation
7.) To install the kernel, run ‘make install’
8.) Reboot to run the new kernel
This isnt the best way to compile the kernel (using the distribution config file will have most drivers and options enabled, which may not be desired). I am still exploring most of the options, as I learn more and more about the kernel. I am already enjoying working around the kernel, and I hope to learn a lot more in the coming days.