Recompile Linux Kernel in Debian

應該還不是「正確」的方法 (因為 apt-cache search linux-source 時還看到 linux-patch-debian-2.6.18 與 linux-tree-2.6.18 這兩個套件),不過先記下來好了:

$ apt-get install linux-source-2.6.18
$ apt-get install kernel-patch-grsecurity2 (這是 patch)
$ cd /usr/src
$ tar yxf linux-source-2.6.18.tar.bz2
$ cd linux-source-2.6.18
$ zcat ../kernel-patches/diffs/grsecurity2/grsecurity-2.1.9-2.6.18.1.patch.gz | sudo patch -p1
$ sudo make menuconfig
$ sudo make all (其中 all = vmlinux modules bzImage,參考 make help 的說明)
$ sudo make install
$ sudo modules_install
$ cd /boot
$ sudo mkinitrd -o initrd.img-2.6.18-grsec 2.6.18-grsec
$ sudo update-grub
$ cd grub
$ vim menu.lst (把 initrd 的部分補上去)

Update:yjchou 說 linux-source-2.6.18 這是已經經過 Debian 處理過的版本了,在網頁說明上也有提到:

This package provides source code for the Linux kernel version 2.6.18. This source closely tracks official Linux kernel releases. Debian's modifications to that source consist of security fixes, bug fixes, and features that have already been (or we believe will be) accepted by the upstream maintainers.

我沒有炸掉純粹是運氣好選對了 @_@

This entry was posted in Computer, Linux, Murmuring, OS, Software. Bookmark the permalink.

One Response to Recompile Linux Kernel in Debian

  1. yungyuc says:

    source 直接用 linux-source-* 解出來的東西,config 好之後,就可以用 kernel-package 來生 .deb:

    $ make-kpkg --rootcmd fakeroot --revision custom01 --initrd binary-arch

    如果需要上 patch (Debian 包好的 patch package),用 --added-patches 指定。

    生出來的 .deb 可以 dpkg -i *.deb 安裝。這樣裝好的 kernel 既漂亮又乾淨喔。

Leave a Reply

Your email address will not be published. Required fields are marked *