Compile Linux Kernel (Debian)

 

安裝基本的編釋環境:

apt-get install fakeroot build-essential devscripts

 

額外要的包:

zlib1g-dev
# error: zlib.h: No such file or directory

 

 

下載 Kernel 的 Source:

apt-get install linux-source-2.6

獲得

/usr/src/linux-source-2.6.32.tar.bz2

 

解壓:

cd /usr/src

tar -jxf linux-source-2.6.32.tar.bz2

 

套用 Debain 設定:

cp /boot/config-2.6.32-5-686 ./config

 

落 Patch (由於是 Debian 包, 所以不用落 patches)

http://kernel.org/

bzcat /usr/src/patch-2.6.32.59.bz2 | patch -p1 --dry-run

 

設定要 Complie 什麼:

apt-get install libncursesw5-dev libncurses5-dev

make menuconfig 

 

Complie:

make-kpkg clean

make-kpkg --append-to-version "-lxc" --revision 1 --initrd kernel_image

  • --revision:         debian revision number
  • --initrd:             Create a image package suitable for initrd
  • --targets           Lists the known targets

 

Remark:

make-kpkg [options] target [target ...]

 

make-kpkg --help

 

最後獲後:

linux-image-2.6.32-cgroup-memcap_1_i386.deb

 


 

安裝:

dpkg -i linux-image-2.6.32-cgroup-memcap_1_i386.deb

mkinitramfs -o /boot/initrd.img-2.6.32-cgroup-memcap 2.6.32-cgroup-memcap

update-grub2