- Timestamp:
- Aug 11, 2010, 11:43:37 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
drbl-virt/sbin/drbl_xen_patch.sh
r173 r174 24 24 Xen_Kernel=$(echo $Xen_Kernel | sed 's/^vmlinuz-//g' ) 25 25 echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel" 26 #/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel26 /opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel 27 27 echo "" 28 28 … … 30 30 echo "Re-delpoy drbl client" 31 31 echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf" 32 #/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf32 /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf 33 33 echo "" 34 34 35 35 # == Copy xen image to /tftpboot/nbi_img/ == 36 36 echo "copy Xen image & Kernel to /tftpboot/nbi_img/" 37 #cp /boot/*xen* /tftpboot/nbi_img/38 #cp /boot/vmlinuz-${Xen_Kernel} /tftpboot/nbi_img/39 #cp /boot/initrd.img-${Xen_Kernel} /tftpboot/nbi_img/40 #cp /boot/config-${Xen_Kernel} /tftpboot/nbi_img/37 cp /boot/*xen* /tftpboot/nbi_img/ 38 cp /boot/vmlinuz-${Xen_Kernel} /tftpboot/nbi_img/ 39 cp /boot/initrd.img-${Xen_Kernel} /tftpboot/nbi_img/ 40 cp /boot/config-${Xen_Kernel} /tftpboot/nbi_img/ 41 41 echo "" 42 42 43 43 # == Modify PXE booting menu == 44 44 # backup generate-pxe-menu 45 #cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak46 #cp /opt/drbl/sbin/generate-pxe-menu /opt/drbl/sbin/generate-pxe-menu.drbl_virt_bak45 cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak 46 cp /opt/drbl/sbin/generate-pxe-menu /opt/drbl/sbin/generate-pxe-menu.drbl-virt_bak 47 47 generate_PXE_menu="/opt/drbl/sbin/generate-pxe-menu" 48 48 declare -i modify_line=$(cat -n $generate_PXE_menu | grep 'label drbl' | awk 'NR==1 {print $1}') … … 66 66 67 67 # = 2. Patch DRBL initrd to support bridge = 68 # == Patch /usr/bin/mkpxeinitrd-net (1)modules (2)xen network scripts == 68 # == Patch /usr/bin/mkpxeinitrd-net (1)Xen network scripts (2)command (3)modules == 69 # backup 70 cp /usr/bin/mkpxeinitrd-net /usr/bin/mkpxeinitrd-net.drbl-virt_bak 71 # copy Xen network scripts 72 cp /etc/xen/scripts/network-bridge /usr/lib/mkpxeinitrd-net/initrd-skel/bin/ 73 cp /etc/xen/scripts/xen-network-common.sh /usr/lib/mkpxeinitrd-net/initrd-skel/bin/ 74 cp /etc/xen/scripts/xen-script-common.sh /usr/lib/mkpxeinitrd-net/initrd-skel/bin/ 75 # patch it to copy command 76 declare -i modify_line=$(cat -n /usr/bin/mkpxeinitrd-net | grep 'include_bin_prog_from_server=' | awk '{print $1}') 77 modify_file="/usr/bin/mkpxeinitrd-net" 78 sed -i "${modify_line}c\include_bin_prog_from_server='sleep lspci insmod modprobe rmmod lsmod pkill strings brctl ip egrep awk gawk seq fgrep dirname expr'" $modify_file 79 sed -i "${modify_line}i# drbl-virt add" $modify_file 80 # patch it to copy modules 81 declare -i modify_line=$(cat -n /usr/bin/mkpxeinitrd-net | grep "# Deal with firmwares" | awk '{print $1}') 82 sed -i "${modify_line}i# drbl-virt add" $modify_file 83 modify_line=$modify_line+1 84 sed -i "${modify_line}icp -a --parents kernel/net/bridge/bridge.ko \$initrd/lib/modules/\$kernel_ver/" $modify_file 85 modify_line=$modify_line+1 86 sed -i "${modify_line}icp -a --parents kernel/drivers/xen/netback/netloop.ko \$initrd/lib/modules/\$kernel_ver/" $modify_file 69 87 88 # == Run Xen network-bridge in booting (/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init) == 89 cat <<EOF >/usr/lib/mkpxeinitrd-net/initrd-skel/bin/start_xen_bridge.sh 90 # drbl-virt add 91 NICs=$(/sbin/ifconfig | grep eth | awk '{print $1}') 92 declare -i NICs_nu=$(echo $NICs |wc -l) 93 NIC="" 70 94 71 # == Copy xen netwrok scripts == 95 if [ $NICs_nu -lt 1 ]; 96 for (( i=0 ; i<$NICs_nu ; i++ )) 97 do 98 NIC_IP=$(ifconfig eth${i} | grep "inet addr" | sed 's/inet addr://g' | sed 's/Bcast.*$//g') 99 if [ -n $NIC_IP ]; then 100 NIC="eth${i}" 101 break 102 fi 103 done 104 else 105 NIC=$NICS 106 fi 72 107 73 # == run xen network scripts (/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init) == 108 sh /bin/network-bridge start netdev=$NIC 109 EOF 110 # backup 111 cp /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init.drbl-virt_bak 112 declare -i modify_line=$(cat -n /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init | grep "# clean the tag file" | awk '{print $1}') 113 modify_file="/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init" 74 114 75 76 115 sed -i "${modify_line}i# drbl-virt add" $modify_file 116 modify_line=$modify_line+1 117 sed -i "${modify_line}ish /bin/start_xen_bridge.sh" $modify_file
Note: See TracChangeset
for help on using the changeset viewer.