2012年10月17日 星期三

[Compile Kernel Code] How to compile kernel source code

Compile kernel need some tool :

sudo apt-get build-dep gcc

sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2




Go to /bin to check sh soft link to bash :

cd /bin/

ln -sf /bin/bash sh  (check sh soft line to bash)




Grab kernel source code :

Go to Kernel.org to grab kernel version 2.6.39.3



untar source code :

copy kernel source code to /usr/src/

Create a "linux" soft link to "linux-2.6.39.3"

cd /usr/src/linux
Copy old .config :
cp /boot/config-`uname -r` ./.config
make menuconfig

Load an Alternate Configuration File
--> load .config

Load the .config file which copy before.
When exit the menu, then save it.

Start to compile the kernel:
Clean first
make-kpkg clean


Compiler code and measure the total time

date >> Time.txt && fakeroot make-kpkg --initrd kernel_image kernel_headers && date >> Time.txt

Update update-initramfs
Example, sudo update-initramfs -c -k 3.15.4
update-initramfs: Generating /boot/initrd.img-3.15.4


Update grub.cfg
sudo update-grub

Restart Computer

Reference :

Related Posts:

0 意見:

張貼留言