summaryrefslogtreecommitdiffstats
path: root/boot-env
diff options
context:
space:
mode:
authorOliver Tappe2008-09-03 22:35:37 +0200
committerOliver Tappe2008-09-03 22:35:37 +0200
commitbf596194239c23f0b1d8052e32e62431992582d6 (patch)
treedaf14c963b7364d0d6615bf91db76d05426508a5 /boot-env
parent* instead of picking the first system encountered, the preboot cd is now (diff)
downloadcore-bf596194239c23f0b1d8052e32e62431992582d6.tar.gz
core-bf596194239c23f0b1d8052e32e62431992582d6.tar.xz
core-bf596194239c23f0b1d8052e32e62431992582d6.zip
* finished most basic implementation of preboot-cd boot environment, i.e.
it now boots until it tries to fetch the real OpenSLX-kernel & initramfs via network git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2200 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env')
-rw-r--r--boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm37
-rw-r--r--boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm11
-rwxr-xr-xboot-env/preboot-cd/init24
3 files changed, 49 insertions, 23 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm
index 50bf5ca5..8f24d7ce 100644
--- a/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm
+++ b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm
@@ -50,8 +50,6 @@ sub finalize
my $self = shift;
my $delete = shift;
- return if !$self->{prebootSystemInfo};
-
return $self->SUPER::finalize($delete);
}
@@ -62,13 +60,13 @@ sub writeBootloaderMenuFor
my $externalClientID = shift;
my $systemInfos = shift || [];
+ $self->_prepareBootloaderConfigFolder()
+ unless $self->{preparedBootloaderConfigFolder};
+
my $prebootSystemInfo
= clone($self->_pickSystemWithNewestKernel($systemInfos));
$self->_createImage($client, $prebootSystemInfo);
-# $self->_prepareBootloaderConfigFolder()
-# unless $self->{preparedBootloaderConfigFolder};
-#
# my $pxePath = $self->{'target-path'};
# my $pxeConfigPath = "$pxePath/pxelinux.cfg";
#
@@ -124,6 +122,21 @@ sub writeBootloaderMenuFor
return 1;
}
+sub _prepareBootloaderConfigFolder
+{
+ my $self = shift;
+
+ my $bootloaderPath = "$self->{'target-path'}/bootloader";
+ if (!$self->{'dry-run'}) {
+ rmtree($bootloaderPath);
+ mkpath($bootloaderPath);
+ }
+
+ $self->{preparedBootloaderConfigFolder} = 1;
+
+ return 1;
+}
+
sub _pickSystemWithNewestKernel
{
my $self = shift;
@@ -168,7 +181,7 @@ sub _createImage
# copy static data and init script
my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot-cd";
- slxsystem(qq{rsync -rlpt $dataDir/ "$imageDir/"})
+ slxsystem(qq{rsync -rlpt $dataDir/iso "$imageDir/"})
unless $self->{'dry-run'};
# copy kernel (take the one from the given system info)
@@ -181,6 +194,16 @@ sub _createImage
my $initramfsName = qq{"$imageDir/iso/isolinux/initramfs"};
$self->_makePrebootInitRamFS($info, $initramfsName);
+ # write trivial isolinux config
+ my $isolinuxConfig = unshiftHereDoc(<<" End-of-Here");
+ DEFAULT OpenSLX
+ LABEL OpenSLX
+ SAY Now loading OpenSLX preboot environment ...
+ KERNEL vmlinuz
+ APPEND initrd=initramfs
+ End-of-Here
+ spitFile("$imageDir/iso/isolinux/isolinux.cfg", $isolinuxConfig);
+
my $mkisoCmd = unshiftHereDoc(<<" End-of-Here");
mkisofs
-o "$imageDir/../$client->{name}.iso"
@@ -199,7 +222,7 @@ sub _createImage
die _tr("unable to create ISO-image - log follows:\n%s", $log);
}
- rmtree($imageDir);
+# rmtree($imageDir);
return 1;
}
diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm
index 72d9087d..b5714cdd 100644
--- a/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm
+++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/PrebootCD.pm
@@ -39,6 +39,7 @@ sub _collectCMDs
$self->_writeSlxSystemConf();
$self->_copyUclibcRootfs();
+ $self->_copyInit();
$self->{distro}->applyChanges($self);
@@ -100,4 +101,14 @@ sub _copyUclibcRootfs
return 1;
}
+sub _copyInit
+{
+ my $self = shift;
+
+ my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/preboot-cd";
+ $self->addCMD("cp $dataDir/init $self->{'build-path'}/");
+
+ return 1;
+}
+
1;
diff --git a/boot-env/preboot-cd/init b/boot-env/preboot-cd/init
index e8d42e27..e25c8607 100755
--- a/boot-env/preboot-cd/init
+++ b/boot-env/preboot-cd/init
@@ -102,20 +102,11 @@ for opts in ${KCMDLINE} ; do
# ... or a specified debug level (will be passed to next stage)
debug=*)
DEBUGLEVEL=${opts#debug=};;
- nbd)
- type=nbd
- file=irfsnbd;;
- nfs)
- type=nfs
- file=irfsnfs;;
- dnbd2)
- type=dnbd2
- file=irfsd2;;
esac
done
-# at this point a timer should be started 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 SLX
+# init does not succeed (e.g. missing kernel module for the network adaptor)
if [ "${DEBUGLEVEL}" -gt 0 ] ; then
cat<<EOF > /bin/watchdog
#!/bin/ash
@@ -142,7 +133,7 @@ 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."
-# start udhcpc, if no lease could be optained, start debug shell
+# 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
@@ -157,10 +148,10 @@ ip route add default via $router
# 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 ($type) from the net ..."
+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/iramfs \
+wget -q -c -O /tmp/initramfs \
ftp://openslx:OpenS1X@archive.ruf.uni-freiburg.de/$file 2>/dev/null ) || \
/bin/ash
@@ -174,6 +165,7 @@ fi
# start the new kernel with initialramfs and cmdline
echo "Booting OpenSLX client ..."
-kexec -l /tmp/kernel --initrd=/tmp/iramfs --append="ip=$ip:$siaddr:$router:$subnet\
+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