Install a Custom or Mainline Kernel on Ubuntu
This is a quick guide to build and install the latest mainline kernel, or simply a customized one, on Ubuntu from source. This is something I tend to frequently do when official Ubuntu kernels are lagging behind support I need or I just flat out need to do something custom. I'm currently using Ubuntu 14.04 LTS for this example.
First, install dependent packages.
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev sudo apt-get install kernel-package
Clone the kernel using git from your favorite location.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cd linux
There is a bug on Ubuntu 14.04 that will prevent it from finishing the build due to a patch. The simple option is to revert it and resolve conflicts as usual. See this bug for more information.
git revert f4d4ffc03efc864645b990e1d579bbe1b8e358a4 # resolve conflicts (don't really care about the ARM makefiles in this case) git commit
Now, copy the existing config, modify as necessary, and sit back for a long time while it builds. Distribution kernel configs typically include everything under the sun.
cp /boot/config-$(uname -r) .config make menuconfig make-kpkg clean fakeroot make-kpkg -j 10 --initrd --revision=1.0.MEDIA kernel_image kernel_headers
When all is said and done, you'll end up with the deb files to install. Reboot and you're good to go.
cd .. sudo dpkg -i linux-headers-4.3.0-rc1+_1.0.MEDIA_amd64.deb sudo dpkg -i linux-image-4.3.0-rc1+_1.0.MEDIA_amd64.deb sudo reboot
You can verify your new kernel is running with:
uname -a Linux test1 4.3.0-rc1+ #1 SMP Wed Sep 16 01:14:31 MST 2015 x86_64 x86_64 x86_64 GNU/Linux