From faa6ae6ae6fe36a5950fd0c10673c2995c0fe099 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 28 Jan 2009 16:46:42 +0000 Subject: * 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 --- boot-env/OpenSLX/BootEnvironment/PXE.pm | 9 +- boot-env/OpenSLX/BootEnvironment/Preboot.pm | 119 ++++++++++------- boot-env/OpenSLX/BootEnvironment/PrebootCD.pm | 10 +- boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm | 4 +- boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm | 28 ++++ boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm | 2 +- boot-env/preboot/cd/iso/LICENSE | 2 + boot-env/preboot/cd/iso/README | 6 + boot-env/preboot/cd/iso/isolinux/isolinux.bin | Bin 0 -> 12331 bytes boot-env/preboot/init | 147 +++++++++++++++++++++ boot-env/preboot/iso/LICENSE | 2 + boot-env/preboot/iso/README | 6 + boot-env/preboot/iso/isolinux/isolinux.bin | Bin 0 -> 12331 bytes boot-env/preboot/preboot.sh | 35 +++++ 14 files changed, 309 insertions(+), 61 deletions(-) create mode 100644 boot-env/preboot/cd/iso/LICENSE create mode 100644 boot-env/preboot/cd/iso/README create mode 100644 boot-env/preboot/cd/iso/isolinux/isolinux.bin create mode 100755 boot-env/preboot/init create mode 100644 boot-env/preboot/iso/LICENSE create mode 100644 boot-env/preboot/iso/README create mode 100644 boot-env/preboot/iso/isolinux/isolinux.bin create mode 100644 boot-env/preboot/preboot.sh (limited to 'boot-env') diff --git a/boot-env/OpenSLX/BootEnvironment/PXE.pm b/boot-env/OpenSLX/BootEnvironment/PXE.pm index 2dd0c2b7..e8c05090 100644 --- a/boot-env/OpenSLX/BootEnvironment/PXE.pm +++ b/boot-env/OpenSLX/BootEnvironment/PXE.pm @@ -59,6 +59,7 @@ sub writeBootloaderMenuFor my $pxeConfig = $self->_getTemplate(); my $pxeFile = "$pxeConfigPath/$externalClientID"; my $clientAppend = $client->{attrs}->{kernel_params_client} || ''; + my $bootURI = $client->{attrs}->{boot_uri} || ''; vlog(1, _tr("writing PXE-file %s", $pxeFile)); # set label for each system @@ -73,7 +74,7 @@ sub writeBootloaderMenuFor $label = $info->{name}; } } - $info->{label} = $label; + $info->{pxeLabel} = $label; } my $slxLabels = ''; foreach my $info (sort { $a->{label} cmp $b->{label} } @$systemInfos) { @@ -81,9 +82,10 @@ sub writeBootloaderMenuFor my $kernelName = basename($info->{'kernel-file'}); my $append = $info->{attrs}->{kernel_params}; $append .= " initrd=$vendorOSName/$info->{'initramfs-name'}"; + $append .= " file=$bootURI" if length($bootURI); $append .= " $clientAppend"; $slxLabels .= "LABEL openslx-$info->{'external-id'}\n"; - $slxLabels .= "\tMENU LABEL ^$info->{label}\n"; + $slxLabels .= "\tMENU LABEL ^$info->{pxeLabel}\n"; $slxLabels .= "\tKERNEL $vendorOSName/$kernelName\n"; $slxLabels .= "\tAPPEND $append\n"; $slxLabels .= "\tIPAPPEND 3\n"; @@ -103,7 +105,8 @@ sub writeBootloaderMenuFor # PXE uses 'cp850' (codepage 850) but our string is in utf-8, we have # to convert in order to avoid showing gibberish on the client side... - spitFile($pxeFile, $pxeConfig, { 'io-layer' => 'encoding(cp850)' } ); + spitFile($pxeFile, $pxeConfig, { 'io-layer' => 'encoding(cp850)' } ) + unless $self->{'dry-run'}; return 1; } diff --git a/boot-env/OpenSLX/BootEnvironment/Preboot.pm b/boot-env/OpenSLX/BootEnvironment/Preboot.pm index eb6fa730..b5a7ddb8 100644 --- a/boot-env/OpenSLX/BootEnvironment/Preboot.pm +++ b/boot-env/OpenSLX/BootEnvironment/Preboot.pm @@ -23,6 +23,7 @@ use File::Basename; use File::Path; use OpenSLX::Basics; +use OpenSLX::ConfigDB qw(:support); use OpenSLX::Utils; sub writeBootloaderMenuFor @@ -39,57 +40,65 @@ sub writeBootloaderMenuFor = clone($self->_pickSystemWithNewestKernel($systemInfos)); $self->_createImage($client, $prebootSystemInfo); -# my $pxePath = $self->{'target-path'}; -# my $pxeConfigPath = "$pxePath/pxelinux.cfg"; -# -# my $pxeConfig = $self->_getTemplate(); -# my $pxeFile = "$pxeConfigPath/$externalClientID"; -# my $clientAppend = $client->{attrs}->{kernel_params_client} || ''; -# vlog(1, _tr("writing PXE-file %s", $pxeFile)); -# -# # set label for each system -# foreach my $info (@$systemInfos) { -# my $label = $info->{label} || ''; -# if (!length($label) || $label eq $info->{name}) { -# if ($info->{name} =~ m{^(.+)::(.+)$}) { -# my $system = $1; -# my $exportType = $2; -# $label = $system . ' ' x (40-length($system)) . $exportType; -# } else { -# $label = $info->{name}; -# } -# } -# $info->{label} = $label; -# } -# my $slxLabels = ''; -# foreach my $info (sort { $a->{label} cmp $b->{label} } @$systemInfos) { -# my $vendorOSName = $info->{'vendor-os'}->{name}; -# my $kernelName = basename($info->{'kernel-file'}); -# my $append = $info->{attrs}->{kernel_params}; -# $append .= " initrd=$vendorOSName/$info->{'initramfs-name'}"; -# $append .= " $clientAppend"; -# $slxLabels .= "LABEL openslx-$info->{'external-id'}\n"; -# $slxLabels .= "\tMENU LABEL ^$info->{label}\n"; -# $slxLabels .= "\tKERNEL $vendorOSName/$kernelName\n"; -# $slxLabels .= "\tAPPEND $append\n"; -# $slxLabels .= "\tIPAPPEND 1\n"; -# my $helpText = $info->{description} || ''; -# if (length($helpText)) { -# # make sure that text matches the given margin -# my $margin = $openslxConfig{'pxe-theme-menu-margin'} || 0; -# my $marginAsText = ' ' x $margin; -# $helpText =~ s{^}{$marginAsText}gms; -# $slxLabels .= "\tTEXT HELP\n$helpText\n\tENDTEXT\n"; -# } -# } -# # now add the slx-labels (inline or appended) and write the config file -# if (!($pxeConfig =~ s{\@\@\@SLX_LABELS\@\@\@}{$slxLabels})) { -# $pxeConfig .= $slxLabels; -# } -# -# # PXE uses 'cp850' (codepage 850) but our string is in utf-8, we have -# # to convert in order to avoid showing gibberish on the client side... -# spitFile($pxeFile, $pxeConfig, { 'io-layer' => 'encoding(cp850)' } ); + my $externalClientName = externalConfigNameForClient($client); + my $bootloaderPath = "$self->{'target-path'}/bootloader"; + my $bootloaderConfigPath = "$bootloaderPath/$externalClientName"; + mkpath($bootloaderConfigPath) unless $self->{'dry-run'}; + my $menuFile = "$bootloaderConfigPath/bootmenu.dialog"; + + my $clientAppend = $client->{attrs}->{kernel_params_client} || ''; + vlog(1, _tr("writing bootmenu %s", $menuFile)); + + # set label for each system + foreach my $info (@$systemInfos) { + my $label = $info->{label} || ''; + if (!length($label) || $label eq $info->{name}) { + $label = $info->{name}; + } + $info->{label} = $label; + } + my $bootmenuEntries = ''; + foreach my $info (sort { $a->{label} cmp $b->{label} } @$systemInfos) { + my $vendorOSName = $info->{'vendor-os'}->{name}; + my $kernelName = basename($info->{'kernel-file'}); + my $append = $info->{attrs}->{kernel_params} || ''; + $append .= " $clientAppend"; + $bootmenuEntries .= qq{ "$info->{label}" "" 1}; + + # create a file containing the boot-configuration for this system + my $systemDescr = unshiftHereDoc(<<" End-of-Here"); + label="$info->{label}" + kernel="$vendorOSName/$kernelName" + initramfs="$vendorOSName/$info->{'initramfs-name'}" + append="$append" + End-of-Here + my $systemFile = "$bootloaderConfigPath/$info->{label}"; + spitFile( + $systemFile, $systemDescr, { 'io-layer' => 'encoding(iso8859-1)' } + ) unless $self->{'dry-run'}; + } + + my $entryCount = @$systemInfos; + my $bootmenu = unshiftHereDoc(<<" End-of-Here"); + --radiolist "OpenSLX Boot Menu" 20 65 $entryCount $bootmenuEntries + End-of-Here + + if (!$self->{'dry-run'}) { + # default to iso encoding, let's see how uclibc copes with it ... + spitFile($menuFile, $bootmenu, { 'io-layer' => 'encoding(iso8859-1)' }); + + # copy the preboot script into the folder to be tared + my $prebootBasePath + = "$openslxConfig{'base-path'}/share/boot-env/preboot"; + slxsystem(qq{cp -p $prebootBasePath/preboot.sh $bootloaderConfigPath/}); + slxsystem(qq{chmod a+x $bootloaderConfigPath/preboot.sh}); + + # create a tar which can/will be downloaded by prebooting clients + my $tarCMD + = qq{cd $bootloaderConfigPath; tar -czf "${bootloaderConfigPath}.env" *}; + slxsystem($tarCMD); + rmtree($bootloaderConfigPath); + } return 1; } @@ -139,12 +148,18 @@ sub _makePrebootInitRamFS my $self = shift; my $info = shift; my $initramfs = shift; + my $client = shift; my $vendorOS = $info->{'vendor-os'}; my $kernelFile = basename(followLink($info->{'kernel-file'})); my $attrs = clone($info->{attrs} || {}); + my $bootURI = $client->{attrs}->{boot_uri}; + if (!$bootURI) { + die _tr("client $client->{name} needs an URI in attribute 'boot_uri' to be used for preboot!"); + } + chomp(my $slxVersion = qx{slxversion}); my $params = { @@ -160,6 +175,8 @@ sub _makePrebootInitRamFS => "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}", 'slx-version' => $slxVersion, 'system-name' => $info->{name}, + 'preboot-id' => $client->{name}, + 'boot-uri' => $bootURI, }; # TODO: make debug-level an explicit attribute, it's used in many places! diff --git a/boot-env/OpenSLX/BootEnvironment/PrebootCD.pm b/boot-env/OpenSLX/BootEnvironment/PrebootCD.pm index 6da11577..d4126ba9 100644 --- a/boot-env/OpenSLX/BootEnvironment/PrebootCD.pm +++ b/boot-env/OpenSLX/BootEnvironment/PrebootCD.pm @@ -33,8 +33,8 @@ sub initialize return if !$self->SUPER::initialize($params); - $self->{'original-path'} = "$openslxConfig{'public-path'}/preboot-cd"; - $self->{'target-path'} = "$openslxConfig{'public-path'}/preboot-cd.new"; + $self->{'original-path'} = "$openslxConfig{'public-path'}/preboot"; + $self->{'target-path'} = "$openslxConfig{'public-path'}/preboot.new"; if (!$self->{'dry-run'}) { mkpath([$self->{'original-path'}]); @@ -68,8 +68,8 @@ sub _createImage my $imageDir = "$openslxConfig{'public-path'}/images/$client->{name}"; mkpath($imageDir) unless $self->{'dry-run'}; - # copy static data and init script - my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot-cd"; + # copy static data + my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot/cd"; slxsystem(qq{rsync -rlpt $dataDir/iso "$imageDir/"}) unless $self->{'dry-run'}; @@ -81,7 +81,7 @@ sub _createImage # create initramfs my $initramfsName = qq{"$imageDir/iso/isolinux/initramfs"}; - $self->_makePrebootInitRamFS($info, $initramfsName); + $self->_makePrebootInitRamFS($info, $initramfsName, $client); # write trivial isolinux config my $isolinuxConfig = unshiftHereDoc(<<" End-of-Here"); diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm index baf6d4c3..e6e7155e 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/Base.pm @@ -44,6 +44,8 @@ sub new 'root-path' => '!', 'slx-version' => '!', 'system-name' => '!', + 'preboot-id' => '?', + 'boot-uri' => '?', } ); my $self = $params; @@ -285,7 +287,7 @@ sub _writeInitramfsSetup # generate initramfs-setup file containing attributes that are # relevant for the initramfs only (before there's a root-FS): my $initramfsAttrs = { - 'host_name' => 'slx-client', # just to have something at all + 'host_name' => 'slx-client', # just to have something at all 'ramfs_fsmods' => $self->{attrs}->{ramfs_fsmods} || '', 'ramfs_miscmods' => $self->{attrs}->{ramfs_miscmods} || '', 'ramfs_nicmods' => $self->{attrs}->{ramfs_nicmods} || '', diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm index 81074bce..6de04314 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/Preboot.pm @@ -78,6 +78,34 @@ sub _setupBuildPath return; } +sub _writeInitramfsSetup +{ + my $self = shift; + + # generate initramfs-setup file containing attributes that are + # relevant for the initramfs only (before there's a root-FS) - + # this override adds the name of the client such that the booting + # system has an ID to use for accessing the corresponding boot environment + # on the server + my $initramfsAttrs = { + 'host_name' => 'slx-client', # just to have something at all + 'ramfs_miscmods' => $self->{attrs}->{ramfs_miscmods} || '', + 'ramfs_nicmods' => $self->{attrs}->{ramfs_nicmods} || '', + 'preboot_id' => $self->{'preboot-id'} || '', + 'boot_uri' => $self->{'boot-uri'} || '', + }; + my $content = "# attributes set by slxconfig-demuxer:\n"; + foreach my $attr (keys %$initramfsAttrs) { + $content .= qq[$attr="$initramfsAttrs->{$attr}"\n]; + } + $self->addCMD( { + file => "$self->{'build-path'}/etc/initramfs-setup", + content => $content + } ); + + return; +} + sub _copyUclibcRootfs { my $self = shift; diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm index 1f6aa045..b447177c 100644 --- a/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm @@ -29,7 +29,7 @@ sub _copyVariantSpecificFiles { my $self = shift; - my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot-cd"; + my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot"; $self->addCMD("cp $dataDir/init $self->{'build-path'}/"); return 1; 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 new file mode 100644 index 00000000..8253549e Binary files /dev/null and b/boot-env/preboot/cd/iso/isolinux/isolinux.bin differ 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< /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 new file mode 100644 index 00000000..8253549e Binary files /dev/null and b/boot-env/preboot/iso/isolinux/isolinux.bin differ 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 -- cgit v1.2.3-55-g7522