Tuesday, May 31, 2011

Recompiling your Kernel to 3.0.0-RC1 (or any later version) in Linux Mint 11

***THERE IS AN EASIER WAY TO INSTALL KERNEL 3.0.0 IN LINUX MINT 11 RIGHT NOW***

As part of Linux's 20th birthday, Linus Torvalds has put out the release candidate version 3.0.0 of his kernel.  His changelog can be found here and I congratulate anyone that finishes it, because I did not.  Now, from what I did manage to read it includes many fixes including improved video support and support for the Microsoft Kinect.  If you're interested in installing it in Linux Mint 11, like I was it will probably take a few hours or more (mostly automated) depending on if you have many errors and the level of customization that you choose to do to your system.  When you're done with installing the kernel, it will still leave the old kernel in your boot list in the event that you do not like the kernel or it is unable to boot.  Still with me?  Good!  Open up terminal and follow along:

Part 1 - Get the Kernel
You can check for a new version of the kernel at www.kernel.org.  If there is a newer version than 3.0-rc1 that has the [Full Source] available, this method *should* still work.  If there is a new version, all directions below will have to be adjusted for the new file name and directories created because of it.  Here is how you can get it for the one we're installing now:



cd /tmp

wget http://www.kernel.org/pub/linux/kernel/v3.0/testing/linux-3.0-rc1.tar.bz2


Part 2 - Extract the Kernel



sudo tar -xjvf linux-3.0-rc1.tar.bz2 -C /usr/src

cd /usr/src/linux-3.0-rc1


Part 3 - Install Files Necessary to Compile Kernel
I *think* these are the correct files, I'll have to come back and do a revision if I got them wrong because my Dropbox text that I was typing up messed up and reverted to the wrong version that left out this part and I had to check my terminal history for what was installed during this step.


sudo apt-get install gtk+2.0-dev  libglade2-dev libglib2.0-dev


Part 4 - Configure the Kernel
This is going to be the part where I can't really help you, you'll have to know about your system if you plan to change anything about your system.  You'll have a long list of options that you can turn off [N], have loaded automatically into the kernel [Y], or loaded as modules [M] (which you have to load for your system to be able to use every time).  The options are not that scary, but you may not understand a lot of them.  If you are not sure then just leave them alone and move past that option or google them and see if they are related to your system.  There is plenty of documentation of each option that I can't cover completely.


sudo make gconfig




Part 5a - Compile the Kernel
This part is going to take a long time to do, probably a couple of hours if you have a relatively quick system.  It's going to be completely automated so once you've started you can go do something else.  I chose to turn my screensaver off so I could periodically glance over and see if it was done from far away.  If you're lucky, you won't get any errors.  If you don't get any errors, go to part 6.  If you do get errors, go to Part 5b.


sudo make


My error message was "error: WARNING: modpost: Found 4 section mismatch(es)."  Yours may have a different amount of sections listed though.  If you get this message just go to Part 5b.

Part 5b - Compiling the Kernel with Errors
Again, this is going to take a couple of hours, but once it finished I didn't have any errors.  I am also not sure how it changes the settings or if you could just start by running it from here.  Regardless I had to run it this way to be able to compile my Kernel.


sudo make CONFIG_DEBUG_SECTION_MISMATCH=y


You shouldn't have any errors now and it should allow us to install the kernel modules.

Part 6 - Installing the Kernel Modules
This part shouldn't take anywhere near as long as compiling the kernel did, but will still probably take a few minutes, possibly upwards of 10.


sudo make modules_install


Part 7 - Installing the Kernel
Again, this part will be quicker.  Expect it to take no longer than a couple of minutes.


sudo make install


Part 8 - Making an initrd Image of the New Kernel
For our system to be able to boot into the new kernel, we need to make an image of the kernel that we just made for our system to use.


cd /boot

sudo mkinitramfs -o initrd.img-3.0.0-rc1 3.0.0-rc1


Part 9 - Update GRUB with the New Kernel Image
We need to tell GRUB that we just finished making the new kernel and that it is in the directory and to add it to the boot screen.



sudo update-grub


Part 10 - Reboot and Bugs
To get into the new kernel all you have to do is reboot and select it from the screen.  If it takes a while to load and you see the Linux Mint GRUB screen or a black screen for a while, just be patient it means that a service is failing to load properly.  For me it was nouveau and after a short time (30 seconds or so), the operating system booted up.

No comments:

Post a Comment