From c6b758e562a15c23c991ce783a9f0b9dbb527601 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Fri, 15 Dec 2006 00:39:48 +0000 Subject: Added new busybox in new place (tools, Makefile, ...) Busybox has modified switch_root (same as for run-init ...) Updated mkdxsinitrd for busybox usage (same has to be done for slxmkramfs when tested properly) Minor fixes ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@536 95ad53e4-c205-0410-b2fa-d234c58c8868 --- Makefile | 7 +++++-- initramfs/initrd-stuff/etc/functions | 6 +++--- initramfs/initrd-stuff/init | 6 ++++-- initramfs/mkdxsinitrd | 20 ++++++++++---------- tools/busybox | Bin 0 -> 321920 bytes tools/unionfs-run-init | 15 +++++++++++++++ 6 files changed, 37 insertions(+), 17 deletions(-) create mode 100755 tools/busybox diff --git a/Makefile b/Makefile index 6fdd61b8..c9c790b7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # Dirk von Suchodoletz , 2006 # Michael Janczyk, 2006 # -# (c) 2006 - OpenSLX.com +# (c) 2006 - OpenSLX.ORG Project # the following defaults should be filled via 'configure' # and each of them can be overriden by setting the environment variable @@ -113,6 +113,7 @@ supported."; \ -p $(SLX_BIN_PATH) \ -p $(SLX_SHARE_PATH)/templates \ -p $(SLX_SHARE_PATH)/initramfs \ + -p $(SLX_SHARE_PATH)/busybox \ -p $(SLX_PRIVATE_PATH)/config/default/initramfs \ -p $(SLX_PRIVATE_PATH)/config/default/rootfs \ -p $(SLX_PRIVATE_PATH)/db \ @@ -150,6 +151,7 @@ supported."; \ tar -xp -C $(SLX_SHARE_PATH) @cd theming; tar --exclude=.svn -cp * | \ tar -xp -C $(SLX_SHARE_PATH)/themes; cd .. + @cp tools/busybox $(SLX_SHARE_PATH)/busybox @# create pre-/postinit scripts for us in initramfs: @echo -e "#!/bin/sh\n#\n# This script allows the local admin to \ @@ -191,7 +193,8 @@ functions via\n# inclusion: '. /etc/functions' ..." \ @ln -sf $(SLX_BIN_PATH)/slxversion $(USR_BIN_PATH)/ vmware_install: - @# we should read the config file here!! + @# we should read the config file here or better have a separate + @# script for installing vmware related stuff @echo "Installing VMware files to $(SLX_VMWARE_PATH)" @mkdir -p $(SLX_VMWARE_PATH)/templ \ -p $(SLX_VMWARE_PATH)/vmsessions/kdm diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 75af6c29..b27dfc66 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -2,7 +2,7 @@ # (included by init, hwautocfg, servconfig, ... within OpenSLX initial # ramfs) # -# Dirk von Suchodoletz , 14-12-2006 +# Dirk von Suchodoletz , 15-12-2006 # Felix Endres, 30-04-2006 # (xenbr), 12-12-2006 # Tobias Maier @@ -318,7 +318,7 @@ case $mnt in portmap || { echo "$error_portm"; ret=1; } # fixme: busybox mount uses nfs ... mount -n -t nfs -o ro,nolock $nfsroot $dest || ret=1 - killall -9 portmap + killall -9 portmap 2>/dev/null ;; none) error "$error_mntt" @@ -406,7 +406,7 @@ command line)." >> /etc/machine-setup [ -n $vci ] && vci="-V $vci" testmkd /usr/share/udhcpc ln -s /bin/dhcpmkconfig /usr/share/udhcpc/default.script - udhcpc -b -q $vci -s /usr/share/udhcpc/default.script -i eth0 + udhcpc -b -q $vci -s /usr/share/udhcpc/default.script -i eth0 2>/dev/null ;; *) ;; diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 097e8c15..b5630bdc 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -2,7 +2,7 @@ # main script for new type of initial ramdisk for OpenSLX linux diskless # clients version 4 # -# Dirk von Suchodoletz , 02-12-2006 +# Dirk von Suchodoletz , 15-12-2006 # (xenbr), 27-09-2006 # # (c) 2006 - RZ Universitaet Freiburg @@ -535,7 +535,7 @@ waitfor /tmp/hwcfg 20000 || error "$init_errhw" waitfor /tmp/svcfg 20000 || error "$init_errsw" # IP configuration is made and should not be updated automatically, udevd # should be killed if started within init -killall -9 dhcpcd dhclient pump 2>/dev/null +killall -9 dhcpcd dhclient pump udhcpc 2>/dev/null cp /etc/machine-setup /mnt/etc # post init for some distro specific (fixme!! more elegant solution) @@ -577,3 +577,5 @@ unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \ #strinstr "bash" "$(ls -la /bin/sh)" && EE="-c" # new style of pivoting (exec -c would set an empty environment in bash) exec run-init -c dev/console /mnt /sbin/init || error "$init_runinit" +# run-init could be replaced with switch_root from busybox ... +#exec switch_root -c dev/console /mnt /sbin/init || error "$init_runinit" diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd index e79f7f6a..66979dc7 100755 --- a/initramfs/mkdxsinitrd +++ b/initramfs/mkdxsinitrd @@ -4,7 +4,7 @@ # ramdisks for linux diskless clients (stage2 system # setup) # -# Author(s): Dirk von Suchodoletz , 14-12-2006 +# Author(s): Dirk von Suchodoletz , 15-12-2006 # Nico Dietrich # Felix Endres # (xenbr), 12-12-2006 @@ -197,8 +197,8 @@ else # ugly hack for creating a general slx config file instead of "patching" # the stage3 init echo -e "slxconf_date=${DATE}\nslxconf_kernver=${KERNVER}\nslxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro=${DISTRO}-${DISTRO_VER}" > ${INSTDIR}/etc/sysconfig/slxconfig - [ -x busybox -a "$use_busybox" = 1 ] && sed -e "s,^#!/bin/sh,#!/bin/ash," \ - -i ${INSTDIR}/${FILENAME} + [ "$use_busybox" = 1 ] && sed -e "s,^#!/bin/sh,#!/bin/ash," \ + -i ${INSTDIR}/${FILENAME} fi fi } @@ -490,13 +490,13 @@ mknod ${INSTDIR}/tmp/bootsplash p &>/dev/null # test for the existance of busybox if [ "$use_busybox" = 1 ]; then - [ -x busybox ] || { + [ -x ${SLX_SHARE_PATH}/busybox/busybox ] || { unset use_busybox echo "You wanted to include busybox, but did not provide it in \ initrd/ directory."; } fi if [ -n "$use_busybox" ] ; then - cp busybox ${INSTDIR}/bin + cp ${SLX_SHARE_PATH}/busybox/busybox ${INSTDIR}/bin for bbins in [ arping ash cat chmod chown chroot cp date \ dd df dmesg echo expr fdisk free hwclock insmod ip \ kill killall ln ls lsmod mkdir mke2fs mkfs.ext2 \ @@ -551,13 +551,13 @@ else done cobi $tftp bin || echo "Program ${tftp} not found" cp /lib/libnss_files.so.2 ${INSTDIR}/lib + # one of the dhcp clients + for dhcp in dhclient dhcpcd pump ipconfig ; do + binfinder $dhcp && break; + done + cobi $dhcp bin fi -# one of the dhcp clients -for dhcp in dhclient dhcpcd pump ipconfig ; do - binfinder $dhcp && break; -done -cobi $dhcp bin mkdir -p ${INSTDIR}/var/{lib,run} # type of hotplug/udev/dev (for etc directories see above!!) diff --git a/tools/busybox b/tools/busybox new file mode 100755 index 00000000..ca196c13 Binary files /dev/null and b/tools/busybox differ diff --git a/tools/unionfs-run-init b/tools/unionfs-run-init index af09bf00..01d71b74 100644 --- a/tools/unionfs-run-init +++ b/tools/unionfs-run-init @@ -22,3 +22,18 @@ drunterliegende Rootfs ... Laengeres Rumprobieren und nun scheint es erstmal zu klappen. Zur Zeit checkt der einfach nur (bis ich das raus hatte :-)) ob ein "/rorootfs" da ist und verschiebt das dann. Wenn nicht, bleibts so wie vorher. + +Gilt auch fuer busybox: + + // Overmount / with newdir and chroot into it. The chdir is needed to + // recalculate "." and ".." links. And check for UnionFS specific +dir. + + if ( !lstat("/rorootfs", &st1 ) ) + if ( mount("/rorootfs", "/", NULL, MS_MOVE, NULL) ) + bb_error_msg_and_die("moving rorootfs"); + + + if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || +chdir("/")) + bb_error_msg_and_die("moving root"); -- cgit v1.2.3-55-g7522