altboot: Altboot now remembers the last loop-image (or realfs),too, which allowsa...
authorMatthias Hentges <oe@hentges.net>
Wed, 29 Mar 2006 03:38:18 +0000 (03:38 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Wed, 29 Mar 2006 03:38:18 +0000 (03:38 +0000)
packages/altboot/altboot_0.0.0.bb
packages/altboot/files/altboot-menu/Advanced/40-bootNFS
packages/altboot/files/altboot.func
packages/altboot/files/init.altboot

index 4b69c50..020546d 100644 (file)
@@ -6,7 +6,7 @@ MAINTAINER = "Matthias 'CoreDump' Hentges  <oe@hentges.net>"
 LICENSE = "GPL"
 IGNORE_STRIP_ERRORS = "1"
 
-PR = "r27"
+PR = "r28"
 
 
 SRC_URI = "file://altboot-menu \
index 3a41fcc..baa4262 100644 (file)
@@ -91,7 +91,20 @@ run_module() {
                do
                        stty echo
                        echo -n "Boot NFS root: "
-                       read junk < /dev/tty1
+                       
+                       if test "$AUTOBOOT" != "yes"
+                       then
+                               read junk < /dev/tty1
+                       else
+                               if test -e /etc/.altboot-bootNFS-source.last
+                               then
+                                       junk="`cat /etc/.altboot-bootNFS-source.last`"
+                                       test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+                               else
+                                       read junk < /dev/tty1
+                               fi
+                       fi      
+                               
                        
                        cnt=1
                        for nfs_mount in $nfs_mounts
@@ -99,6 +112,7 @@ run_module() {
                                if test "$junk" = "$cnt"
                                then
                                        selection="$nfs_mount"
+                                       echo "$junk" > /etc/.altboot-bootNFS-source.last
                                fi
                                let cnt=$cnt+1
                        done                    
@@ -115,10 +129,10 @@ run_module() {
        mount -t nfs "$selection" /media/nfsroot && echo ok || die "mount -t nfs "$selection" /media/nfsroot failed!"
        
        # Use configured resolv.conf in the pivoted rootfs
-       echo -n "Copying resolv.conf..."
+       #echo -n "Copying resolv.conf..."
        #cp /etc/resolv.conf /media/nfsroot/etc && echo ok || echo "FAILED"
        
-       check_target "/media/nfsroot"
+       check_target "/media/nfsroot" bootNFS
        
 }      
 
index c6af50a..4389ff4 100644 (file)
@@ -1,6 +1,7 @@
 #! /bin/sh
 # This function checks for the presence of a real filesystem and loop-images on the target
 # $1 = folder of rootfs, $2 = runlevel (defaults to 5)
+# $2 = name of calling module
 check_target() {
        # Check if there is a /sbin/init or /sbin/init.sysvinit on the card
        if test -x $1/sbin/init -o -x $1/$REAL_INIT
@@ -31,11 +32,24 @@ check_target() {
                while test -z "$ans"
                do
                        echo -n "Your choice: "
-                       read junk < /dev/tty1
+                       
+                       if test "$AUTOBOOT" != "yes"
+                       then
+                               read junk < /dev/tty1
+                       else
+                               if test -e /etc/.altboot-$2-real-or-loop.last
+                               then
+                                       junk="`cat /etc/.altboot-$2-real-or-loop.last`"
+                                       test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+                               else
+                                       read junk < /dev/tty1
+                               fi
+                       fi      
                        
                        if test "$junk" = 1 -o "$junk" = 2
                        then
                                ans="$junk"
+                               echo "$junk" > /etc/.altboot-$2-real-or-loop.last
                        fi
                done
                
@@ -62,7 +76,7 @@ check_target() {
 # This function pivot_root's into a real filesystem calling $newrootfs/sbin/init
 # $1 = The new rootfs
 pivot_realfs() {
-       test -z "$2" && RL="5" || RL="$2"
+       #test -z "$2" && RL="5" || RL="$2"
        mkdir -p $1/media/ROM || die "mkdir -p $1/media/ROM failed"
 
        mount -o remount,ro / >/dev/null 2>&1
@@ -73,7 +87,7 @@ pivot_realfs() {
 # This function loop-mounts an image-file and pivot_root's into it
 # $1: The new rootfs
 pivot_image() {
-       test -z "$2" && RL="5" || RL="$2"
+       #test -z "$2" && RL="5" || RL="$2"
        cd $1/$IMAGE_PATH
 
        # Check for rootfs images on the card
@@ -95,7 +109,18 @@ pivot_image() {
                while test -z "$IMAGE_NAME"
                do
                        echo -en "Please choose one of the above: "
-                       read junk < /dev/tty1
+                       if test "$AUTOBOOT" != "yes"
+                       then
+                               read junk < /dev/tty1
+                       else
+                               if test -e /etc/.altboot-loopimage.last
+                               then
+                                       junk="`cat /etc/.altboot-loopimage.last`"
+                                       test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+                               else
+                                       read junk < /dev/tty1
+                               fi
+                       fi      
 
                        x=0
                        for file in `ls *rootfs.bin`
@@ -103,7 +128,8 @@ pivot_image() {
                                let x=$x+1
                                if test "$x" = "$junk"
                                then
-                                       IMAGE_NAME="$file"                                              
+                                       IMAGE_NAME="$file"
+                                       echo "$junk" > /etc/.altboot-loopimage.last                                             
                                fi
                        done    
                done
index 850912f..665b3fa 100644 (file)
@@ -183,6 +183,13 @@ run_timer() {
                        echo -n "." >/dev/tty1
                        let cnt=$cnt+1
                done
+               
+               if test "$launch_altboot" != "yes"
+               then
+                       AUTOBOOT=yes
+               else
+                       rm -f /etc/.altboot*.last
+               fi
        else
                launch_altboot=yes
        fi