summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Hentges <oe@hentges.net>2006-01-24 11:37:57 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-01-24 11:37:57 +0000
commit378aacc1ff39a0fc6010bfe06b126108ec904283 (patch)
treeaee20523b2d3a4ac7a1fcf57ed5fbafd9b648007
parentfc1aee6b0d22286c48bb025c8d47faa8b93d96c6 (diff)
altboot:
- Reworked moving old mountpoints into the new rootfs - Optimized pivot_root'ing
-rw-r--r--packages/altboot/altboot.bb4
-rw-r--r--packages/altboot/files/altboot.func58
-rw-r--r--packages/altboot/files/init.altboot2
3 files changed, 27 insertions, 37 deletions
diff --git a/packages/altboot/altboot.bb b/packages/altboot/altboot.bb
index 3d1ca8216a..8912cc1bec 100644
--- a/packages/altboot/altboot.bb
+++ b/packages/altboot/altboot.bb
@@ -1,4 +1,4 @@
-DESCRIPTION = "A text-based bootmanager allowing a Zaurus to boot from SD or CF. \
+DESCRIPTION = "A text-based bootmanager allowing a Zaurus to boot from SD, CF, USB-Storage and NFS. \
Tested machines: Collie, Poodle, Akita, Spitz"
SECTION = "base"
PRIORITY = "optional"
@@ -6,7 +6,7 @@ MAINTAINER = "Matthias 'CoreDump' Hentges <oe@hentges.net>"
LICENSE = "GPL"
-PR = "r12"
+PR = "r13"
SRC_URI = "file://altboot-menu \
diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func
index 1c21a5f2f8..e1196ecc7f 100644
--- a/packages/altboot/files/altboot.func
+++ b/packages/altboot/files/altboot.func
@@ -67,30 +67,7 @@ pivot_realfs() {
mount -o remount,ro /
- echo -n "Pivoting root..."
- if (/sbin/pivot_root $1 $1/media/ROM)
- then
- echo "Success"
-
- # Interestingly, this doesn't work with the "real" mount
- # Without this command, /dev would be mounted under /media/ROM/dev after pivoting root
- /bin/busybox mount -o move /media/ROM/dev /dev
-
- cd /
-
- # Boot /sbin/init if it is available or use /sbin/init.sysvinit instead
- if test -x $/sbin/init
- then
- echo "Calling INIT [/sbin/init $RL]"
- exec /usr/sbin/chroot . /sbin/init $RL >/dev/tty0 2>&1
- else
- echo "Calling INIT [$REAL_INIT $RL]"
- exec /usr/sbin/chroot . $REAL_INIT $RL >/dev/tty0 2>&1
- fi
- else
- echo "FAILED"
- die "* * * pivot_root failed! * * *"
- fi
+ do_pivot "$1" "$RL"
}
# This function loop-mounts an image-file and pivot_root's into it
@@ -153,12 +130,17 @@ pivot_image() {
fi
# If mount fails it has the tendency to spew out a _lot_ of error messages.
# We direct the output to /dev/null so the user can see which step actually failed.
- mount -t $IMAGE_TYPE /dev/loop0 /media/image >/dev/null 2>&1 || die "mount -t $IMAGE_TYPE /dev/loop0 /media/image failed!"
+ mount -t $IMAGE_TYPE /dev/loop0 /media/image >/dev/null 2>&1 || die "mount -t $IMAGE_TYPE /dev/loop0 /media/image failed!"
mkdir -p /media/image/media/ROM || die "mkdir -p /media/image/media/ROM failed"
+ do_pivot /media/image "$RL"
+}
+
+#$1=mountpoint of the soon-to-be rootfs, $2=Runlevel
+do_pivot(){
echo -n "Pivoting root..."
- if (/sbin/pivot_root /media/image /media/image/media/ROM)
+ if (/sbin/pivot_root "$1" "$1/media/ROM")
then
echo "Success"
@@ -169,18 +151,28 @@ pivot_image() {
# Move mountpoints from the old rootfs into the new one.
# The *real* mount is kinda touchy feely about that
- /bin/busybox mount -o move /media/ROM$1 $1
- /bin/busybox mount -o move /media/ROM/dev /dev
- /bin/busybox mount -o move /media/ROM/proc /proc >/dev/null 2>&1
+ /bin/busybox mount -o move /media/ROM/proc /proc >/dev/null 2>&1
+ for mpt in ` mount | grep "/media/ROM/" | awk '{print $3}'`
+ do
+ new_mpt="`echo "$mpt" | sed -n "s/\/media\/ROM//p"`"
+
+ echo "Moving mountpoint [$mpt] -> [$new_mpt]" >/dev/tty0 2>&1
+
+ ! test -d "$new_mpt" && mkdir -p "$new_mpt"
+ /bin/busybox mount -o move "$mpt" "$new_mpt"
+ done
+
echo "Calling INIT"
- exec /usr/sbin/chroot . /sbin/init $RL >/dev/tty0 2>&1
+
+ #read junk
+
+ exec /usr/sbin/chroot . /sbin/init $2 >/dev/tty0 2>&1
else
echo "FAILED"
die "* * * pivot_root failed! * * *"
fi
-
}
# This functions configures the master password for altboot if none is set
@@ -188,11 +180,9 @@ set_password() {
mount -o remount,rw /
if test -z "$MASTER_PASSWORD"
then
- echo -e "\nAltboot is a boot-manager which allows to boot from SD,\nCF and NFS"
+ echo -e "\nAltboot is a boot-manager which allows to boot from SD,\nCF, USB-Storage and NFS"
echo -e "\nFor security reasons altboot requires a password\nto boot into init=/bin/sh."
echo -e "${C_RED}This is *not* your root password!\nIt is used by altboot alone!${C_RESET}\n"
- #echo -e "${C_BLUE}\nNote:\tThe password will be echoed to the screen\n\tand it will be asked twice for confirmation.${C_RESET}"
- #echo -e "\nPlease enter a new master password:\n"
while true
do
diff --git a/packages/altboot/files/init.altboot b/packages/altboot/files/init.altboot
index 5bc833d2b1..7304ee4da1 100644
--- a/packages/altboot/files/init.altboot
+++ b/packages/altboot/files/init.altboot
@@ -8,7 +8,7 @@
test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
CURRENT_ENV="`set`"
-VERSION="0.0.3"
+VERSION="0.0.4"
# Set some defaults in case altboot.cfg is missing
REAL_INIT="/sbin/init.sysvinit"