Version 5 (modified by jazz, 13 years ago) (diff) |
---|
2011-09-27
- 為何 rock 要把 bridge.ko 加入 /usr/bin/mkpxeinitrd-net 呢?答案很明顯是跟 brctl 有關!
root@debian:~# lsmod > before root@debian:~# brctl addbr br0 root@debian:~# lsmod > after root@debian:~# diff before after 1a2,3 > bridge 39662 0 > stp 1440 1 bridge
- rock 把執行 /bin/start_xen_bridge.sh 需要用的指令都補進 initrd 裡:brctl ip egrep awk gawk seq fgrep dirname expr bash
- 可是他卻漏了 mount umount mount.nfs umount.nfs
- 至於 netloop.ko 是 xen_brdige.sh 中會用到的,在 KVM 的 case 中並不會用到。
-
/usr/bin/mkpxeinitrd-net
old new 37 37 # uncompress the compress kernel module. This is special for Mandriva case. It uses compressed kernel module, e.g. pcnet32.ko.gz. Before we used modprobe from busybox, we have to uncompress that. Now the modprobe program is from the OS (See variable include_bin_prog_from_server), so we should allow this type of kernel modules. 38 38 use_compressed_kernel_module="yes" 39 39 # Some required bin programs to be included in the PXE initrd, which are not provided by busybox or the one provided by busybox does not support the function we want. E.g. sleep (we need "sleep 0.1", while sleep from busybox does not support 0.1 secs). 40 include_bin_prog_from_server="sleep lspci insmod modprobe rmmod lsmod pkill strings mount umount mount.nfs umount.nfs" 40 # drbl-virt add 41 include_bin_prog_from_server='sleep lspci insmod modprobe rmmod lsmod pkill strings brctl ip egrep awk gawk seq fgrep dirname expr bash' 41 42 42 43 # No need to use sudo if we are root 43 44 if [ $UID -eq 0 ]; then … … 303 304 cp -a --parents $i $initrd/lib/modules/$kernel_ver/ 304 305 done 305 306 307 # drbl-virt add 308 cp -a --parents kernel/net/bridge/bridge.ko $initrd/lib/modules/$kernel_ver/ 309 cp -a --parents kernel/drivers/xen/netback/netloop.ko $initrd/lib/modules/$kernel_ver/ 306 310 # Deal with firmwares! 307 311 # The following is borrowed from Debian's /usr/share/initramfs-tools/hook-functions 308 312 if [ "$copy_all_firmwares" = "yes" ]; then
-
- rock 的 init 切入點蠻特殊的,我原本是把切換成 br0 的程序加在 udhcpc 之前,試圖讓 br0 去取得 IP 位址。可是卻會出現 /sbin/init 第 175 行錯誤的問題。
150 $echo "Bringing up loopback interface" 151 ifconfig lo 127.0.0.1 up 152 route add -net 127.0.0.0 netmask 255.0.0.0 lo 153 ### 加在這裡 + brctl addbr br0 + brctl addif br0 eth0 + ifconfig br0 0.0.0.0 ### 在 initrd.img 中要用這種方式才能啟動 br0 + ifconfig eth0 0.0.0.0 + sleep 0.1
- 若是在 udhcpc 已經用 eth0 取得 IP 之後,才去把 eth0 暫停,新增 br0,再將 eth0 加入 br0,就能正常掛載 NFS 當 ROOTFS。這真的是需要一些觀念啊~
-
/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init
old new 244 244 done 245 245 done 246 246 247 # drbl-virt add 248 bash /bin/start_xen_bridge.sh 247 249 # clean the tag file 248 250 [ -f "/dev/sname" ] && rm -f /dev/sname
-
- start_xen_bridge.sh 其實有點小複雜,會先去判斷網卡個數,然後透過 /bin/network-bridge 的 netdev 參數來指定網卡。
# cat /usr/lib/mkpxeinitrd-net/initrd-skel/bin/start_xen_bridge.sh #!/bin/bash # drbl-virt add NICs=$(/sbin/ifconfig | grep eth | awk '{print $1}') declare -i NICs_nu=$(echo $NICs |wc -w) NIC="" if [ $NICs_nu -lt 1 ]; then for (( i=0 ; i<$NICs_nu ; i++ )) do NIC_IP=$(ifconfig eth${i} | grep "inet addr" | sed 's/inet addr://g' | sed 's/Bcast.*$//g' | sed 's/^[ ]*//') if [ -n $NIC_IP ]; then NIC="eth${i}" break fi done else NIC=$NICS fi bash /bin/network-bridge start netdev=$NIC
- 關於
Attachments (7)
- brctl_br0.png (5.5 KB) - added by jazz 13 years ago.
- init_175.png (15.2 KB) - added by jazz 13 years ago.
- eth9_bridge.png (12.4 KB) - added by jazz 13 years ago.
- CD1.png (24.4 KB) - added by jazz 13 years ago.
- CD2.png (20.1 KB) - added by jazz 13 years ago.
- ezilla-nchc.png (20.1 KB) - added by jazz 13 years ago.
- DRBL_Client_br0.png (11.9 KB) - added by jazz 13 years ago.
Download all attachments as: .zip