From: John Bowler Date: Tue, 31 Jan 2006 09:29:38 +0000 (+0000) Subject: slugos-init: make /linuxrc use disk uuids, remove .recovery stuff in 0.10 X-Git-Tag: Release-2010-05/1~9453^2~2488 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=533477718ce901a426158a41691b16f5f6db9e76;p=openembedded.git slugos-init: make /linuxrc use disk uuids, remove .recovery stuff in 0.10 - the /boot/disk bootstrap now mounts -U uuid if one is available from turnup. turnup checks disk for blkids and no longer complains about .recovery, /boo/* no longer create .recovery or check for it on boot; disconnect the disk or the network to boot to flash on a semi broken system. --- diff --git a/packages/slugos-init/files/boot/disk b/packages/slugos-init/files/boot/disk index f603d0f711..6077a92ffe 100644 --- a/packages/slugos-init/files/boot/disk +++ b/packages/slugos-init/files/boot/disk @@ -15,15 +15,19 @@ if test -n "$1" then device="$1" shift - echo "boot: rootfs: mount $* $device" + echo "boot: rootfs: mount $* $device [$UUID]" # # wait if required test "$sleep" -gt 0 && sleep "$sleep" # # Mount read-write because before exec'ing init - # this script creates the '.recovery' link to - # detect failed boot. No file type is given to - if mount "$@" "$device" /mnt + # If a UUID is given (in the environment) this + # is used in preference to the device, but if + # the UUID mount fails a standard device mount + # is attempted. + if test -n "$UUID" && + mount "$@" -U "$UUID" /mnt || + mount "$@" "$device" /mnt then # checkmount checks for sh, init and no # .recovery plus either mnt or initrd diff --git a/packages/slugos-init/files/functions b/packages/slugos-init/files/functions index d7e5c9905a..d631579966 100644 --- a/packages/slugos-init/files/functions +++ b/packages/slugos-init/files/functions @@ -155,9 +155,8 @@ checkif(){ # boot with this as root. Returns success if it appears ok. checkmount(){ # basic test for init (the kernel will try to load this) - # but require a shell in bin/sh and no .recovery too - test \( ! -f "$1/.recovery" \) -a \ - \( -d "$1/mnt" \) -a \ + # but require a shell in bin/sh too + test \( -d "$1/mnt" \) -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 \ @@ -218,7 +217,6 @@ swivel(){ echo -n 80 >/mnt/class/leds/ready/frequency echo -n 80 >/mnt/class/leds/status/frequency umount /mnt - sleep 10 >/.recovery sync;sync;sync exit 1" fi diff --git a/packages/slugos-init/files/turnup b/packages/slugos-init/files/turnup index 19c5af1745..d27648680f 100644 --- a/packages/slugos-init/files/turnup +++ b/packages/slugos-init/files/turnup @@ -88,6 +88,7 @@ get_flash() { # # check_rootfs [-i] # Make sure the candidate rootfs is empty +# Environment: rootdev=device or NFS root path check_rootfs() { local fcount @@ -100,15 +101,24 @@ check_rootfs() { fcount="$(find "$1" ! -type d -print | wc -l)" test "$fcount" -eq 0 && return 0 - echo "turnup: $1: partition contains existing files, specify -f to overwrite" >&2 + echo "turnup: $rootdev: partition contains existing files, specify -f to overwrite" >&2 return 1;; *) checkmount "$1" && return 0 - echo "turnup: $1: partition does not seem to be a valid root partition" >&2 - if test -f "$1"/.recovery - then - echo " $1/.recovery exists: fix the partition then remove it" >&2 - fi + echo "turnup: $rootdev: partition does not seem to be a valid root partition" >&2 + echo " The partition must contain a full operating system. To ensure that" >&2 + echo " this is the case it is checked for the following, all of which must" >&2 + echo " exist for the bootstrap to work:" >&2 + echo + echo " 1) A directory /mnt." >&2 + echo " 2) A command line interpreter program in /bin/sh." >&2 + echo " 3) The program chroot in /sbin or /usr/sbin." >&2 + echo " 4) The program init in /sbin, /etc or /bin." >&2 + echo + echo " One or more of these items is missing. Mount $rootdev on /mnt" >&2 + echo " and examine its contents. You can use turnup disk|nfs -i -f" >&2 + echo " to copy this operating system onto the disk, but it may overwrite" >&2 + echo " files on the disk." >&2 return 1;; esac } @@ -315,16 +325,17 @@ setup_fstab() { } # -# boot_rootfs [options] +# boot_rootfs ( |) [options] # Change the flash partition (not the current root!) to boot off # the new root file system boot_rootfs() { - local type ffs sleep device opt + local type ffs sleep device uuid opt type="$1" ffs="$2" sleep="$3" device="$4" + uuid= # test this first as the test does not depend on the correctness # of the other arguments @@ -344,7 +355,8 @@ boot_rootfs() { echo "turnup: boot_rootfs($ffs, $type, $device): expected block device" >&2 return 1 } - shift 2;; + uuid="$3" + shift 3;; nfs) shift 2;; flash) ;; ram) ;; @@ -384,6 +396,7 @@ boot_rootfs() { *) { echo '#!/bin/sh' echo 'leds beep' test "$sleep" -gt 0 && echo -n "sleep='$sleep' " + test -n "$uuid" && echo -n "UUID='$uuid' " echo -n "exec '/boot/$type' '$device'" for opt in "$@" do @@ -416,7 +429,7 @@ boot_rootfs() { # disk [-m] [-i] [-s