I've personally tested it on:
Linux Mint 14, Cinnamon
Linux Mint Debian Edition, Cinnamon
I made a video of it, so you can see what a proper build should look like. http://www.youtube.com/watch?v=_uWjGagIQcs
The first thing we need to do is install what is needed to compile the kernel. These are the essentials:
Code: Select all
sudo apt-get install build-essential kernel-package libncurses5-dev fakeroot wget bzip2The next line you can omit if you are comfortable with using the terminal for all your kernel options. Otherwise, if you want a GUI with point and click for your options, install the QT4 base.
Code: Select all
sudo apt-get install qt4-designer qt4-dev-tools qt4-doc qt4-linguist-tools qt4-qmakeNow we need to set up our environment variables... So, in a terminal:
Code: Select all
export CONCURRENCY_LEVEL=2
export CHOST="x86_64-pc-Linux-gnu"
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="$CFLAGS" If you're running a 32bit pc, use the "x86-pc-Linux-gnu" option instead. Then we need to make a directory to contain all our building:
Code: Select all
mkdir kernel-build
cd kernel-build Now we need a kernel to build. You have a few options with the kernels, but I like to get mine from kernel.org. You can pick the Mainline, Stable, or Linux-next. The differences are:
Mainline
- The most recent kernel, released by Torvalds, with latest features, not necessarily stable
- The latest stable kernel, with updates that are only bug fixes, no new features
- Not actually a version number. Hundreds of devs add to this tree daily, and there is no record of previous days kernels of this tree. It can change drastically over 24 hours, and is not recommended for production or home use
While I am personally using the 3.9 RC7 right now, I will recommend that a user compile the stable tree, so I will use that for the tutorial.
Code: Select all
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.7.tar.xz
tar -Jxf linux-3.8.7.tar.xz
cd linux-3.8.7Next we want to copy our old kernel configs to the new kernel, reducing the work we need to do for selecting options for the kernel. You can answer these to the best of your ability or you can simply press enter (return) to use the default options.
Code: Select all
cp /boot/config-`uname -r` ./.config
make oldconfigIf you chose to do the QT4 install, then use make xconfig, if not use make menuconfig.
Code: Select all
make xconfigOR
Code: Select all
make menuconfigFinally, we will compile the kernel and install it like any other .deb file for Mint/Ubuntu. For custom name on this kernel, I would put -mint-14-x86-64-15-04-13, so the following code would look like this:
Code: Select all
fakeroot make-kpkg --initrd --append-to-version=-customname kernel_image kernel_headersThe --append-to-version option lets you identify the kernel as your own unique kernel. Now all you do is wait a couple hours for it to compile your kernel. It will automatically be turned into a .deb for easy installation. Then simply install it with:
Code: Select all
cd ..
sudo dpkg -i linux-image-*.deb linux-headers-*.deb
sudo update-grubWhere -* is the rest of the kernel name. (You could type "sudo dpkg -i linux-image" and then press [TAB] for the terminal to finish the name for you.
Now you have your own custom kernel, congratulations. Feel free to remove the folder holding all the source code, as it's likely over 10Gb now. Keep the .debs if you have the space (they're about 55Mb combined), and have fun.
For nvidia driver users who blacklisted nouveau, you have one more step, due to a recently introduced change with nvidia drivers. Reboot into the new kernel via recovery mode. As root, run:
Code: Select all
update-initramfs -k 'uname -r'Now run your nvidia driver .run that you have. Afterwards use:
Code: Select all
shutdown -r nowAnd reboot into your new kernel normally. Congratulations, you're finished!
---------
EDIT:
Lethe wrote:What you can also do is starting with a generic kernel (i.e. the standard Mint/Debian kernel) is to plug in all your devices (USB stick, USB printer etc.) so that the modules get loaded, then run in your unpacked 'linux kernel' directory:Code: Select all
make localmodconfig
What this will do it automatically tune your config to only use the modules required on your system, and turn all the other off. A lot quicker than trying to do it manually.
Nick
-- For a leaner kernel






