diff options
author | Oliver Tappe | 2009-01-28 17:46:42 +0100 |
---|---|---|
committer | Oliver Tappe | 2009-01-28 17:46:42 +0100 |
commit | faa6ae6ae6fe36a5950fd0c10673c2995c0fe099 (patch) | |
tree | 5cf8ff9b846d00698f3c3f37028d1023000d3ffb /boot-env/preboot | |
parent | * in case of error during creation of bootmenu files, the demuxer no longer (diff) | |
download | core-faa6ae6ae6fe36a5950fd0c10673c2995c0fe099.tar.gz core-faa6ae6ae6fe36a5950fd0c10673c2995c0fe099.tar.xz core-faa6ae6ae6fe36a5950fd0c10673c2995c0fe099.zip |
* implemented creation of bootmenu for preboot environments
* separated general preboot-files from the cd-specific ones
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2539 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env/preboot')
-rw-r--r-- | boot-env/preboot/cd/iso/LICENSE | 2 | ||||
-rw-r--r-- | boot-env/preboot/cd/iso/README | 6 | ||||
-rw-r--r-- | boot-env/preboot/cd/iso/isolinux/isolinux.bin | bin | 0 -> 12331 bytes | |||
-rwxr-xr-x | boot-env/preboot/init | 147 | ||||
-rw-r--r-- | boot-env/preboot/iso/LICENSE | 2 | ||||
-rw-r--r-- | boot-env/preboot/iso/README | 6 | ||||
-rw-r--r-- | boot-env/preboot/iso/isolinux/isolinux.bin | bin | 0 -> 12331 bytes | |||
-rw-r--r-- | boot-env/preboot/preboot.sh | 35 |
8 files changed, 198 insertions, 0 deletions
diff --git a/boot-env/preboot/cd/iso/LICENSE b/boot-env/preboot/cd/iso/LICENSE new file mode 100644 index 00000000..0dd34fa8 --- /dev/null +++ b/boot-env/preboot/cd/iso/LICENSE @@ -0,0 +1,2 @@ +This package is free software distributed under the GPL version 2. +See http://openslx.org/COPYING diff --git a/boot-env/preboot/cd/iso/README b/boot-env/preboot/cd/iso/README new file mode 100644 index 00000000..f9abdbea --- /dev/null +++ b/boot-env/preboot/cd/iso/README @@ -0,0 +1,6 @@ +You seem to have the OpenSLX network demo CD/DVD still in your optical +drive! This is not required. You may safely remove the medium just +after the first kernel/initramfs is loaded ... + +If you have any feedback please consult http://openslx.org/feedback +and send your comments to feedback@openslx.org! diff --git a/boot-env/preboot/cd/iso/isolinux/isolinux.bin b/boot-env/preboot/cd/iso/isolinux/isolinux.bin Binary files differnew file mode 100644 index 00000000..8253549e --- /dev/null +++ b/boot-env/preboot/cd/iso/isolinux/isolinux.bin diff --git a/boot-env/preboot/init b/boot-env/preboot/init new file mode 100755 index 00000000..987c8192 --- /dev/null +++ b/boot-env/preboot/init @@ -0,0 +1,147 @@ +#!/bin/ash +# Copyright (c) 2008..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 +# +# 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 +( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) & +for i in 1 2 ; do + udhcpc -f -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null + if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then + . /tmp/ipstuff + for i in $dns ; do + echo "nameserver $i" >> /etc/resolv.conf + done + return + else + if [ $i -eq 1 ] ; then + sleep 1 + else + echo "Did not get any proper IP configuration"; /bin/ash + fi + fi +done +} + +############################################################################# +# device files get their own filesystem +devdir="/dev" +mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir} +DEBUGLEVEL=0 + +# create basic device files an directories in dev (for most hardware related +# devices mdev should handle that) +for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \ + "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \ + "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \ + "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \ + "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \ + "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \ + "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \ + "/dev/fb0 c 29 0" "/dev/bootsplash p" "/dev/xconsole p"; do + mknod $i +done +mkdir -p ${devdir}/pts ${devdir}/shm ${devdir}/.udevdb ${devdir}/.udev + +# 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, 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 + +# load network adaptor modules +for mod in ${NWMODULES}; do + modprobe ${MODPRV} $mod || echo "module $mod did not load for some reason" + usleep 10000 +done + +# read kernel commandline +read KCMDLINE < /proc/cmdline +# read the system wide machine-setup and then the kernel commandline +for opts in ${KCMDLINE} ; do + case ${opts} in + debug) + DEBUGLEVEL=1;; + # ... or a specified debug level (will be passed to next stage) + debug=*) + DEBUGLEVEL=${opts#debug=};; + esac +done + +# 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 +echo \$$ > /tmp/watchdogpid +[ ! -f /proc/version ] && mount -n -t proc proc /proc +sleep 120 2> /dev/null +echo "o" > /proc/sysrq-trigger +EOF + chmod u+x /bin/watchdog + watchdog & +fi + +if [ -n "${essid}" ] ; then + # WLAN setup will most probably change the network interface name stored in + # nwif (to wlan0 or something like that) + : +else + # check here for the active ethernet link + ip link show dev eth1 >/dev/null 2>&1 && echo "more than one nw if found" +fi + +# set up loopback networking and power up ethernet +ip link set dev lo up +ip addr add 127.0.0.1/8 dev lo +ip link set dev $nwif up || echo "I did not find any usable network adaptor." + +# run udhcpc and start a debug shell if no lease could be obtained +mkdir -p /usr/share/udhcpc +echo -e "#!/bin/ash\nunset infomsg HOME IFS mask lease interface DEBUGLEVEL \ +BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script +chmod u+x /usr/share/udhcpc/default.script +modprobe -q af_packet +[ -n $vci ] && vci="-V $vci" +fetchip +ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif +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 +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 +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 ... + + diff --git a/boot-env/preboot/iso/LICENSE b/boot-env/preboot/iso/LICENSE new file mode 100644 index 00000000..0dd34fa8 --- /dev/null +++ b/boot-env/preboot/iso/LICENSE @@ -0,0 +1,2 @@ +This package is free software distributed under the GPL version 2. +See http://openslx.org/COPYING diff --git a/boot-env/preboot/iso/README b/boot-env/preboot/iso/README new file mode 100644 index 00000000..f9abdbea --- /dev/null +++ b/boot-env/preboot/iso/README @@ -0,0 +1,6 @@ +You seem to have the OpenSLX network demo CD/DVD still in your optical +drive! This is not required. You may safely remove the medium just +after the first kernel/initramfs is loaded ... + +If you have any feedback please consult http://openslx.org/feedback +and send your comments to feedback@openslx.org! diff --git a/boot-env/preboot/iso/isolinux/isolinux.bin b/boot-env/preboot/iso/isolinux/isolinux.bin Binary files differnew file mode 100644 index 00000000..8253549e --- /dev/null +++ b/boot-env/preboot/iso/isolinux/isolinux.bin diff --git a/boot-env/preboot/preboot.sh b/boot-env/preboot/preboot.sh new file mode 100644 index 00000000..98a2c61e --- /dev/null +++ b/boot-env/preboot/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 |