One of the last obstacles in my diskless systems quest was to get my
diskless Xen dom0s to bond their nics and create the bridge for Xen. All
before the nfsroot is mounted. Since bonding and bridging normally would
will take down the network, till restored, and on diskless systems thats
no good. Thus having to use a initramfs for the bonding and bridging.
In theory it was fairly straight forward, but ran into a bunch of
various obstacles. I will spare the nitty gritty for now and just pass
on the fruit. Here is the init script I used as part of my initramfs,
the part doing the work. The rest of the initramfs is very basic, just
some directories, busybox, and the following init script, cpio/gz that
up and pass to kernel like initrd.
Hopefully the following will save others time, as I did not come across
anything like the following in its entirety. Pieces of it all over the
place :)
#!/bin/busybox sh
mount -t proc none /proc
mount -t sysfs none /sys
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
# Kinda nasty will clean up with awk
IP=`dmesg | grep addr= | cut -d = -f3 | cut -d , -f1`
NM=`dmesg | grep mask= | cut -d = -f4 | cut -d , -f1`
GW=`dmesg | grep gw | cut -d = -f5 | cut -d , -f1`
ROOTPATH=`dmesg | grep rootpath | cut -d = -f4`
# Do the network stuff bond/bridge and restore ip/gw
ifconfig eth0 down
ifconfig eth1 down
ifconfig bond0 up
ifenslave bond0 eth0 eth1
brctl addbr xenbr0
brctl addif xenbr0 bond0
ifconfig xenbr0 ${IP} netmask ${NM}
route add -net 0/0 gw ${GW}
# Necessary due to port init delays in the catalyst
sleep 60
# Should do some error checking, because if the following
# does not mount, you get a kernel panic with switch_root
# also replace hard coded nfs server with var from dmesg/dhcp
mount -t nfs -o nolock 192.168.0.10:${ROOTPATH} /mnt
mount --move /proc /mnt/proc
mount --move /sysfs /mnt/sys
exec switch_root /mnt /sbin/init
# end of script
--
William L. Thomson Jr.
Obsidian-Studios, Inc.
http://www.obsidian-studios.com
---------------------------------------------------------------------
Archive http://marc.info/?l=jaxlug-list&r=1&w=2
RSS Feed http://www.mail-archive.com/[email protected]/maillist.xml
Unsubscribe [email protected]