Compile Custom Linux Kernel in Mint/Ubuntu/LMDE
by romanyacik in Circuits > Linux
48848 Views, 22 Favorites, 0 Comments
Compile Custom Linux Kernel in Mint/Ubuntu/LMDE
If you didn't build linux from scratch, chances are that your GNU/Linux distro is using a long-term support distribution kernel, that as the name suggests, is specific to your distro. Distribution kernels lag behind the current version significantly. i.e., at the time this was written, Linux Mint and Ubuntu use distro versions of linux 3.16, and the current stable kernel is linux 4.0.5. Compiling a custom kernel is a neat little thing you can do to your computer, but still isn't too hard to do. You just need to be able to tell your Assembler from a hole in the ground.
Also works for Linux Mint Debian Edition, but I don't know about Debian itself. may be worth a try though :)
Install Essential Packages
before you can begin, there are a few libraries and programs you have to install. They are build-essential, ncurses-base, ncurses-dev, kernel-package, and fakeroot. You may use either Software Center(Ubuntu), Software Manager(Mint), apt-get (in terminal), or Synaptic(Mint).
Mint users may omit fakeroot, because it comes installed by default.
LMDE (Linux Mint Debian Edition) users may also omit build-essential and ncurses-base, as these are also installed by default
nota bene: if you are using LMDE, there is no ncurses-dev. use libncurses5-dev instead.
Yuck! Tarballs! (it's Really Not As Gross and Sticky As I Just Made It Sound)
go to https://www.kernel.org/ and download the tarball (tar.xz) of your choice, preferably the latest stable release. kernel.org also has pgp signatures, but I don't know how to use them. If you do know, you may use it, and please post your own instructable, because I'm a little curious about how pgp signatures work..
Unzipping Kernel Source Using the Terminal
open a terminal and run this command:
$ cd ~/Downloads
command line should look like this:
username@hostname ~/Downloads $
unzip sourcecode like this:
$ tar xf linux-x.xx.x.tar.xz
NOTE: do not use x's, I am using these as placeholders for version number. when I did this it was linux-4.0.5.tar.xz
now enter
$ cd linux-x.xx.x
this will allow you to edit the folder containing the kernel's source, as you will do in the next step
Help! My Config Is Stuck in the Kernel Tree!
open the file system and look for a file that looks like this: "config-y.yy.y-generic" in the tree /boot
y.yy.y is the version number of the kernel you are now running. "generic" may also be amd64 or whatever the processor's architecture is.
now run this in the terminal:
$ cp /boot/config-y.yy.y-generic .config
$ make oldconfig
following the make oldconfig command, you will be asked a series of "y/N" questions. ignore them and just press the "enter" key until you see username@hostname ~/Downloads/linux-x.xx.x $
Compile (this Will Take a While)
This step is totally automated, but takes about 2 hours to complete. If you have a short attention span, you are advised to find something else to do while the computer does its thing, like reading a book, knitting something, cooking one of my recipes, or jogging, but if you must gauk at your monitor, it's fun to read the names of the files being extracted and guess their function. Also, if you're afraid that something might go wrong, it may be a good idea to make sure everything is OK.
enter this command in the terminal:
Congratulations!
with the new kernel installed, you should be able to reboot without complaint. You will be able to run with the new kernel and enjoy faster processing, and a better frame rate for videos and games. you may also want to install ulatency and ulatencyd in order to further increase processing speed.
Enjoy and thanks for reading! Sorry about all the bad jokes. If anyone's familiar with Bewitched, i can be just as bad as Sam's uncle Arthur sometimes.