April 20, 2008
鼓勵此網誌:0
http://www.howtoforge.com/howto_linux_kernel_2.6_compile_debian
Fedora core 6在rebuild時一直出問題..改用debian就ok了..以下為我的rebuild 過程
1. apt-get install kernel-package ncurses-dev fakeroot wget bzip2
# 這跟FC6的yum很類似..可以自動解決相依性問題
=================================================
這些套件可以先安裝..之後要用來測試用的工具
apt-get install bridge-utils ethtool hping2 tcpdump ethereal bmon
=================================================
2. cd /usr/src
# 通常自己抓的套件都會放這..比較好整理
3. wget http://ftp.cs.pu.edu.tw/pub/kernel/linux/kernel/v2.6/linux-2.6.15.1.tar.bz2
# mpls 需要 2.6.15.1
4. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/mpls-linux-1.950.tar.bz2
5. tar jxf mpls-linux-1.950.tar.bz2
6. tar xjf linux-2.6.15.1.tar.bz2
7. cd linux-2.6.15.1/
8. patch -p1 < /usr/src/mpls-linux-1.950/patches/linux-kernel.diff
9. make menuconfig
=====先複製安裝成功的設定檔比較保險========
cp /boot/config-2.6.18-6-686 .
=====================================
# 先讀取穩定的設定檔
Load config -> config-2.6.18-6-686
In Networking Options the following items will be compiled in kernel [Networking Options Screenshot]:
< *> Multiprotocol Label Switching
< *> MPLS: Virtual tunnel interface
< *> 802.1d Ethernet Bridging
< *> Bridge: MPLS support
In Network Packet Filtering (replaces ipchains), IP: Netfilter configuration will be selected
In IP: Netfilter configuration menu the following minimum options will be selected [IP Netfilter Screenshot]:
< *> Packet Filtering
< *> Packet Mangling
< *> MPLS target support
< *> DSCP target support
In Network Packet Filering (replaces ipchains) select Bridge: Netfilter configuration
In Bridge: Netfilter configuration menu the following minimum options will be selected[Bridge Netfilter Screenshot]:
< *> Ethernet Bridge tables (ebtables) support
< *> ebt: broute table support
< *> ebt: filter table support
< *> ebt: nat table support
< *> ebt: 802.3 filter support
< *> ebt: MPLS target support
In Networking Options select QoS and fair queueing
From the submenu, select all options either compiled into the kernel or as modules [QoS Screenshot].
Compile and install the new kernel.
10. make-kpkg clean
11. fakeroot make-kpkg --revision=custom.1.0 kernel_image
# 制作image檔
12. cd ..
13. apt-get update
14. apt-get install module-init-tools initrd-tools procps
# 上面兩個指令的目的是為了rebuild kernel所需的套件
15. dpkg -i linux-image-2.6.15.1_custom.1.0_i386.deb
# 安裝所編譯的kernel, 並自動更新開機選單(ex. lilo或grub)
16. cd /boot/
17. mkinitrd -o /boot/initrd.img-2.6.15.1 2.6.15.1
# 制作新kernel的ramdisk
18. vi /boot/grub/menu.lst
# 加上initrd /boot/initrd.img-2.6.15.1這行
title Debian GNU/Linux, kernel 2.6.15.1
root (hd0,0)
kernel /boot/vmlinuz-2.6.15.1 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.15.1
savedefault
19. cd /usr/src
20. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/iptables-1.3.0-2_mpls_1.950d.i386.rpm
21. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/iproute-2.6.11-1_mpls_1.950d.i386.rpm
22. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/ebtables-2.0.6-7_mpls_1.950d.i386.rpm
# 以上三個套件都要下載
=======若沒有安裝alien套件請安裝=======
22.5 apt-get install alien
==========================
23. alien iproute-2.6.11-1_mpls_1.950d.i386.rpm
24. alien --scripts iptables-1.3.0-2_mpls_1.950d.i386.rpm
25. alien --scripts ebtables-2.0.6-7_mpls_1.950d.i386.rpm
26. dpkg -i iproute_2.6.11-2_i386.deb
27. cp /bin/true /sbin/chkconfig
28. dpkg -i iptables_1.3.0-3_i386.deb
29. dpkg -i ebtables_2.0.6-8_i386.deb
30. shutdown -r now
# 重新開機
31.dmesg |grep MPLS
# 若成功進入debian大功告成!!
Fedora core 6在rebuild時一直出問題..改用debian就ok了..以下為我的rebuild 過程
1. apt-get install kernel-package ncurses-dev fakeroot wget bzip2
# 這跟FC6的yum很類似..可以自動解決相依性問題
=================================================
這些套件可以先安裝..之後要用來測試用的工具
apt-get install bridge-utils ethtool hping2 tcpdump ethereal bmon
=================================================
2. cd /usr/src
# 通常自己抓的套件都會放這..比較好整理
3. wget http://ftp.cs.pu.edu.tw/pub/kernel/linux/kernel/v2.6/linux-2.6.15.1.tar.bz2
# mpls 需要 2.6.15.1
4. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/mpls-linux-1.950.tar.bz2
5. tar jxf mpls-linux-1.950.tar.bz2
6. tar xjf linux-2.6.15.1.tar.bz2
7. cd linux-2.6.15.1/
8. patch -p1 < /usr/src/mpls-linux-1.950/patches/linux-kernel.diff
9. make menuconfig
=====先複製安裝成功的設定檔比較保險========
cp /boot/config-2.6.18-6-686 .
=====================================
# 先讀取穩定的設定檔
Load config -> config-2.6.18-6-686
In Networking Options the following items will be compiled in kernel [Networking Options Screenshot]:
< *> Multiprotocol Label Switching
< *> MPLS: Virtual tunnel interface
< *> 802.1d Ethernet Bridging
< *> Bridge: MPLS support
In Network Packet Filtering (replaces ipchains), IP: Netfilter configuration will be selected
In IP: Netfilter configuration menu the following minimum options will be selected [IP Netfilter Screenshot]:
< *> Packet Filtering
< *> Packet Mangling
< *> MPLS target support
< *> DSCP target support
In Network Packet Filering (replaces ipchains) select Bridge: Netfilter configuration
In Bridge: Netfilter configuration menu the following minimum options will be selected[Bridge Netfilter Screenshot]:
< *> Ethernet Bridge tables (ebtables) support
< *> ebt: broute table support
< *> ebt: filter table support
< *> ebt: nat table support
< *> ebt: 802.3 filter support
< *> ebt: MPLS target support
In Networking Options select QoS and fair queueing
From the submenu, select all options either compiled into the kernel or as modules [QoS Screenshot].
Compile and install the new kernel.
10. make-kpkg clean
11. fakeroot make-kpkg --revision=custom.1.0 kernel_image
# 制作image檔
12. cd ..
13. apt-get update
14. apt-get install module-init-tools initrd-tools procps
# 上面兩個指令的目的是為了rebuild kernel所需的套件
15. dpkg -i linux-image-2.6.15.1_custom.1.0_i386.deb
# 安裝所編譯的kernel, 並自動更新開機選單(ex. lilo或grub)
16. cd /boot/
17. mkinitrd -o /boot/initrd.img-2.6.15.1 2.6.15.1
# 制作新kernel的ramdisk
18. vi /boot/grub/menu.lst
# 加上initrd /boot/initrd.img-2.6.15.1這行
title Debian GNU/Linux, kernel 2.6.15.1
root (hd0,0)
kernel /boot/vmlinuz-2.6.15.1 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.15.1
savedefault
19. cd /usr/src
20. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/iptables-1.3.0-2_mpls_1.950d.i386.rpm
21. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/iproute-2.6.11-1_mpls_1.950d.i386.rpm
22. wget http://switch.dl.sourceforge.net/sourceforge/mpls-linux/ebtables-2.0.6-7_mpls_1.950d.i386.rpm
# 以上三個套件都要下載
=======若沒有安裝alien套件請安裝=======
22.5 apt-get install alien
==========================
23. alien iproute-2.6.11-1_mpls_1.950d.i386.rpm
24. alien --scripts iptables-1.3.0-2_mpls_1.950d.i386.rpm
25. alien --scripts ebtables-2.0.6-7_mpls_1.950d.i386.rpm
26. dpkg -i iproute_2.6.11-2_i386.deb
27. cp /bin/true /sbin/chkconfig
28. dpkg -i iptables_1.3.0-3_i386.deb
29. dpkg -i ebtables_2.0.6-8_i386.deb
30. shutdown -r now
# 重新開機
31.dmesg |grep MPLS
# 若成功進入debian大功告成!!





































