altboot: Split altboot into altboot (PACKAGE_ARCH = all) and altboot-conf (ARCH ...
authorMatthias Hentges <oe@hentges.net>
Sat, 6 May 2006 23:40:54 +0000 (23:40 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sat, 6 May 2006 23:40:54 +0000 (23:40 +0000)
packages/altboot/altboot_0.0.0.bb
packages/altboot/files/akita/altboot-2.4.cfg
packages/altboot/files/akita/altboot-2.6.cfg
packages/altboot/files/altboot.func
packages/altboot/files/c7x0/altboot-2.4.cfg
packages/altboot/files/c7x0/altboot-2.6.cfg
packages/altboot/files/collie/altboot-2.4.cfg
packages/altboot/files/init.altboot
packages/altboot/files/poodle/altboot-2.4.cfg
packages/altboot/files/spitz/altboot-2.6.cfg
packages/altboot/files/tosa/altboot-2.4.cfg

index 3bda946..9179871 100644 (file)
@@ -1,17 +1,36 @@
-DESCRIPTION = "A text-based bootmanager allowing a Zaurus to boot from SD, CF, USB-Storage and NFS. \
-Tested machines: Collie, Poodle, Akita, Spitz, C7x0, Tosa, Borzoi"
-SECTION = "base"
-PRIORITY = "optional"
-MAINTAINER = "Matthias 'CoreDump' Hentges  <oe@hentges.net>"
+#
+# Copyright Matthias Hentges <devel@hentges.net> (c) 2006
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
+#
+# Filename: altboot_0.0.0.bb
+# Date: 07-May-06
+
+DESCRIPTION = "The altboot bootmanager"
+MAINTAINER = "Matthias 'CoreDump' Hentges <oe@hentges.net>"
+HOMEPAGE = "http://www.hentges.net/misc/openzaurus/index.shtml"
 LICENSE = "GPL"
-IGNORE_STRIP_ERRORS = "1"
 
-RRECOMMENDS = "e2fsprogs-e2fsck dosfstools"
-RRECOMMENDS_append_akita = " kexec-tools"
-RRECOMMENDS_append_spitz = " kexec-tools"
-RRECOMMENDS_append_c7x0 = " kexec-tools"
+######################################################################################
+
+RRECOMMENDS_${PN} = "e2fsprogs-e2fsck dosfstools"
+RRECOMMENDS_${PN}_append_akita = " kexec-tools"
+RRECOMMENDS_${PN}_append_spitz = " kexec-tools"
+RRECOMMENDS_${PN}_append_c7x0 = " kexec-tools"
+
+RDEPENDS_${PN} = "${PN}-conf"
+RDEPENDS_${PN}-conf = "${PN}"
+
+######################################################################################
+
+PR = "r42"
 
-PR = "r41"
+######################################################################################
+
+PACKAGES = "${PN}-conf ${PN}-doc ${PN}"
+
+PACKAGE_ARCH_${PN} = all
+PACKAGE_ARCH_${PN}-doc = all
+PACKAGE_ARCH_${PN}-conf = "${MACHINE}"
 
 SRC_URI = "file://altboot-menu \
           file://altboot.rc \
@@ -20,37 +39,51 @@ SRC_URI = "file://altboot-menu \
           file://altboot*.cfg \
           file://beep.raw"
 
-# S = "${WORKDIR}/files"
+# S = "${WORKDIR}/altboot/"
+
+######################################################################################
+
+FILES_${PN}-conf = "/etc/altboot*.cfg"
+
+######################################################################################
+
 do_install() {
        install -d ${D}/sbin
        install -d ${D}/etc/altboot-menu
        install -d ${D}/etc/altboot-menu/Advanced
        install -d ${D}/etc/altboot.rc
        install -d ${D}/usr/share/doc/altboot
-       install -d ${D}/usr/share/sounds
-       
+       install -d ${D}/usr/share/sounds                
+
        install -m 0644 ${WORKDIR}/beep.raw ${D}/usr/share/sounds
        install -m 0644 ${WORKDIR}/altboot*.cfg ${D}/etc
        install -m 0644 ${WORKDIR}/altboot.func ${D}/etc
-#      install -m 0644 ${WORKDIR}/docs/altboot/*.txt ${D}/usr/share/doc/altboot
-       install -m 0755 ${WORKDIR}/init.altboot ${D}/sbin       
+       install -m 0755 ${WORKDIR}/init.altboot ${D}/sbin
+       
        install -m 0755 ${WORKDIR}/altboot-menu/*-* ${D}/etc/altboot-menu
+
        install -m 0755 ${WORKDIR}/altboot-menu/Advanced/*-* ${D}/etc/altboot-menu/Advanced
+       
        install -m 0755 ${WORKDIR}/altboot.rc/*.sh ${D}/etc/altboot.rc
        install -m 0644 ${WORKDIR}/altboot.rc/*.txt ${D}/etc/altboot.rc 
 }              
 
+######################################################################################
+
 do_configure() {
        cat ${WORKDIR}/init.altboot | sed "s/^VERSION=.*/VERSION=\"0.0.0 Developer Snapshot (${DATE})\"/" > ${WORKDIR}/init.altboot_
        mv ${WORKDIR}/init.altboot_ ${WORKDIR}/init.altboot
 }
 
+######################################################################################
 
-pkg_postinst() {
+pkg_postinst_${PN}() {
        update-alternatives --install /sbin/init init /sbin/init.altboot 55
 }
 
-pkg_postrm() {
+######################################################################################
+
+pkg_postrm_${PN}() {
        update-alternatives --remove init /sbin/init.altboot
 }
+
index 8c404d4..4ea84ce 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Akita / Kernel 2.4
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM. 
index c763f8b..66b68d1 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Akita / Kernel 2.6
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM. 
index 13ee515..73e82e3 100644 (file)
@@ -62,18 +62,18 @@ check_target() {
                done
                
                case "$ans" in
-               1)      pivot_realfs "$1" "$2">/dev/tty0;;
-               2)      pivot_image "$1" "$2">/dev/tty0;;
+               1)      pivot_realfs "$1" "$2">"$OUT_TTY";;
+               2)      pivot_image "$1" "$2">"$OUT_TTY";;
                esac
                                
                exit 0
        fi
 
        # Boot a real filesystem        
-       test "$real_fs_found" = 1 && pivot_realfs "$1" >/dev/tty0
+       test "$real_fs_found" = 1 && pivot_realfs "$1" >"$OUT_TTY"
        
        # Boot a loop-image
-       test "$image_found" = 1 && pivot_image "$1" >/dev/tty0
+       test "$image_found" = 1 && pivot_image "$1" >"$OUT_TTY"
                
        if test "$real_fs_found" != 1 -a "$image_found" != 1
        then
@@ -229,7 +229,7 @@ do_pivot(){
                do
                        new_mpt="`echo "$mpt" | sed -n "s/\/media\/ROM//p"`"
                        
-                       echo "Moving mountpoint [$mpt] -> [$new_mpt]" >/dev/tty0 2>&1
+                       echo "Moving mountpoint [$mpt] -> [$new_mpt]" >"$OUT_TTY" 2>&1
                        
                        ! test -d "$new_mpt" && mkdir -p "$new_mpt" 
                        /bin/busybox mount -o move "$mpt" "$new_mpt"
@@ -239,7 +239,7 @@ do_pivot(){
                boot_new_rootfs_splash          
                echo "Calling INIT"
                        
-               exec /usr/sbin/chroot . $REAL_INIT $2 >/dev/tty0 2>&1
+               exec /usr/sbin/chroot . $REAL_INIT $2 >"$OUT_TTY" 2>&1
                #exec /usr/sbin/chroot . /sbin/init $2 >/dev/tty0 2>&1
        else
                echo "FAILED"
@@ -341,17 +341,17 @@ set_password() {
                do
                        echo -en "\nNew password: "
 
-                       stty -echo </dev/tty0 >/dev/tty0 2>&1
-                       read junk1 < /dev/tty0
-                       stty echo </dev/tty0 >/dev/tty0 2>&1
+                       stty -echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
+                       read junk1 < "$OUT_TTY"
+                       stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
 
                        if ! test -z "$junk1"
                        then
                                echo -en "\nRepeat: "
                                
-                               stty -echo </dev/tty0 >/dev/tty0 2>&1
-                               read junk2  < /dev/tty0
-                               stty echo </dev/tty0 >/dev/tty0 2>&1
+                               stty -echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
+                               read junk2  < "$OUT_TTY"
+                               stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
                                echo ""
                                
                                if test "$junk1" = "$junk2"
@@ -391,9 +391,9 @@ verify_master_pw() {
                do
                        let cnt=$cnt+$auth_timeout
                        echo -n "Password: "
-                       stty -echo  </dev/tty0 >/dev/tty0 2>&1
-                       read junk < /dev/tty0
-                       stty echo  </dev/tty0 >/dev/tty0 2>&1
+                       stty -echo  <"$OUT_TTY" >"$OUT_TTY" 2>&1
+                       read junk < "$OUT_TTY"
+                       stty echo  <"$OUT_TTY" >"$OUT_TTY" 2>&1
 
                        if test "`echo "$junk" | md5sum | awk '{print $1}'`" = "$MASTER_PASSWORD"
                        then
@@ -458,11 +458,11 @@ init_rootfs(){
 #      echo -n "Mounting rootfs rw..." 
        mount -o remount,rw / || die "mount -o remount,rw / failed"
 
-       mount | grep -q "/proc " >/dev/null 2>&1 || mount proc -t proc /proc >/dev/tty0 2>&1
+       mount | grep -q "/proc " >/dev/null 2>&1 || mount proc -t proc /proc >"$OUT_TTY" 2>&1
        
        if ( uname -r | grep -q "2.6." )
        then
-               mount | grep -q "/sys " >/dev/null 2>&1 || mount sys -t sysfs /sys >/dev/tty0 2>&1
+               mount | grep -q "/sys " >/dev/null 2>&1 || mount sys -t sysfs /sys >"$OUT_TTY" 2>&1
        fi
                
        /etc/init.d/devices start || die "FAILED"
@@ -493,13 +493,13 @@ mount_sd(){
                
                check_fs "$SD_DEVICE"
 
-               echo -n "Mounting $SD_MOUNTPOINT..."  >/dev/tty0
+               echo -n "Mounting $SD_MOUNTPOINT..."  >"$OUT_TTY"
                
                if test "$1" = ingore_errors
                then
-                       /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok  >/dev/tty0 || echo "Could not mount SD card"
+                       /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok  >"$OUT_TTY" || echo "Could not mount SD card"
                else
-                       /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok  >/dev/tty0|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed"
+                       /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok  >"$OUT_TTY"|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed"
                fi              
        fi
        echo "" 
@@ -562,16 +562,16 @@ show_menu() {
        echo -e "\nPress <ENTER> to return to the menu"
        read junk
        
-       test "$junk" = x && exec /bin/sh || exec /sbin/init.altboot -force</dev/tty0 >/dev/tty0 2>&1
+       test "$junk" = x && exec /bin/sh || exec /sbin/init.altboot -force<"$OUT_TTY" >"$OUT_TTY" 2>&1
 }
 
 mdie() {
-       echo -e "${C_RED}ERROR:${C_RESET}${C_WHITE} $1${C_RESET}" >/dev/tty0
+       echo -e "${C_RED}ERROR:${C_RESET}${C_WHITE} $1${C_RESET}" >"$OUT_TTY"
        
        echo -e "\nPress <ENTER> to return to the menu"
        read junk
        
-       test "$junk" = x && exec /bin/sh || exec /sbin/init.altboot -force</dev/tty0 >/dev/tty0 2>&1
+       test "$junk" = x && exec /bin/sh || exec /sbin/init.altboot -force<"$OUT_TTY" >"$OUT_TTY" 2>&1
 }
 
 # $1: uniq name, $2 identifier, $3 value
@@ -583,8 +583,7 @@ set_pref() {
        #echo "[$1] [$2] [$3]"
        #export "${data_name}"="`eval echo -e \\$${data_name} | sed "s/\#\#\#/\#\#\#\\n/g"|sed s/^\ // | sed s/^$data_id.*//`"
 
-       export "${data_name}"="`eval echo -e \\$${data_name} `
-$data_id##$data_value###"
+       export "${data_name}"="`eval echo -e \\$${data_name} `$data_id##$data_value###"
        
 }
 
@@ -622,7 +621,7 @@ get_pref() {
 }
 
 debug_echo() {
-       test "$ENABLE_DEBUG" = "yes" && echo -e "${C_YELLOW}DEBUG:${C_RESET}${C_WHITE} $1 ${C_RESET}" >/dev/tty0 2>&1
+       test "$ENABLE_DEBUG" = "yes" && echo -e "${C_YELLOW}DEBUG:${C_RESET}${C_WHITE} $1 ${C_RESET}" >"$OUT_TTY" 2>&1
 }
 
 start_networking() {
index 32956e7..557730f 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: C7x0 / Kernel 2.4
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM. 
index c077659..71c4c29 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: c7x0 / Kernel 2.6
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM. 
index bc0f9ca..702902c 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Collie / Kernel 2.4
+#
+
 #
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
index 3dc7c60..7539a29 100644 (file)
@@ -17,6 +17,8 @@ REAL_INIT="/sbin/init.sysvinit"
 INIT_RUNLEVEL="`cat /etc/inittab | sed -n "/^id\:/s/id\:\([0-9]\)\:.*$/\1/p"`"
 test -z "$INIT_RUNLEVEL" && INIT_RUNLEVEL=5
 
+OUT_TTY="/dev/tty1"
+
 case "`uname -r`" in
 2.6*)  ALTBOOT_CFG_FILE="/etc/altboot-2.6.cfg";;
 2.4*)  ALTBOOT_CFG_FILE="/etc/altboot-2.4.cfg";;
@@ -34,8 +36,8 @@ C_RESET="\033[0m"
 
 
 die() {
-       echo -e "${C_RED}ERROR: $1${C_RESET}" >/dev/tty0
-       exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1
+       echo -e "${C_RED}ERROR: $1${C_RESET}" >"$OUT_TTY"
+       exec $SH_SHELL <"$OUT_TTY" >"$OUT_TTY" 2>&1
 }
 
 debug_shell() {                
@@ -178,7 +180,7 @@ run_timer() {
                        test -z "$key_ints" && key_ints="`cat /proc/interrupts | grep -i corgikbd`";;   
                esac            
        
-               stty -echo  </dev/tty0 >/dev/tty0 2>&1
+               stty -echo  <"$OUT_TTY" >"$OUT_TTY" 2>&1
                echo -en "\n\nPlease press any key to launch altboot." > /dev/tty1
                
                test -z "$TIMEOUT" && TIMEOUT="3"
@@ -196,7 +198,7 @@ run_timer() {
                        if test "$key_ints_now" != "$key_ints" -o -z "$key_ints_now"
                        then                            
                                launch_altboot=yes                              
-                               stty echo </dev/tty0 >/dev/tty0 2>&1
+                               stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
                                break
                        fi
                        echo -n "." >/dev/tty1
@@ -233,22 +235,22 @@ launch_selection() {
                # The selected menu-item points to a directory
                if test "$type" = DIR
                then
-                       show_sub_menu /etc/altboot-menu/$file >/dev/tty0
-                       wait_for_input >/dev/tty0                       
-                       launch_selection /etc/altboot-menu >/dev/tty0                                           
+                       show_sub_menu /etc/altboot-menu/$file >"$OUT_TTY"
+                       wait_for_input >"$OUT_TTY"                      
+                       launch_selection /etc/altboot-menu >"$OUT_TTY"                                          
                fi
                
                if test "$type" = MAIN
                then
-                       show_sub_menu /etc/altboot-menu >/dev/tty0
-                       wait_for_input >/dev/tty0                       
-                       launch_selection /etc/altboot-menu >/dev/tty0                                           
+                       show_sub_menu /etc/altboot-menu >"$OUT_TTY"
+                       wait_for_input >"$OUT_TTY"                      
+                       launch_selection /etc/altboot-menu >"$OUT_TTY"                                          
                fi      
                
                
                                
-               . $1/$file run "$file" >/dev/tty0       
-               die "WARNING: Using failsafe shell" >/dev/tty0                  
+               . $1/$file run "$file" >"$OUT_TTY"      
+               die "WARNING: Using failsafe shell" >"$OUT_TTY"                 
                
                ;;      
        esac
@@ -273,13 +275,13 @@ wait_for_input() {
                if ! (readlink /bin/sh | grep -q bash)
                then
                        # This filters an "<ENTER>" from the user as "any key"
-                       ( while :; do read x< /dev/tty0 2>&1; done; ) > /dev/null 2>&1 &
+                       ( while :; do read x< "$OUT_TTY" 2>&1; done; ) > /dev/null 2>&1 &
                        sleep 1; kill $! >/dev/null 2>&1
                fi
                                                                
-               echo -n "Please choose one of the above [$last_selection]: " </dev/tty0 > /dev/tty0 2>&1
-               stty echo </dev/tty0 >/dev/tty0 2>&1
-               read junk< /dev/tty0 2>&1
+               echo -n "Please choose one of the above [$last_selection]: " <"$OUT_TTY" > "$OUT_TTY" 2>&1
+               stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
+               read junk< "$OUT_TTY" 2>&1
                
                # This filters other chars the user may have used
                
@@ -346,9 +348,9 @@ else
        done
                        
        # Make sure altboots master password is set
-       set_password >/dev/tty0 
+       set_password >"$OUT_TTY" 
        
-       test "$ASK_PW_ON_BOOT" = "yes" && verify_master_pw >/dev/tty0 
+       test "$ASK_PW_ON_BOOT" = "yes" && verify_master_pw >"$OUT_TTY" 
 
        # When started with -force, always print the menu
        echo "$*" | grep -q -- "-force" && TIMEOUT=0
@@ -357,7 +359,7 @@ else
        # increases while the timer is running. A TIMEOUT of 0 will always launch altboot.      
        run_timer >/dev/tty1 
                
-       echo "" >/dev/tty0
+       echo "" >"$OUT_TTY"
        
        
        if test "$launch_altboot" != yes
@@ -366,40 +368,40 @@ else
                last_selection="`cat /etc/altboot.conf`" >/dev/null 2>&1
                test -z "$last_selection" && last_selection="1" 
                
-               echo "Booting last selection: [$last_selection]" >/dev/tty0
+               echo "Booting last selection: [$last_selection]" >"$OUT_TTY"
                
                # Set up the wanna-be array of available menu entries and their numbers
                show_menu /etc/altboot-menu >/dev/null
                junk="$last_selection"
-               launch_selection /etc/altboot-menu >/dev/tty0
+               launch_selection /etc/altboot-menu >"$OUT_TTY"
 
        fi
 
        # Anything after this point will never be reached if $launch_altboot != yes     
        
        # Show the altboot menu
-       stty -echo </dev/tty0 >/dev/tty0 2>&1
-       show_menu /etc/altboot-menu >/dev/tty0
+       stty -echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
+       show_menu /etc/altboot-menu >"$OUT_TTY"
 
        # Load last selection for use as default if <ENTER> is pressed at the prompt
        last_selection="`cat /etc/altboot.conf`" >/dev/null 2>&1
        test -z "$last_selection" && last_selection="1" 
 
        # Ask the user which menu-item to use
-       wait_for_input >/dev/tty0 
+       wait_for_input >"$OUT_TTY" 
        
        # This should _never_ happen.
        if test -z "$junk"
        then
-               echo "WARNING: Trying failsafe mode" >/dev/tty0
-               mount -o remount,rw / >/dev/tty0 2>&1
+               echo "WARNING: Trying failsafe mode" >"$OUT_TTY"
+               mount -o remount,rw / >"$OUT_TTY" 2>&1
                echo "Dumping environment to /altboot.env"
                echo "$CURRENT_ENV" > /altboot.env
-               mount -o remount,ro / >/dev/tty0 2>&1
+               mount -o remount,ro / >"$OUT_TTY" 2>&1
                junk=1
        fi
 
-       launch_selection /etc/altboot-menu >/dev/tty0   
+       launch_selection /etc/altboot-menu >"$OUT_TTY"  
        
        # Uhoh, something went terribly wrong if we reach this point!
        die "WARNING: Failsafe fall-through activated. Spawning emergency shell"        
index c5bd170..1bce540 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Poodle / Kernel 2.4
+#
+
 #
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
index 2254a35..a8da334 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Spitz / Kernel 2.6
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM. 
index c463ca0..f84e2d5 100644 (file)
@@ -1,3 +1,7 @@
+#
+# Altboot machine configuration for: Tosa / Kernel 2.4
+#
+
 # Handled by /sbin/init.altboot
 # Allow booting images from SD or CF instead of booting
 # the ROM.