altboot:
authorMatthias Hentges <oe@hentges.net>
Sat, 21 Jan 2006 12:27:25 +0000 (12:27 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sat, 21 Jan 2006 12:27:25 +0000 (12:27 +0000)
- 40-bootNFS: Copy resolv.conf from flash into pivot_root to allow working DNS
- Allowing to use altboot as init inside a pivot_root. Which means as soon as th  e new root is booted, you are presented with altboots menu again. But this ti
  me changing behaviour of the pivot_root booting sequence
- Improved detected if altboot is run by user (to switch runlevels manually) or
  kernel.
- Do not run scripts in /etc/altboot.rc if altboot is not enabled
- Add Advanced/Boot original INIT. Note: "Normal Boot" might be different than
  the real /sbin/init on some machines.

packages/altboot/altboot.bb
packages/altboot/files/altboot-menu/Advanced/40-bootNFS
packages/altboot/files/altboot-menu/Advanced/60-orig-init [new file with mode: 0644]
packages/altboot/files/altboot.func
packages/altboot/files/init.altboot

index 5fe8d22..529814a 100644 (file)
@@ -6,7 +6,7 @@ MAINTAINER = "Matthias 'CoreDump' Hentges  <oe@hentges.net>"
 LICENSE = "GPL"
  
 
-PR = "r10"
+PR = "r11"
 
 
 SRC_URI = "file://altboot-menu \
index cefc46c..b5b93a5 100644 (file)
@@ -95,6 +95,7 @@ run_module() {
                
                while test -z "$selection"
                do
+                       stty echo
                        echo -n "Boot NFS root: "
                        read junk < /dev/tty1
                        
@@ -119,6 +120,10 @@ run_module() {
        echo -n "Mounting NFS root..."
        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..."
+       cp /etc/resolv.conf /media/nfsroot/etc >/dev/null 2>&1 && echo ok || echo "FAILED"
+       
        check_target "/media/nfsroot"
        
 }      
diff --git a/packages/altboot/files/altboot-menu/Advanced/60-orig-init b/packages/altboot/files/altboot-menu/Advanced/60-orig-init
new file mode 100644 (file)
index 0000000..9f4ff78
--- /dev/null
@@ -0,0 +1,19 @@
+# !/bin/sh
+M_TITLE="Boot original INIT"
+
+
+run_module() {
+       
+       test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
+       
+       echo "altboot: Using real init [$REAL_INIT] [$INIT_RUNLEVEL] *" >/dev/tty1
+       exec $REAL_INIT $INIT_RUNLEVEL
+       exit 0  
+       
+}
+
+case "$1" in
+title) echo "$M_TITLE";;
+run)   run_module;;
+esac
+
index 7afb372..91984a8 100644 (file)
@@ -78,14 +78,14 @@ pivot_realfs() {
 
                cd /
 
-               # Boot init.sysvinit if it is available or use /sbin/init instead
-               if test -x $REAL_INIT
+               # Boot /sbin/init if it is available or use /sbin/init.sysvinit instead
+               if test -x $/sbin/init
                then
-                       echo "Calling INIT [$REAL_INIT $RL]"
-                       exec /usr/sbin/chroot . $REAL_INIT $RL >/dev/tty0 2>&1                  
-               else
-                       echo "Calling INIT [/sbin/init $RL]"                    
+                       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"
index b1d0704..81656fc 100644 (file)
@@ -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.2"
+VERSION="0.0.3"
 
 # Set some defaults in case altboot.cfg is missing
 REAL_INIT="/sbin/init.sysvinit"
@@ -141,7 +141,6 @@ show_sub_menu() {
 run_timer() {
        if test "$TIMEOUT" != 0
        then
-               test -x /opt/QtPalmtop/bin/zgreeter.sh && /opt/QtPalmtop/bin/zgreeter.sh
                        
                mount -t proc proc /proc >/dev/null 2>&1
                key_ints="`cat /proc/interrupts | grep keyboard | awk '{print $2}'`"
@@ -257,15 +256,19 @@ wait_for_input() {
 
 # * * * * * * This is the main function * * * * * *
 
-# if /sbin/init is launched with a parameter, it is very likely that the user is trying to switch runlevels
-# manually by running "/sbin/init $RUN_LEVEL". If it is empty (or just contains "tty1") we assume that the kernel
-# launched init during bootup
-if test -n "$*" -a "$*" != "tty1"
+if test "`runlevel`" != "unknown"
 then
        echo "altboot: Using real init [$REAL_INIT] [$*] *" >/dev/tty1
        exec $REAL_INIT $*
        exit 0
 else   
+       # Boot original init if altboot is turned off
+       if test "$ENABLE_ALTBOOT" != "yes" 
+       then    
+               echo "altboot: Using real init [$REAL_INIT] **" >/dev/tty1
+               exec $REAL_INIT $INIT_RUNLEVEL
+               exit 0
+       fi
 
        # Execute scripts in /etc/altboot.rc before doing anything else.
        # Required in special situations, like booting spitz
@@ -275,14 +278,7 @@ else
        do
                 . /etc/altboot.rc/$file >/dev/tty1 2>&1 || echo "/etc/altboot.rc/$file failed!"
        done
-       
-       if test "$ENABLE_ALTBOOT" != "yes" 
-       then    
-               echo "altboot: Using real init [$REAL_INIT] **" >/dev/tty1
-               exec $REAL_INIT $INIT_RUNLEVEL
-               exit 0
-       fi
-       
+               
        # Make sure altboots master password is set
        set_password >/dev/tty0