sudo apt-get build-dep linux-image-$(uname -r)2. Install required packages
sudo apt-get install libncurses5-dev kernel-package fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libelf-dev asciidoc binutils-dev
3. Create a source directory and get kernel source
mkdir ~/ubuntu-kernel-src4. Config your kernel
cd ~/ubuntu-kernel-src
apt-get source linux-image-$(uname -r)
Now, I have a directory "~/ubuntu-kernel-src/linux-lts-quantal-3.5.0" You can do "make menuconfig"/"make oldconfig" in this directory if you want.5. Paralleling the building tasks
You have several options here. You can either
a) export CONCURRENCY_LEVEL=n
b) DEB_BUILD_OPTIONS=parallel=n
c) make -jn
where n is generally the number of processors the building machine has.You can do a) now or use b) or c) later as building options. We will demonstrate b) and c) in the next step
6. Build the kernel
Suppose the machine has 16 cores. You can do
fakeroot debian/rules clean
fakeroot debian/rules DEB_BUILD_OPTIONS=parallel=16 binary-headers binary-generic
Or
make-kpkg clean
fakeroot make-kpkg -j16 --initrd --append-to-version=-test00 kernel-image kernel-headers
If you need vmlinux for profiling or debugging. You may use skipdbg=false or install_vmlinux=true.
For example,
fakeroot make -f debian/rules binary-generic skipdbg=false7. Install and test your new kernel
The deb files is saved in parent folder, which is "~/ubuntu-kernel-src" in this case. So,
sudo dpkg -i ../linux-*-test00*.debif you built vmlinux, you can
sudo dpkg -i ../linux-image-debug-*.ddebNow, reboot the system and type "uname -r" to verify it is the kernel you built.
References:
http://linuxtweaking.blogspot.com/2012/08/ubuntu-1204-lts-kernel-compile-guide.html
https://help.ubuntu.com/community/Kernel/Compile
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
http://www.howtoforge.com/kernel_compilation_ubuntu
http://www.howtogeek.com/howto/ubuntu/how-to-customize-your-ubuntu-kernel/
Ending picture today:
The Space Shuttle Enterprise at Smithsonian's National Air and Space Museum's Steven F. Udvar-Hazy Center. (Discovery replaced Enterprise to display at this museum since April 2012. Enterprise is at the Intrepid Sea, Air & Space Museum now.) [courtesy of my dear wife - Claire Huang]
No comments:
Post a Comment