2008年3月12日 星期三

Debian/Ubuntu Kernel Compile Howto (Kernel 2.6) - 081209

debian/ubuntu 的 update-alternatives 指令

  1. install gcc-2.95, gcc-3.4
  2. update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.3 52
  3. update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-2.95 53
  4. update-alternatives --config gcc


Debian-Kernel-Compile-Howto (Kernel 2.6)
  1. apt-get build-dep linux-headers-`uname -r`;
  2. apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools procps initrd-tools
    Use "initramfs-tools" instead of "initrd-tools" on Squeeze(6.0).
  3. download, uncompress, and config linux kernel source somewhere, e.g. /usr/src
  4. make-kpkg clean
  5. fakeroot make-kpkg --revision=custom.1.0 linux-image
    fakeroot make-kpkg --revision=custom.1.0 linux-image -j4
    CONCURRENCY_LEVEL=4 fakeroot make-kpkg --revision=custom.1.0 linux-image
    開始build kernel,通常會很久,因為有很多module要build。build完後在上一層(linux-src/../)下會產出一個linux-image-2.6.8.1_custom.1.0_i386.deb
  6. dpkg -i linux-image-2.6.8.1_custom.1.0_i386.deb
  7. Make initrd by
    cd /boot/;mkinitrd -o /boot/initrd.img-2.6.8.1 2.6.8.1;
    Use "mkinitramfs" instead of "mkinitrd" on Squeeze(6.0)
    cd /boot/;mkinitramfs -o /boot/initrd.img-3.2.0+ 3.2.0+;

  8. Grub, Edit /boot/grub/menu.lst, add the following line to the new item
    initrd /boot/initrd.img-2.6.8.1
    LILO
    initrd=/boot/initrd.img-2.6.8.1

    Or simply "update-grub"

http://www.howtoforge.com/kernel_compilation_ubuntu
http://www.howtoforge.com/kernel_compilation_ubuntu_p2
  1. apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
  2. download, uncompress, and config linux kernel source in /usr/src
  3. make-kpkg clean
  4. fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
    CONCURRENCY_LEVEL=4 fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
  5. dpkg -i linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
    dpkg -i linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
  6. vi /boot/grub/menu.lst
    title           Ubuntu, kernel 2.6.18.1-custom
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro quiet splash
    initrd /boot/initrd.img-2.6.18.1-custom
    savedefault
    boot

    title Ubuntu, kernel 2.6.18.1-custom (recovery mode)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro single
    initrd /boot/initrd.img-2.6.18.1-custom
    boot


080815
Debian 2.6.24的linux-image不能開機
連linux-source-2.6.24按照上述程序也不能開機,似乎找不到initrd
2.6.18的就ok

ERROR: Documentation/lguest: No such file or directory
20120315 - linux-3.2.0 w/ Squeeze (6.0)
#638012 - error compiling(make: *** Documentation/lguest: No such file or directory. Stop) - Debian Bug report logs
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638012

As a workaround simply linking the virtual/lguest/ directory from the Documentation folder of the source tree will solve the problem.
cd ./Documentation
ln -s virtual/lguest/

沒有留言: