summaryrefslogtreecommitdiffstats
path: root/boot-env
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-01-28 13:44:22 +0100
committerDirk von Suchodoletz2009-01-28 13:44:22 +0100
commitddad116182104be171a9b958d449d6525979e295 (patch)
tree9071cc8a0e95f852c2f686cdcc503d8f5d97c2f4 /boot-env
parentAvoid interpretation of shell script variables by perl. (diff)
downloadcore-ddad116182104be171a9b958d449d6525979e295.tar.gz
core-ddad116182104be171a9b958d449d6525979e295.tar.xz
core-ddad116182104be171a9b958d449d6525979e295.zip
Rearranging preboot environment file structure.
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2537 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env')
-rwxr-xr-xboot-env/preboot-cd/init60
-rw-r--r--boot-env/preboot-cd/preboot.sh35
2 files changed, 53 insertions, 42 deletions
diff --git a/boot-env/preboot-cd/init b/boot-env/preboot-cd/init
index e25c8607..987c8192 100755
--- a/boot-env/preboot-cd/init
+++ b/boot-env/preboot-cd/init
@@ -1,5 +1,5 @@
#!/bin/ash
-# Copyright (c) 2008 - OpenSLX GmbH
+# Copyright (c) 2008..2009 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -9,8 +9,8 @@
#
# General information about OpenSLX can be found at http://openslx.org
#
-# Main script for cd-boot demo initial ramfs - preloading environment for
-# for running OpenSLX linux stateless clients version 4 for testing
+# Main script for preboot initial ramfs - preloading environment for running
+# OpenSLX linux stateless clients version 5 for testing
fetchip () {
# we expect to get an ip address within 10++ seconds
@@ -34,10 +34,9 @@ done
}
#############################################################################
-# device files get their own filesystem (to be move mounted later)
+# device files get their own filesystem
devdir="/dev"
mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir}
-NWMODULES="forcedeth e1000 e100 tg3 3c59x via-rhine r8169 pcnet32 b44 8139too"
DEBUGLEVEL=0
# create basic device files an directories in dev (for most hardware related
@@ -54,38 +53,20 @@ for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \
done
mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev
-# source functions file common for all distros, messages contains all error
-# and info output (for some reason the error output is not produced properly
-# - crash)
-
# initramfs-setup configuration (common settings for all clients using a
# certain InitRamFS generated by slxmkramfs/mkdxsinitrd)
[ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin
-# set a default LAN interface, might be modified for WLAN or on machines with
-# more than one ethernet card built in
+# set a default LAN interface, has to be modified for WLAN or on machines
+# with more than one ethernet card built in
nwif="eth0"
# mount the important standard directories
[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc
[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys
-# keep quiet
-#echo "0 0 0 0" >/proc/sys/kernel/printk
-
-# fixme: shut down if script fails
-trap "exec (sleep 30; echo o>/proc/sysrq-trigger)" \
- SIGHUP SIGINT SIGPIPE SIGTERM
-
-# if no kernel version is set, try to get it directly from /proc
-if [ -z $KERNEL ] ; then
- KERNEL=$(cat /proc/version)
- KERNEL=${KERNEL#*version }
- KERNEL=${KERNEL% (*) (*}
-fi
-
# load network adaptor modules
for mod in ${NWMODULES}; do
modprobe ${MODPRV} $mod || echo "module $mod did not load for some reason"
@@ -105,8 +86,9 @@ for opts in ${KCMDLINE} ; do
esac
done
-# start a watchdog to ensure an automated reboot or halt of the machine if SLX
-# init does not succeed (e.g. missing kernel module for the network adaptor)
+# start a watchdog to ensure an automated reboot or halt of the machine if the
+# preboot init does not succeed (e.g. missing kernel module/firmware for the
+# network adaptor)
if [ "${DEBUGLEVEL}" -gt 0 ] ; then
cat<<EOF > /bin/watchdog
#!/bin/ash
@@ -146,15 +128,11 @@ ip route add default via $router
# at this point a little selection script could be downloaded, which lets the
# user choose what kind of SLX client he wants to get
-
-# get kernel and initramfs, if something fails start debug shell
-echo "Fetching selected kernel and initial ramfs from the net ..."
-( wget -q -c -O /tmp/kernel \
- ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/kernel 2>/dev/null && \
-wget -q -c -O /tmp/initramfs \
- ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/$file 2>/dev/null ) || \
- /bin/ash
-
+echo "Fetching preboot interactive part and configuration from the net ..."
+wget -q -c -O /tmp/preboot.env \
+ ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/${prebootid}.env
+mkdir /preboot
+tar -xzf /tmp/${prebootid}.env -C /preboot
# start a debug shell if needed, else set quiet kernel parameter
if [ "${DEBUGLEVEL}" -gt 0 ] ; then
/bin/ash
@@ -162,10 +140,8 @@ else
quiet=quiet
echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
fi
+# run the preboot interactive part which finally will execute kexec
+exec /preboot/preboot.sh
+# we will never return from that one ...
+
-# start the new kernel with initialramfs and cmdline
-echo "Booting OpenSLX client ..."
-kexec -l /tmp/kernel --initrd=/tmp/initramfs \
- --append="ip=$ip:$siaddr:$router:$subnet \
- file=ftp://132.230.4.4/default.tgz debug=${DEBUGLEVEL} $quiet"
-kexec -e
diff --git a/boot-env/preboot-cd/preboot.sh b/boot-env/preboot-cd/preboot.sh
new file mode 100644
index 00000000..98a2c61e
--- /dev/null
+++ b/boot-env/preboot-cd/preboot.sh
@@ -0,0 +1,35 @@
+#!/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
+#
+# preboot script for user interaction with OpenSLX preloading environment for
+# Linux stateless clients
+
+# we expect to have a system selection dialog file in /preboot/syssel.dialog
+dialog --file syssel.dialog 2>result
+# source the system to boot configuration ($kernel, $initramfs, $append,
+# $label)
+. $(cat result)
+
+echo $kernel
+
+wget ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/$kernel \
+ -o /tmp/kernel
+wget ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/$initramfs \
+ -o initramfs
+
+# read primary IP configuration to pass it on
+. /tmp/ipstuff
+
+# start the new kernel with initialramfs and cmdline
+echo "Booting OpenSLX client $label ..."
+kexec -l /tmp/kernel --initrd=/tmp/initramfs \
+ --append="ip=$ip:$siaddr:$router:$subnet $append $quiet"
+kexec -e