From fb1cee2982dbd566111e6dcd5766b7721583513b Mon Sep 17 00:00:00 2001 From: Mike Westerhof Date: Sun, 24 Aug 2008 23:49:44 +0000 Subject: SlugOS 5 - replace "mount -U" with "mount UUID=" which works with both mount and busybox mount; also update boot/disk script to ensure that some key devices exist in the new /dev which will enable booting to a virgin nfsroot. --- packages/slugos-init/files/boot/disk | 9 +++++---- packages/slugos-init/files/functions | 13 +++++++++++++ packages/slugos-init/files/turnup | 6 +++--- packages/slugos-init/slugos-init_5.0.bb | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/slugos-init/files/boot/disk b/packages/slugos-init/files/boot/disk index d47be54c37..63370ce340 100644 --- a/packages/slugos-init/files/boot/disk +++ b/packages/slugos-init/files/boot/disk @@ -38,12 +38,13 @@ then # is attempted. if test -n "$UUID" && mount "$@" UUID="$UUID" /mnt || - mount "$@" -U "$UUID" /mnt || mount "$@" "$device" /mnt then - # checkmount checks for sh, chroot, init - # and /mnt (i.e. /mnt/mnt in this case) - if checkmount /mnt + # checkmount checks for sh, chroot, init, /dev + # and /mnt (i.e. /mnt/mnt in this case). + # minimaldevnodes checks (and creates if required) + # a few mandatory /dev nodes we may need. + if checkmount /mnt && minimaldevnodes /mnt then # pivot to /initrd if available, else /mnt cd / diff --git a/packages/slugos-init/files/functions b/packages/slugos-init/files/functions index 18f4009ee7..5b6b40b091 100644 --- a/packages/slugos-init/files/functions +++ b/packages/slugos-init/files/functions @@ -173,6 +173,7 @@ checkmount(){ # basic test for init (the kernel will try to load this) # but require a shell in bin/sh too test \( -d "$1/mnt" \) -a \ + \( -d "$1/dev" \) -a \ \( -x "$1/bin/sh" -o -h "$1/bin/sh" \) -a \ \( -x "$1/usr/sbin/chroot" -o -h "$1/usr/sbin/chroot" -o \ -x "$1/sbin/chroot" -o -h "$1/sbin/chroot" \) -a \ @@ -181,6 +182,18 @@ checkmount(){ -x "$1/bin/init" -o -h "$1/bin/init" \) } # +# minimaldevnodes "mountpoint" +# tests an already mounted mountpoint to see if a very minimal +# set of devices exists or can be created in dev, and returns +# failure if not. This is required for booting to an nfsroot +# with an empty dev directory, as commonly occurs when the rootfs +# is created from a tar.gz image. This is also required for mdev. +minimaldevnodes(){ + [ -c "$1/dev/console" ] || mknod -m 600 "$1/dev/console" c 5 1 || return 1 + [ -c "$1/dev/null" ] || mknod -m 666 "$1/dev/null" c 1 3 || return 1 + return 0 +} +# # swivel "new root" "old root" # NOTE: the arguments must be paths relative to /, bad things # will happen if the arguments themselves start with / diff --git a/packages/slugos-init/files/turnup b/packages/slugos-init/files/turnup index 4aa1fba3ed..2bbc9024ef 100644 --- a/packages/slugos-init/files/turnup +++ b/packages/slugos-init/files/turnup @@ -578,7 +578,7 @@ disk() { fso="$(fsoptions "$@")" if if test -n "$uuid" then - mount "$@" UUID="$uuid" "$new" || mount "$@" -U "$uuid" "$new" + mount "$@" UUID="$uuid" "$new" else mount "$@" "$device" "$new" fi @@ -591,7 +591,7 @@ disk() { if test -n "$fst" && if test -n "$uuid" then - mount -t "$fst" -o "$fso" UUID="$uuid" "$new" || mount -t "$fst" -o "$fso" -U "$uuid" "$new" + mount -t "$fst" -o "$fso" UUID="$uuid" "$new" else mount -t "$fst" -o "$fso" "$device" "$new" fi @@ -633,7 +633,7 @@ disk() { then echo " options used: -t $fst -o $fso [error in this script]" >&2 test -n "$uuid" && - echo " uuid: $uuid (passed with UUID= or -U)" >&2 + echo " uuid: $uuid (passed with UUID=)" >&2 fi fi diff --git a/packages/slugos-init/slugos-init_5.0.bb b/packages/slugos-init/slugos-init_5.0.bb index 9c50cd61f6..92ac7e30f3 100644 --- a/packages/slugos-init/slugos-init_5.0.bb +++ b/packages/slugos-init/slugos-init_5.0.bb @@ -4,7 +4,7 @@ PRIORITY = "required" LICENSE = "GPL" DEPENDS = "base-files devio" RDEPENDS = "busybox devio" -PR = "r0" +PR = "r1" SRC_URI = "file://boot/flash \ file://boot/disk \ -- cgit v1.2.3 From 36c64170765ecb2b2437e9b58d9ff5e262b186a8 Mon Sep 17 00:00:00 2001 From: Mike Westerhof Date: Mon, 25 Aug 2008 06:23:27 +0000 Subject: SlugOS 5.0 - slugos-init: update to make nfs boot work correctly; cleanup of kexec stuff (although kexec won't work with the current kernel yet). --- packages/slugos-init/files/boot/kexec | 3 --- packages/slugos-init/files/boot/network | 12 ++++++++++-- packages/slugos-init/slugos-init_5.0.bb | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/slugos-init/files/boot/kexec b/packages/slugos-init/files/boot/kexec index dd757fd771..a60be03142 100644 --- a/packages/slugos-init/files/boot/kexec +++ b/packages/slugos-init/files/boot/kexec @@ -91,7 +91,6 @@ if [ -n "$1" -a -n "$2" ] ; then t=`basename "$kpath"` kexec_image="/mnt/$t" fi - umount /sys fi ;; @@ -105,7 +104,6 @@ if [ -n "$1" -a -n "$2" ] ; then t=`basename "$kpath"` kexec_image="/mnt/$t" fi - umount /sys fi ;; @@ -143,7 +141,6 @@ if [ -n "$1" -a -n "$2" ] ; then echo "Loading kexec kernel using tftp \"$kpath\"..." tftp -g -l "$kexec_image" -r "${kpath#*:}" "${kpath%%:*}" fi - umount /sys fi ;; diff --git a/packages/slugos-init/files/boot/network b/packages/slugos-init/files/boot/network index 8124f19ab2..48aa9dd7d5 100644 --- a/packages/slugos-init/files/boot/network +++ b/packages/slugos-init/files/boot/network @@ -24,8 +24,12 @@ ifconfig lo 127.0.0.1 up iface="$(config iface)" test -z "$iface" && exit 1 # -# Fire up a process in the background to load the firmware if necessary -sysf="/sys/class/firmware/firmware-$iface" +# Fire up a process in the background to load the firmware if necessary. +# If this system doesn't require the NPE-B firmware, no problem, the +# background process will simply go away in two seconds. If it requires +# some other firmware, then modification will be required. We probably +# should replace this with mdev or some other hotplug-based technique... +sysf="/sys/class/firmware/$iface" ( # Wait for the firware to be requested, if required [ -f $sysf/loading ] || sleep 1 @@ -39,5 +43,9 @@ sysf="/sys/class/firmware/firmware-$iface" # Trigger the firmware load proactively ifconfig "$iface" up # +# Unmount /sys and /proc before we leave +umount /sys +umount /proc +# ifup "$iface" # exit code is true only if the interface config has succeeded diff --git a/packages/slugos-init/slugos-init_5.0.bb b/packages/slugos-init/slugos-init_5.0.bb index 92ac7e30f3..9b7c2cd8d0 100644 --- a/packages/slugos-init/slugos-init_5.0.bb +++ b/packages/slugos-init/slugos-init_5.0.bb @@ -4,7 +4,7 @@ PRIORITY = "required" LICENSE = "GPL" DEPENDS = "base-files devio" RDEPENDS = "busybox devio" -PR = "r1" +PR = "r1.2" SRC_URI = "file://boot/flash \ file://boot/disk \ -- cgit v1.2.3