From 4fca608b84d4bc1c5abe78cb5956ff17c924e2c2 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Fri, 20 Jan 2006 10:31:01 +0000 Subject: Boot.ld als erstes Runlevelskript (per distro-spez. Funktion). git-svn-id: http://svn.openslx.org/svn/openslx/dxs/ld4@27 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../distro-specs/suse-10.0/files/etc/init.d/boot | 7 ------ initrd/distro-specs/suse-10.0/functions-suse-10.0 | 20 ++++++++++++++++ initrd/distro-specs/ubuntu/functions-ubuntu | 27 +++++++++++++++++++--- initrd/initrd-stuff/bin/servconfig | 4 +++- initrd/initrd-stuff/init | 4 +++- initrd/mkdxsinitrd | 16 ++++++------- 6 files changed, 58 insertions(+), 20 deletions(-) diff --git a/initrd/distro-specs/suse-10.0/files/etc/init.d/boot b/initrd/distro-specs/suse-10.0/files/etc/init.d/boot index 6db53181..f975046f 100755 --- a/initrd/distro-specs/suse-10.0/files/etc/init.d/boot +++ b/initrd/distro-specs/suse-10.0/files/etc/init.d/boot @@ -74,13 +74,6 @@ if [ -d /sys ] ; then done < /proc/filesystems fi -# script stuff written within initrd -if [ -s /etc/init.d/boot.ld ] ; then - rc_reset - echo -n "Running post configuration required by initrd" - chmod u+x /etc/init.d/boot.ld && /etc/init.d/boot.ld - rc_status -v -r -fi # Start blogd, requires /proc and /dev/pts. # Export the real device in variable REDIRECT. test -x /sbin/blogd -a -n "$REDIRECT" && /sbin/blogd $REDIRECT diff --git a/initrd/distro-specs/suse-10.0/functions-suse-10.0 b/initrd/distro-specs/suse-10.0/functions-suse-10.0 index ed033707..3016d222 100644 --- a/initrd/distro-specs/suse-10.0/functions-suse-10.0 +++ b/initrd/distro-specs/suse-10.0/functions-suse-10.0 @@ -360,3 +360,23 @@ if [ "x$start_dreshal" = "xyes" ]; then fi } +# initialize boot.ld - skript to be executed during early system startup +# (before most of the normal boot init scripts) +# this script should operate like a normal runlevel script +d_bootld () { +case "$1" in + init) + echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/boot.ld written \ +from $0" >/mnt/etc/${D_INITDIR}/boot.ld + echo -e '\n\n. /etc/rc.status\nrc_reset\ncase "$1" in start)' \ + >>/mnt/etc/${D_INITDIR}/boot.ld + echo -e '\techo -n "Running post configuration required by initrd"' \ + >>/mnt/etc/${D_INITDIR}/boot.ld + ;; + close) + echo -e "\trc_status -v\n\t;;\n stop)\n\t;;esac\nrc_exit" \ + >>/mnt/etc/${D_INITDIR}/boot.ld + + ;; +esac +} diff --git a/initrd/distro-specs/ubuntu/functions-ubuntu b/initrd/distro-specs/ubuntu/functions-ubuntu index 4344ac96..47826957 100644 --- a/initrd/distro-specs/ubuntu/functions-ubuntu +++ b/initrd/distro-specs/ubuntu/functions-ubuntu @@ -2,9 +2,9 @@ # linux diskless clients (executed within initial # ramdisk after genconfig) # -# Author(s): Dirk von Suchodoletz , 18-01-2006 -# Blabla -# Blub +# Author(s): Dirk von Suchodoletz , 20-01-2006 +# Nico Dietrich +# Felix Endres # # Copyright: (c) 2006 - RZ Universitaet Freiburg # @@ -200,3 +200,24 @@ if [ "x$start_dreshal" = "xyes" ]; then echo >/dev/null fi } + +# initialize boot.ld - skript to be executed during early system startup +# (before most of the normal boot init scripts) +# this script should operate like a normal runlevel script (fixme!!) +d_bootld () { +case "$1" in + init) + echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/boot.ld written \ +from $0" >/mnt/etc/${D_INITDIR}/boot.ld + echo -e '\n\ncase "$1" in start)' \ + >>/mnt/etc/${D_INITDIR}/boot.ld + echo -e '\techo -n "Running post configuration required by initrd"' \ + >>/mnt/etc/${D_INITDIR}/boot.ld + ;; + close) + echo -e "\t;;\n stop)\n\t;;esac\nexit 0" \ + >>/mnt/etc/${D_INITDIR}/boot.ld + + ;; +esac +} diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 11b13998..bff7518e 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -99,7 +99,9 @@ case ${DISTRO} in rm -f /mnt/etc/$i/* done count=10 - for i in ${D_INITSCRIPTS}; do + # boot.ld is a special runlevel script generated within initial ramdisk + # which should be executed before the rest + for i in boot.ld ${D_INITSCRIPTS}; do count=`expr $count + 1` revcnt=`expr 41 - $count` ln -sf /etc${D_INITDIR}/$i /mnt/etc/init.d/${SUSESPECIFICSUBDIR}S${count}$i diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 3654c51c..9247e539 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -294,7 +294,7 @@ else # run some specific stuff !? fi # script for stuff to execute during early bootup -echo -e "#!/bin/sh\n# skeleton written from $0" >/mnt/etc/${D_INITDIR}/boot.ld +d_mkbootld init echo "fs complete" >/tmp/fscmpl # write debug file information after filesystem setup completed @@ -353,6 +353,8 @@ killall -9 dhcpcd dhclient pump 2>/dev/null # unmount the bind mounted modules directory umount -n /lib/modules/${KERNEL} || error "Unmount of the kernel \ modules directory failed for some reason." +# close script for stuff to execute during early bootup +d_mkbootld close # reset hotplug echo "/sbin/hotplug" > /proc/sys/kernel/hotplug echo "" diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 0ab53431..9bec513b 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -183,9 +183,9 @@ while getopts :hgk:i:r:o:s:f:n:Sut:d:I:V:a: a ; do ;; i) echo "-i requires initrd path parameter" ;; - f) echo "-m requires file system module list parameter" + f) echo "-f requires file system module list parameter" ;; - n) echo "-m requires network module list parameter" + n) echo "-n requires network module list parameter" ;; r) echo "-r requires root dir parameter" ;; @@ -273,15 +273,15 @@ fi if [ -z $DISTRO ] ; then if [ -e ${ROOTDIR}/etc/SuSE-release ] ; then - DISTRO = suse - DISTRO_VER = grep "VERSION" /etc/SuSE-release | sed "s/.*= //" + DISTRO=suse + DISTRO_VER=`grep "VERSION" /etc/SuSE-release | sed "s/.*= //"` fi fi if [ -z $DISTRO ] ; then if [ -e ${ROOTDIR}/etc/debian-version ] ; then - DISTRO = debian - DISTRO_VER = `cat ${ROOTDIR}/etc/debian-version` + DISTRO=debian + DISTRO_VER=`cat ${ROOTDIR}/etc/debian-version` fi fi @@ -393,10 +393,10 @@ done # add kernel modules and dependency files if [ -z $KERNVER ] ; then - KERNVER = `ls -l ${ROOTDIR}/boot/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//"` + KERNVER=`ls -l ${ROOTDIR}/boot/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//"` fi if [ -z $KERNVER ] ; then - KERNVER = `ls -l ${ROOTDIR}/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//"` + KERNVER=`ls -l ${ROOTDIR}/vmlinuz | grep vmlinuz | sed "s/.*vmlinuz-//"` fi #KERNVER=2.6.12-10-386 -- cgit v1.2.3-55-g7522