diff options
author | Matthias Hentges <oe@hentges.net> | 2006-04-04 12:07:29 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-04-04 12:07:29 +0000 |
commit | e21f2e5093a027058a685f09a4b9d0151bb4dafd (patch) | |
tree | 40635582f4d8f687e198f825a2e3be2318aba3a4 /packages | |
parent | be327e49437c5d3c5ac8f3f47f0274975670e434 (diff) |
altboot: - Allow a basic reconfiguration of non-flash based installations:
- Move /home from flash into the image
- Remove SD / CF / /home ipkg dests
- Move ipkg package data from RAM into the image
- All of the above is _optional_
- Be a little bit less verbose.
- Yet _again_ change the way we detect wheter we are called by the kernel or the user...this is driving me nuts.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/altboot/altboot_0.0.0.bb | 2 | ||||
-rw-r--r-- | packages/altboot/files/akita/altboot-2.6.cfg | 1 | ||||
-rw-r--r-- | packages/altboot/files/altboot-menu/Advanced/40-bootNFS | 13 | ||||
-rw-r--r-- | packages/altboot/files/altboot.func | 108 | ||||
-rw-r--r-- | packages/altboot/files/collie/altboot-2.4.cfg | 4 | ||||
-rw-r--r-- | packages/altboot/files/init.altboot | 8 | ||||
-rw-r--r-- | packages/altboot/files/poodle/altboot-2.4.cfg | 2 | ||||
-rw-r--r-- | packages/altboot/files/spitz/altboot-2.6.cfg | 1 | ||||
-rw-r--r-- | packages/altboot/files/tosa/altboot-2.4.cfg | 3 |
9 files changed, 131 insertions, 11 deletions
diff --git a/packages/altboot/altboot_0.0.0.bb b/packages/altboot/altboot_0.0.0.bb index 82314a8f22..2df0e16792 100644 --- a/packages/altboot/altboot_0.0.0.bb +++ b/packages/altboot/altboot_0.0.0.bb @@ -6,7 +6,7 @@ MAINTAINER = "Matthias 'CoreDump' Hentges <oe@hentges.net>" LICENSE = "GPL" IGNORE_STRIP_ERRORS = "1" -PR = "r33" +PR = "r34" SRC_URI = "file://altboot-menu \ diff --git a/packages/altboot/files/akita/altboot-2.6.cfg b/packages/altboot/files/akita/altboot-2.6.cfg index 69f7c8351b..c9a030b348 100644 --- a/packages/altboot/files/akita/altboot-2.6.cfg +++ b/packages/altboot/files/akita/altboot-2.6.cfg @@ -9,6 +9,7 @@ SH_SHELL="/bin/sh" IMAGE_PATH="boot-images" IMAGE_TYPE="ext2" FSCK_IMAGES="yes" +ENABLE_IMAGECONF="yes" SD_DEVICE="/dev/mmcblk0p1" SD_KERNEL_MODULE="" diff --git a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS index baa426218b..e01af7faad 100644 --- a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS +++ b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS @@ -20,11 +20,11 @@ run_module() { init_rootfs # Needed for NFS - /etc/init.d/portmap start >/dev/tty1 2>&1 || die "/etc/init.d/portmap start failed!" + /etc/init.d/portmap start >/dev/null 2>&1 || die "/etc/init.d/portmap start failed!" # For some reason NFS mounts hang if /e/i/networking is not run. # For the time beeing I'm too lazy to investigate ;) - /etc/init.d/networking start || die "/etc/init.d/networking start failed!" + /etc/init.d/networking start >/dev/null 2>&1 || die "/etc/init.d/networking start failed!" sleep 2 @@ -126,6 +126,15 @@ run_module() { mkdir -p /media/nfsroot || die "mkdir -p /media/nfsroot failed!" echo -n "Mounting NFS root..." + + if ( mount | grep -q "/media/nfsroot" ) + then + echo "/media/nfsroot already used, tying to umount..." + umount /media/image + losetup -d /dev/loop0 + umount /media/nfsroot || die "umount failed!" + fi + mount -t nfs "$selection" /media/nfsroot && echo ok || die "mount -t nfs "$selection" /media/nfsroot failed!" # Use configured resolv.conf in the pivoted rootfs diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func index 612a0243b2..0cc59116ce 100644 --- a/packages/altboot/files/altboot.func +++ b/packages/altboot/files/altboot.func @@ -93,6 +93,8 @@ pivot_realfs() { mount -o remount,ro / >/dev/null 2>&1 + test "$ENABLE_IMAGECONF" = yes && image_conf $1 + do_pivot "$1" "$RL" } @@ -152,27 +154,28 @@ pivot_image() { echo "" - echo "Using [$IMAGE_NAME]" mkdir -p /media/image || die "mkdir -p /media/image failed" - echo "Setting up loopback (/dev/loop0) for $IMAGE_NAME" losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME || die "losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME failed!" check_fs /dev/loop0 $IMAGE_TYPE - echo -e "\n* * * Booting rootfs image * * *\n" + echo -e "\n* * * Mounting rootfs image * * *\n" # Busybox's "mount" doesn't seem to like "-o loop" for some reason # It works on collie and b0rks on poodle. if [ "$IMAGE_TYPE" = "" ]; then IMAGE_TYPE="auto" 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 /dev/loop0 -t $IMAGE_TYPE /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" + test "$ENABLE_IMAGECONF" = yes && image_conf /media/image + do_pivot /media/image "$RL" } @@ -214,6 +217,105 @@ do_pivot(){ } +# $1: Path to mounted rootfs +image_conf(){ + ! test -d "$1" && die "image_conf: [$1] not found / no directory" + + test -e "$1/etc/.image_conf.done" && return + + echo -e "\n\n* * * rootfs configuration * * *\n" + echo -e "This setup lets you reconfigure your new rootfs." + echo "Most probably the rootfs is configured with" + echo "defaults based on a flash installation." + echo "If unsure, go with the defaults by pressing <ENTER>." + echo "" + + if ( cat $1/etc/fstab | grep -v "^#" | grep -q "/home " ) + then + while true + do + echo "Usually your /home directory is located on another flash partition." + echo -n "Do you want me to move /home inside the loop-image? [N|y] " + read junk + + if test "$junk" = "y" -o "$junk" = "Y" + then + cat $1/etc/fstab | sed "/.*\/home.*/s/\/home/\/home.orig/" > $1/etc/fstab_ + mv $1/etc/fstab_ $1/etc/fstab + break + fi + + test "$junk" = "" -o "$junk" = n -o "$junk" = N && break + done + + fi + + echo "" + +# if ( cat $1/etc/fstab | grep -v "^#" | grep -q "/var" ) +# then +# while true +# do +# echo "This is mainly for testing purposes." +# echo -n "Do you want to configure /var as a normal non-tmpfs directory? [N|y] " +# read junk +# +# if test "$junk" = "y" -o "$junk" = "Y" +# then +# cat $1/etc/fstab | sed "/.*\/var.*/s/\(.*\)/#\ \1/" > $1/etc/fstab_ +# mv $1/etc/fstab_ $1/etc/fstab +# break +# fi +# +# test "$junk" = "" -o "$junk" = n -o "$junk" = N && break +# done +# fi + + echo "" + + if ( cat $1/etc/ipkg.conf | grep -q ^lists_dir ) + then + while true + do + echo -e "Wasting RAM is never a good idea.\nOnly say Y if your rootfs is very small in size" + echo -n "Do you want to store ipkg package data in RAM? [N|y] " + read junk + + if test "$junk" = "" -o "$junk" = n -o "$junk" = N + then + cat $1/etc/ipkg.conf | sed "/^lists_dir.*/s/\(.*\)/#\ \1/"> $1/etc/ipkg.conf_ + mv $1/etc/ipkg.conf_ $1/etc/ipkg.conf + break + fi + + test "$junk" = "y" -o "$junk" = "Y" && break + done + fi + + echo "" + + if ( cat $1/etc/ipkg.conf | grep -q "^dest sd" ) + then + while true + do + echo -n "Do you want to keep the SD, CF and /home ipkg install targets? [N|y] " + read junk + + if test "$junk" = "" -o "$junk" = n -o "$junk" = N + then + cat $1/etc/ipkg.conf | sed "/^dest\ \(sd\|cf\|home\).*/s/\(.*\)/#\ \1/" > $1/etc/ipkg.conf_ + mv $1/etc/ipkg.conf_ $1/etc/ipkg.conf + break + fi + + test "$junk" = "y" -o "$junk" = "Y" && break + done + fi + + + touch "$1/etc/.image_conf.done" +} + # This functions configures the master password for altboot if none is set set_password() { mount -o remount,rw / diff --git a/packages/altboot/files/collie/altboot-2.4.cfg b/packages/altboot/files/collie/altboot-2.4.cfg index 9d2560f76b..bc0f9ca054 100644 --- a/packages/altboot/files/collie/altboot-2.4.cfg +++ b/packages/altboot/files/collie/altboot-2.4.cfg @@ -8,7 +8,9 @@ REAL_INIT="/sbin/init.sysvinit" SH_SHELL="/bin/sh" IMAGE_PATH="boot-images" IMAGE_TYPE="ext2" -FSCK_IMAGES="no" +FSCK_IMAGES="yes" +ENABLE_IMAGECONF="yes" + SD_DEVICE="/dev/mmcda1" SD_KERNEL_MODULE="/lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/block/sharp_mmcsd_m.o" INIT_RUNLEVEL="5" diff --git a/packages/altboot/files/init.altboot b/packages/altboot/files/init.altboot index ed95ce1c9c..22f3e86e83 100644 --- a/packages/altboot/files/init.altboot +++ b/packages/altboot/files/init.altboot @@ -283,10 +283,12 @@ wait_for_input() { } # * * * * * * This is the main function * * * * * * - -if test -f /proc/cmdline -a "$1" != "-force" +# Note: this is positivly ugly. If someone knows a better way to detect wheter +# we are already booted into a runlevel _without_ reading /var and / or using `runlevel` +# PLEASE let me know. +if test -f /proc/cmdline -a "`ps ax|wc -l|tr -d " "`" -gt 30 -a "$1" != "-force" then - echo "altboot: Using real init [$REAL_INIT] [$*] *" >/dev/tty1 + echo "altboot: Using real init [$REAL_INIT] [$*] [`ps ax|wc -l|tr -d " "`] *" >/dev/tty1 exec $REAL_INIT $* # exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 exit 0 diff --git a/packages/altboot/files/poodle/altboot-2.4.cfg b/packages/altboot/files/poodle/altboot-2.4.cfg index 9d2560f76b..c5bd17050c 100644 --- a/packages/altboot/files/poodle/altboot-2.4.cfg +++ b/packages/altboot/files/poodle/altboot-2.4.cfg @@ -16,5 +16,7 @@ NO_GUI_RL="2" MASTER_PASSWORD="" ASK_PW_ON_BOOT="no" +ENABLE_IMAGECONF="yes" + SD_MOUNTPOINT="/media/card" CF_MOUNTPOINT="/media/cf" diff --git a/packages/altboot/files/spitz/altboot-2.6.cfg b/packages/altboot/files/spitz/altboot-2.6.cfg index 69f7c8351b..c9a030b348 100644 --- a/packages/altboot/files/spitz/altboot-2.6.cfg +++ b/packages/altboot/files/spitz/altboot-2.6.cfg @@ -9,6 +9,7 @@ SH_SHELL="/bin/sh" IMAGE_PATH="boot-images" IMAGE_TYPE="ext2" FSCK_IMAGES="yes" +ENABLE_IMAGECONF="yes" SD_DEVICE="/dev/mmcblk0p1" SD_KERNEL_MODULE="" diff --git a/packages/altboot/files/tosa/altboot-2.4.cfg b/packages/altboot/files/tosa/altboot-2.4.cfg index edbaff8b87..c463ca0a43 100644 --- a/packages/altboot/files/tosa/altboot-2.4.cfg +++ b/packages/altboot/files/tosa/altboot-2.4.cfg @@ -8,7 +8,8 @@ SH_SHELL="/bin/sh" IMAGE_PATH="boot-images" IMAGE_TYPE="ext2" -FSCK_IMAGES="no" +FSCK_IMAGES="yes" +ENABLE_IMAGECONF="yes" SD_DEVICE="/dev/mmcda1" SD_KERNEL_MODULE="/lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/block/sharp_mmcsd_m.o" |