summaryrefslogtreecommitdiff
path: root/packages/altboot/files/altboot.func
diff options
context:
space:
mode:
authorMike Westerhof <mwester@dls.net>2006-03-30 15:40:42 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-03-30 15:40:42 +0000
commitb95d798344767600d151f34ee898f668ef704f26 (patch)
tree926655cfae9f9b48aeabec271456d4dc4ef20f37 /packages/altboot/files/altboot.func
parentbef8adcd76891ad360f7fedaf3f4c433cf6c409f (diff)
parentb06947117d509732650abe04637a85953e28a645 (diff)
merge of 7b6a90f4a303bd10227810719197dec0ab049efe
and fb0a7d68e12187b6fa7e65a6685bd6a7244b9484
Diffstat (limited to 'packages/altboot/files/altboot.func')
-rw-r--r--packages/altboot/files/altboot.func36
1 files changed, 31 insertions, 5 deletions
diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func
index c6af50a008..4389ff4ff8 100644
--- a/packages/altboot/files/altboot.func
+++ b/packages/altboot/files/altboot.func
@@ -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