apt-get install bzip2 libncurses5-dev kernel-package zlib1g-devgcc make kernel-package wget module-init-tools procps libncurses5-dev
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.9.tar.bz2
tar -xvjf linux-2.6.35.9.tar.bz2
cp /boot/config-`uname -r` /usr/src/linux-2.6.35.9/.config
Then we must configure the new kernel:
cd linux-2.6.35.9
make menuconfig
我們在內核配置裡面至少有兩個地方要修改。如下所示:
File systems -> Btrfs filesystem (EXPERIMENTAL) Unstable disk format
在"Btrfs filesystem"之前標上<*>
Processor type and features -> Processor Family -> "our processor"
刪除Dell laptop support、Toshiba Laptop support。
裁減sound card support。
裁減Bluetooth subsystem support。
裁減Wireless。
裁減Kernel hacking 。
多次點擊“ESC”退出,保存
在include/linux/version.h 中添加宏定義:
#define UTS_RELEASE 2.6.35.9
make-kpkg linux-image linux-headers --initrd
編譯成功後執行cd ..
dpkg -i linux-image-2.6.29_2.6.35.9-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.29_2.6.35.9-10.00.Custom_i386.deb
重啟,用uname-a 查看內核版本
錯誤處理
編譯完成後生成linux deb 包,先dpkg -i裝image,再裝headers
安裝完成以後再update-grub 進入/boot/grub/menu.lst 中選擇啟動的內核項 默認的第一項為0
ps:在編譯完成內核後開機可能出現 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)的錯誤 在/boot/grub/menu.lst中可以發現新加的內核可能是沒有 initrd /initrd.img-2.6.37.6 未生成的原因不明 可以手動生成
執行命令
mkinitramfs -o /boot/initrd.img-2.6.34.10 2.6.34.10(/boot/initrd.img-2.6.34.10是這個啟動加載文件的生成路徑 2.6.34.10是 /lib/modules/2.6.34.10)然後update-grub 再啟動新內核就沒有問題了
卸載一個已經安裝的內核包
debian卸載舊內核要先看看有哪些舊的內核,用命令:
dpkg --get-selections |grep linux
如果你的內核是以kernel開頭的就把上面的linux改成kernel,之後再用
dpkg --purge --force-remove-essential linux-image-XXX