summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-03-04 00:02:36 +0100
committerDirk von Suchodoletz2009-03-04 00:02:36 +0100
commit4fc25af885fd34b5216b8008222b104d5a561126 (patch)
tree4786d2f01d24095460a0476693b6143758124193
parentRearranging init-hooks to add a special network bridge hook. (diff)
downloadcore-4fc25af885fd34b5216b8008222b104d5a561126.tar.gz
core-4fc25af885fd34b5216b8008222b104d5a561126.tar.xz
core-4fc25af885fd34b5216b8008222b104d5a561126.zip
Added the general bridge configuration feature as described in ticket
#311: The xenbr function is moved to the appropriate init hook from general functions (cleaning up there). The bridge init hook for the several virtualization tools like vmware, qemukvm, virtualbox use the same filename as the action is to be performed just once ... git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2665 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r--Makefile9
-rw-r--r--initramfs/stage3-stuff/etc/functions28
-rwxr-xr-xinitramfs/stage3-stuff/init12
-rwxr-xr-xinitramfs/uclib-rootfs/bin/busyboxbin354556 -> 358656 bytes
l---------initramfs/uclib-rootfs/bin/less1
-rw-r--r--os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh30
-rw-r--r--os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh30
-rwxr-xr-xos-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh29
-rwxr-xr-xos-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh42
9 files changed, 146 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 22c022fc..858fe12c 100644
--- a/Makefile
+++ b/Makefile
@@ -198,9 +198,11 @@ plain-install:
$(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/boot-env/pxe/; \
cp -p tools/mksquashfs $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/squashfs/; \
tar --exclude=.svn -cp -C initramfs tpm | \
- tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share;
-
+ tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share; \
+ @ # link the library loader for the uclibc (to use the uclibc busybox)
+ @ ln -sf ${SLX_BASE_PATH}/share/uclib-rootfs/lib/ld-uClibc.so.0 \
+ /lib/ld-uClibc.so.0
postinstall:
@ # create default config folder hierarchy:
@@ -234,7 +236,7 @@ postinstall:
unset OPENSLX_SVN_SNAPSHOT || \
OPENSLX_SVN_SNAPSHOT="1"; \
. ./VERSIONS; \
- echo -e "#! /bin/sh\n\necho $${OPENSLX_VERSION_STRING}" \
+ echo -e "#! /bin/sh\n\necho $${OPENSLX_VERSION_STRING}" \
> $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \
chmod a+x $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \
ln -sf $(SLX_BASE_PATH)/bin/slxversion $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \
@@ -267,6 +269,7 @@ and stage1"
@echo "keeping files in $(SLX_PRIVATE_PATH)"
@rm -rf $(SLX_PUBLIC_PATH)
@rm -f $(USR_BIN_PATH)/slx*
+ @rm -f /lib/ld-uClibc.so.0
mrproper:
@echo "Wiping all!"
diff --git a/initramfs/stage3-stuff/etc/functions b/initramfs/stage3-stuff/etc/functions
index 4632db19..88f661a3 100644
--- a/initramfs/stage3-stuff/etc/functions
+++ b/initramfs/stage3-stuff/etc/functions
@@ -1,5 +1,5 @@
# Copyright (c) 2003..2006 - RZ Uni Freiburg
-# Copyright (c) 2006..2008 - OpenSLX GmbH
+# Copyright (c) 2006..2009 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -166,32 +166,6 @@ case "${proto}" in
esac
}
#############################################################################
-# configure Xen bridge xenbr0
-xenbr_config () {
-modprobe ${MODPRV} netloop
-local ipls
-local vifnum="0"
-local bridge="xenbr${vifnum}"
-local netdev="eth${vifnum}"
-local pdev="p${netdev}"
-local vdev="veth${vifnum}"
-local vif0="vif0.${vifnum}"
-# fixme: that is the mac address of main ethernet device
-local mac=$macaddr
-
-brctl addbr ${bridge}
-brctl stp ${bridge} off
-brctl setfd ${bridge} 0
-brctl addif ${bridge} ${vif0}
-for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
- "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
- "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
- "${bridge} up" "${vif0} up" "${pdev} up" ; do
- ip link set ${ipls}
-done
-brctl addif ${bridge} ${pdev}
-}
-#############################################################################
# replace @@@serverip@@@ with real serverip. Allows the usage of a variable
# for the server ip address (e.g. in machine-setup or kernel commandline)
checkip ()
diff --git a/initramfs/stage3-stuff/init b/initramfs/stage3-stuff/init
index 6f7a37c5..87961607 100755
--- a/initramfs/stage3-stuff/init
+++ b/initramfs/stage3-stuff/init
@@ -10,8 +10,7 @@
#
# General information about OpenSLX can be found at http://openslx.org
#
-# Main script for new type of initial ramdisk for OpenSLX linux stateless
-# clients version 4
+# Main script for initial ramdisk for OpenSLX linux stateless clients
#############################################################################
# fixme: the primary init script should never fail, so move all critical code
@@ -76,7 +75,7 @@ nodnbdcache="yes"
# set a default LAN interface, might be modified for WLAN, bridge setups or
# on machines with more than one ethernet card built in
-nwif="eth0"
+export nwif="eth0"
# load usb modules for keyboard (reenable usb keyboards, otherwise the
# admin has to wait until second run of hwsetup late in stage3) and the
@@ -368,7 +367,7 @@ runinithook '10-nw-if-config'
# check here for the active ethernet link (skip non-ethN interfaces)
if strinstr "eth" "$nwif" ; then
for ethif in eth0 eth1 eth2 eth3 ; do
- macaddr=$(ip link show dev $ethif 2>/dev/null | \
+ export macaddr=$(ip link show dev $ethif 2>/dev/null | \
sed -n "/ether [0-9e-f]\{2\}:.*/p" | sed -e "s/.*ether //;s/ .*//")
# if there is no bootmac present in kernel commandline any checks are
# useless
@@ -396,6 +395,8 @@ fi
# hook to setup bridging (several virtualization tools ...)
# xenbr_config
runinithook '20-nw-bridge-config'
+# fixme: hack for non-returning nwif variable
+ip link show dev br0 >/dev/null 2&>1 && nwif=br0
# set up loopback networking
[ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)"
@@ -954,7 +955,8 @@ killall klogd 2>/dev/null
# variables
mount -n --move /dev /mnt/dev
umount -n /proc
-unset client debug date initrd ip bldroot nfsroot rootfs ticks vci vga
+unset client debug date initrd ip bldroot macaddr nwif nfsroot rootfs ticks \
+ vci vga
unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \
SLXVERSION UDEVD_EXPECTED_SEQNUM PATH
diff --git a/initramfs/uclib-rootfs/bin/busybox b/initramfs/uclib-rootfs/bin/busybox
index 9eaedc64..d6a7bc6d 100755
--- a/initramfs/uclib-rootfs/bin/busybox
+++ b/initramfs/uclib-rootfs/bin/busybox
Binary files differ
diff --git a/initramfs/uclib-rootfs/bin/less b/initramfs/uclib-rootfs/bin/less
new file mode 120000
index 00000000..c3fa8102
--- /dev/null
+++ b/initramfs/uclib-rootfs/bin/less
@@ -0,0 +1 @@
+busybox \ No newline at end of file
diff --git a/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..7503e3ab
--- /dev/null
+++ b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+set -x
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} br0
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..7503e3ab
--- /dev/null
+++ b/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+set -x
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} br0
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..437426db
--- /dev/null
+++ b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,29 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
new file mode 100755
index 00000000..7267969c
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
@@ -0,0 +1,42 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# XEN specific init hook to create a bridge on the active network interface
+#############################################################################
+
+# configure Xen bridge xenbr0 (would it be possible to make it just br0?)
+
+modprobe ${MODPRV} netloop
+local ipls
+local vifnum="0"
+local bridge="xenbr${vifnum}"
+local netdev="eth${vifnum}" # should be ${nwif}
+local pdev="p${netdev}"
+local vdev="veth${vifnum}"
+local vif0="vif0.${vifnum}"
+# fixme: that is the mac address of main ethernet device
+local mac=${macaddr}
+
+brctl addbr ${bridge}
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+brctl addif ${bridge} ${vif0}
+for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
+ "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
+ "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
+ "${bridge} up" "${vif0} up" "${pdev} up" ; do
+ ip link set ${ipls}
+done
+brctl addif ${bridge} ${pdev}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}