Compiling the Linux kernel
Compilation of Linux Kernel on Ubuntu
Warning: be sure you have at least 15 GB of free disk space.
Compilation in Ubuntu >=13.04
Option A) Use Git
Use git if you want to stay in sync with the latest Ubuntu kernel source. Detailed instructions can be found in the Kernel Git Guide. The git repository does not include necessary control files, so you must build them by:
fakeroot debian/rules clean
Option B) Download the source archive
Download the source archive - This is for users who want to rebuild the standard Ubuntu packages with additional patches. Use a follow command to install the build dependencies and extract the source (to the current directory):
-
Install the following packages:
sudo apt-get build-dep linux-image-`uname -r`
Option C) Download the source package and build
This is for users who want to modify, or play around with, the Ubuntu-patched kernel source.
-
Retrieve the latest kernel source from kernel.org.
-
Extract the archive to a directory and
cd
into it:tar xf linux-*.tar.xz cd linux-*
-
Build the ncurses configuration interface:
make menuconfig
-
To accept the default configuration, press → to highlight
< Exit >
and then Return. -
Press Return again to save the configuration.
-
Use
make
to build the kernel:make
Note that you can use the
-jn
flag to compile files in parallel and take advantage of multiple cores.
The compressed kernel image can be found at arch/[arch]/boot/bzImage
, where [arch]
is equal to uname -a
.