I'm interested in compiling a new kernel under Ubuntu 12.04 x86 64 bit.
I found this wiki page which is basically a mirror for this blog and there are a lot of steps (git, etc.) that appear useless to me.
With earlier releases/distros, I used to create a .config
file and modify a Makefile
if I needed to, then just run make
and it's done.
Is there is a simple way to do this under Ubuntu?
1. Use apt-get source
to download the Ubuntu version of the kernel
apt-get source linux-image-$(uname -r)
gives a folder that contains, for example:
linux-3.2.0 linux_3.2.0-26.41.dsc
linux_3.2.0-26.41.diff.gz linux_3.2.0.orig.tar.gz
The bolded diff includes all the Ubuntu/Debian customizations.
2. To build a stock kernel with your own .config
, use the "old-fashioned" Debian make-kpkg
method
This is the alternate old-fashioned way described in the wiki:
sudo apt-get install kernel-package
If you are compiling a kernel for the first time:
sudo apt-get build-dep linux-image-$(uname -r)
Then cd
into the source directory (here, linux-3.2.0
), and either run make oldconfig
to create .config
file with your running kernel's configuration, or copy a third-part .config
to this directory.
Depending on whether you want a text or graphical config, install:
(Text)
sudo apt-get install libncurses5 libncurses5-dev
(Graphical)
sudo apt-get install qt3-dev-tools libqt3-mt-dev
And then run:
(Text)
make menuconfig
(Graphical)
make xconfig
When done, just run:
fakeroot make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers
where N
is how many jobs to run in parallel (usually the number of CPUs you have), and my-very-own-kernel
is a custom string to identify this build.
When done, the kernel image and header files will be ready as debs in the parent directory; you can install them with sudo dpkg -i
, which will also take care of adding GRUB entries, etc.
No comments:
Post a Comment