[oe-commits] org.oe.dev altboot: Add support for fic-gta01 aka Neo1973. Booting off SD works, NFS / usbnet is untested
coredump2 commit
openembedded-commits at lists.openembedded.org
Wed Mar 14 01:45:12 UTC 2007
altboot: Add support for fic-gta01 aka Neo1973. Booting off SD works, NFS / usbnet is untested
Author: coredump2 at openembedded.org
Branch: org.openembedded.dev
Revision: 7d2bed4320f55ae2c9d3c668ae68cb63a8a1aa6c
ViewMTN: http://monotone.openembedded.org/revision.psp?id=7d2bed4320f55ae2c9d3c668ae68cb63a8a1aa6c
Files:
1
packages/altboot/files/fic-gta01
packages/altboot/files/fic-gta01/altboot-menu
packages/altboot/files/fic-gta01/altboot-menu/Advanced
packages/altboot/files/fic-gta01/altboot-2.6.cfg
packages/altboot/files/fic-gta01/altboot-menu/00-Default
packages/altboot/files/fic-gta01/altboot-menu/15-bootSD
packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick
packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS
packages/altboot/altboot_0.0.0.bb
packages/altboot/files/altboot.func
packages/altboot/files/init.altboot
Diffs:
#
# mt diff -r78c3e3a3d0c2ba227552c34ec04ea5292c42e642 -r7d2bed4320f55ae2c9d3c668ae68cb63a8a1aa6c
#
#
#
# add_dir "packages/altboot/files/fic-gta01"
#
# add_dir "packages/altboot/files/fic-gta01/altboot-menu"
#
# add_dir "packages/altboot/files/fic-gta01/altboot-menu/Advanced"
#
# add_file "packages/altboot/files/fic-gta01/altboot-2.6.cfg"
# content [ec906407ff9f555ccc014ec3c55f85caab0faf46]
#
# add_file "packages/altboot/files/fic-gta01/altboot-menu/00-Default"
# content [89d6282ea1f573c3ceeb41969507594acbca404c]
#
# add_file "packages/altboot/files/fic-gta01/altboot-menu/15-bootSD"
# content [57fc94f9c87d31b10157075dd1673adb2648e762]
#
# add_file "packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick"
# content [99f998313ca8384183f84b9017a25bf3529c6313]
#
# add_file "packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS"
# content [ad985b3df5d4762eb1e2e653d019d7c2f991cfce]
#
# patch "packages/altboot/altboot_0.0.0.bb"
# from [f649f9ddcda9c1f0beee81d44284dc93a888da40]
# to [93370aabd5d508d0d8b38eadb4c7745f4290ff29]
#
# patch "packages/altboot/files/altboot.func"
# from [a5d097e9872bac7bbf58608bf1d454b3fc54fa95]
# to [f775541a80520c416174b670909791d07ba517e7]
#
# patch "packages/altboot/files/init.altboot"
# from [b8a8771c97245572d898d467bc895edd3fe93496]
# to [9ee1c02441238acddcc7f2c53990d3ca408fb6f7]
#
============================================================
--- packages/altboot/files/fic-gta01/altboot-2.6.cfg ec906407ff9f555ccc014ec3c55f85caab0faf46
+++ packages/altboot/files/fic-gta01/altboot-2.6.cfg ec906407ff9f555ccc014ec3c55f85caab0faf46
@@ -0,0 +1,41 @@
+#
+# 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.
+ENABLE_ALTBOOT="yes"
+TIMEOUT="4"
+REAL_INIT="/sbin/init.sysvinit"
+SH_SHELL="/bin/sh"
+
+ENABLE_SOUND="yes"
+
+IMAGE_PATH="boot-images"
+IMAGE_TYPE="ext2"
+FSCK_IMAGES="yes"
+ENABLE_IMAGECONF="no"
+
+SD_DEVICE="/dev/mmcblk0p1"
+SD_KERNEL_MODULE="s3cmci.ko"
+
+USB_HOST_AVAILABLE="yes"
+USB_STORAGE_MODULES="ohci_hcd usb_storage sd_mod"
+USB_STORAGE_PARTITION="/dev/sda1"
+USB_STORAGE_WAIT="4"
+
+USB_NETWORKING_AVAILABLE="yes"
+USB_NW_MODULES="usbcore pxa27x_udc ohci-hcd g_ether"
+USB_NW_DEVICE="usb0"
+
+KEXEC_KERNEL_DIR="/boot"
+KEXEC_BIN="/usr/sbin/kexec"
+
+INIT_RUNLEVEL="5"
+NO_GUI_RL="2"
+MASTER_PASSWORD=""
+ASK_PW_ON_BOOT="no"
+
+SD_MOUNTPOINT="/media/card"
+CF_MOUNTPOINT="/media/cf"
============================================================
--- packages/altboot/files/fic-gta01/altboot-menu/00-Default 89d6282ea1f573c3ceeb41969507594acbca404c
+++ packages/altboot/files/fic-gta01/altboot-menu/00-Default 89d6282ea1f573c3ceeb41969507594acbca404c
@@ -0,0 +1,14 @@
+# !/bin/sh
+M_TITLE="Normal Boot"
+
+
+run_module() {
+ exec $REAL_INIT "$INIT_RUNLEVEL"
+ exit 0
+}
+
+case "$1" in
+title) echo "$M_TITLE";;
+run) run_module;;
+esac
+
============================================================
--- packages/altboot/files/fic-gta01/altboot-menu/15-bootSD 57fc94f9c87d31b10157075dd1673adb2648e762
+++ packages/altboot/files/fic-gta01/altboot-menu/15-bootSD 57fc94f9c87d31b10157075dd1673adb2648e762
@@ -0,0 +1,32 @@
+# !/bin/sh
+#
+# Copyright Matthias Hentges (c) 2005
+#
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the GPL)
+
+
+M_TITLE="Boot SD card"
+
+test "$DISABLE_SD_BOOT" = yes && exit 0
+
+# This function is activated by init.altboot by calling this script with the "run" option
+run_module() {
+
+ test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
+
+ # Mount /proc, etc
+ init_rootfs
+
+ mount_sd
+
+ # Check for a real fs and loop-images.
+ check_target "$SD_MOUNTPOINT" >/dev/tty0
+
+}
+
+
+case "$1" in
+title) echo "$M_TITLE";;
+run) run_module "$2";;
+esac
+
============================================================
--- packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick 99f998313ca8384183f84b9017a25bf3529c6313
+++ packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick 99f998313ca8384183f84b9017a25bf3529c6313
@@ -0,0 +1,47 @@
+# !/bin/sh
+#
+# Copyright Matthias Hentges (c) 2005
+#
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the GPL)
+
+
+M_TITLE="Boot USB Storage"
+
+test "$USB_HOST_AVAILABLE" = "yes" || exit 0
+
+# This function is activated by init.altboot by calling this script with the "run" option
+run_module() {
+
+ test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
+
+ # Mount /proc, etc
+ init_rootfs
+
+ echo "Starting USB..."
+
+ for module in $USB_STORAGE_MODULES
+ do
+ echo -en "\t - $module: "
+ modprobe "$module" >/dev/null 2>&1 && echo ok || die "Failed to modprobe [$module]"
+ done
+
+ echo -n "Mounting $USB_STORAGE_PARTITION..." >/dev/tty0
+
+ mkdir -p /media/usb-storage >/dev/null 2>&1
+
+ sleep "$USB_STORAGE_WAIT"
+
+ /bin/mount -t auto -o defaults,noatime $USB_STORAGE_PARTITION /media/usb-storage >/dev/null 2>&1 && echo ok >/dev/tty0|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed"
+
+ echo ""
+
+ # Check for a real fs and loop-images.
+ check_target "/media/usb-storage" >/dev/tty0
+}
+
+
+case "$1" in
+title) echo "$M_TITLE";;
+run) run_module "$2";;
+esac
+
============================================================
--- packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS ad985b3df5d4762eb1e2e653d019d7c2f991cfce
+++ packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS ad985b3df5d4762eb1e2e653d019d7c2f991cfce
@@ -0,0 +1,110 @@
+#! /bin/sh
+#
+# Copyright Matthias Hentges <devel at hentges.net> (c) 2006
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
+#
+# Filename: 40-bootNFS
+# Date: 14-Apr-06
+
+
+M_TITLE="Boot from NFS"
+
+test "$DISABLE_NFS_BOOT" = yes && exit 0
+
+# This function is activated by init.altboot by calling this script with the "run" option
+run_module() {
+
+ test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
+
+ # Mount /proc, etc
+ init_rootfs
+
+ nfs_host="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'|sed -n "s/\(.*\)\:\(.*\)/\1/p" `"
+ nfs_mounts="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'`"
+ nfs_mountpoints="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $2}'`"
+
+ start_networking "$nfs_host"
+
+ if test -z "$nfs_host"
+ then
+ mdie "${C_RED}No configured NFS drives found in /etc/fstab$C_RESET"
+
+ fi
+
+
+ if test "` echo "$nfs_mountpoints" |wc -l | tr -d " "`" -gt 1
+ then
+ echo -e "Please select your NFS root:\n"
+
+ cnt=1
+ for nfs_mount in $nfs_mountpoints
+ do
+ echo -e "\t[$cnt] $nfs_mount"
+ let cnt=$cnt+1
+ done
+
+ echo ""
+
+ while test -z "$selection"
+ do
+ stty echo
+ echo -n "Boot NFS root: "
+
+ if test "$AUTOBOOT" != "yes"
+ then
+ read junk < /dev/tty1
+ else
+ if test -e /etc/.altboot-bootNFS-source.last
+ then
+ junk="`cat /etc/.altboot-bootNFS-source.last`"
+ test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+ else
+ read junk < /dev/tty1
+ fi
+ fi
+
+
+ cnt=1
+ for nfs_mount in $nfs_mounts
+ do
+ if test "$junk" = "$cnt"
+ then
+ selection="$nfs_mount"
+ echo "$junk" > /etc/.altboot-bootNFS-source.last
+ fi
+ let cnt=$cnt+1
+ done
+
+ done
+ else
+ test -z "$nfs_mounts" && die "No NFS mounts configured in /etc/fstab!"
+ selection="$nfs_mounts"
+ fi
+
+ mkdir -p /media/nfsroot || mdie "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 || mdie "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 && echo ok || echo "FAILED"
+
+ check_target "/media/nfsroot" bootNFS
+
+}
+
+case "$1" in
+title) echo "$M_TITLE";;
+run) run_module "$2";;
+esac
+
============================================================
--- packages/altboot/altboot_0.0.0.bb f649f9ddcda9c1f0beee81d44284dc93a888da40
+++ packages/altboot/altboot_0.0.0.bb 93370aabd5d508d0d8b38eadb4c7745f4290ff29
@@ -18,6 +18,10 @@ RDEPENDS_${PN} = "${PN}-conf"
RDEPENDS_${PN} = "${PN}-conf"
+# Currently the OM image for the Neo is lacking a few basic things...
+RDEPENDS_${PN}_fic-gta01 = "${PN}-conf kernel-module-ext2 kernel-module-loop kernel-module-s3cmci "
+
+
######################################################################################
PR = "r51"
@@ -26,7 +30,7 @@ PACKAGES = "${PN}-conf ${PN}-doc ${PN}"
PACKAGES = "${PN}-conf ${PN}-doc ${PN}"
-PACKAGE_ARCH_${PN} = "all"
+#PACKAGE_ARCH_${PN} = "all"
PACKAGE_ARCH_${PN}-doc = "all"
PACKAGE_ARCH_${PN}-conf = "${MACHINE}"
============================================================
--- packages/altboot/files/altboot.func a5d097e9872bac7bbf58608bf1d454b3fc54fa95
+++ packages/altboot/files/altboot.func f775541a80520c416174b670909791d07ba517e7
@@ -165,6 +165,11 @@ pivot_image() {
mkdir -p /media/image || die "mkdir -p /media/image failed"
+ LOOP_MODULE="$(find /lib/modules/`uname -r`/ -name "loop.ko")"
+ test -n "$LOOP_MODULE" && ( insmod "$LOOP_MODULE" ; sleep 3 )
+
+ ! test -e /dev/loop0 && mknod /dev/loop0 b 7 0
+
losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME || die "losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME failed!"
check_fs /dev/loop0 $IMAGE_TYPE
@@ -451,6 +456,9 @@ check_fs() {
fi
;;
esac
+
+# debug_echo "check_fs() FSCK / FSTYPE: [$FSCK] / [$FSTYPE]"
+
if [ "$FSCK" = "" ]; then
echo "Could not find fsck for $FSTYPE!"
else
@@ -476,9 +484,9 @@ mount_sd(){
}
mount_sd(){
- if mount | grep -q "/media/card"
+ if mount | grep -q "$SD_MOUNTPOINT"
then
- echo "Note: /media/card is already mounted"
+ echo "Note: $SD_MOUNTPOINT is already mounted"
else
# We can't trust that the SD device file is there when running kernel 2.6 w/ udev
# and starting udev at this point may not be the best idea...
@@ -494,20 +502,54 @@ mount_sd(){
# Kernel 2.6 has the SD driver compiled into the kernel
if test -n "$SD_KERNEL_MODULE"
then
- echo -n "Loading SD kernel module..."
- /sbin/insmod $SD_KERNEL_MODULE >/dev/null 2>&1 && echo ok || die "insmod failed"
+ echo "Loading SD kernel module..."
+ if ( echo "$SD_KERNEL_MODULE" | grep -q "^/" )
+ then
+ echo -e "\t- Using full path for SD module"
+ SD_PATTERN="`basename "$SD_KERNEL_MODULE" | sed "s/\.ko//;s/\.o//"`"
+
+ if ( lsmod | grep -q "^$SD_PATTERN" )
+ then
+ echo -e "\t- Already loaded..."
+ else
+ echo -e "\t- Loading..."
+ /sbin/insmod $SD_KERNEL_MODULE >/dev/null 2>&1 && echo ok || die "insmod failed"
+ fi
+
+ else
+ echo -e "\t- Searching [$SD_KERNEL_MODULE]"
+ SD_KERNEL_MODULE="$(find /lib/modules/`uname -r`/ -name "$SD_KERNEL_MODULE")"
+ echo -e "\t- Assuming module is [$SD_KERNEL_MODULE]"
+
+ SD_PATTERN="`basename "$SD_KERNEL_MODULE" | sed "s/\.ko//;s/\.o//"`"
+
+ if ( lsmod | grep -q "^$SD_PATTERN" )
+ then
+ echo -e "\t- Already loaded..."
+ else
+ echo -e "\t- Loading..."
+ /sbin/insmod $SD_KERNEL_MODULE >/dev/null 2>&1 && echo ok || die "insmod failed"
+ fi
+ fi
fi
- check_fs "$SD_DEVICE"
-
- echo -n "Mounting $SD_MOUNTPOINT..." >"$OUT_TTY"
+ sleep 3
- if test "$1" = ingore_errors
+ check_fs "$SD_DEVICE"
+
+ if ! mount | grep -q "$SD_MOUNTPOINT"
then
- /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"
+ 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 "Could not mount SD card"
+ else
+ /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 || die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed"
+ fi
else
- /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
+ echo "NOTE: Some sort of auto-mounting is going on..."
+ fi
fi
echo ""
============================================================
--- packages/altboot/files/init.altboot b8a8771c97245572d898d467bc895edd3fe93496
+++ packages/altboot/files/init.altboot 9ee1c02441238acddcc7f2c53990d3ca408fb6f7
@@ -208,7 +208,7 @@ get_kbd_ints(){
if test -z "$KBD_INT"
then
# find out how the keyboard is called
- for kbd in Spitzkbd corgikbd locomokbd tosakbd
+ for kbd in Spitzkbd corgikbd locomokbd tosakbd "Neo1973 AUX button"
do
if ( cat /proc/interrupts | grep -q "$kbd" )
then
@@ -242,8 +242,12 @@ run_timer() {
#debug_echo "run_timer() old:`echo $key_ints | md5sum`"
stty -echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
- echo -en "\n\nPlease press any key to launch altboot." > "$OUT_TTY"
+ case "$KBD_INT" in
+ Neo1973*) echo -en "\n\nPlease press [AUX] to launch altboot." > "$OUT_TTY" ;;
+ *) echo -en "\n\nPlease press any key to launch altboot." > "$OUT_TTY" ;;
+ esac
+
test -z "$TIMEOUT" && TIMEOUT="3"
cnt=0
@@ -337,41 +341,60 @@ wait_for_input() {
wait_for_input() {
- while true
- do
+
+ # Neo has only two buttons: AUX and PWR.
+ # Only AUX is easily readable from userspace, so are touchscreen taps
+ if test "$KBD_INT" = "Neo1973 AUX button"
+ then
+ ints_old="`cat /proc/interrupts | grep "$KBD_INT" | awk '{print $2}'`"
+ ts_ints_old="`cat /proc/interrupts |grep action| tail -1 | awk '{print $2}'`"
+ echo "Please press [AUX] to set a menu number" <"$OUT_TTY" > "$OUT_TTY" 2>&1
+ echo -e "Press the touchscreen to start\n"
- # Do _not_ change the next few lines!
- #
- # This is required to work around an annoying busybox bug.
- # Every key you press while this script runs will be
- # picked up by the next "read $junk".
- # So the next read would pick up the "any" key the user pressed
- # above to launch the altboot menu.
-
-
- # Bash throws an ugly error on kill
- if ! (readlink /bin/sh | grep -q bash)
- then
- # This filters an "<ENTER>" from the user as "any key"
- ( 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]: " <"$OUT_TTY" > "$OUT_TTY" 2>&1
- stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
- read junk< "$OUT_TTY" 2>&1
+ x="$last_selection" ; hold_events=0
- # This filters other chars the user may have used
+ echo -n "Your Choice: [$x / $cnt]"
- junk="`echo "$junk" | sed "s/[a-zA-Z]//g"`"
-
- if test "$junk" -lt "$cnt" -o "$junk" -eq "$cnt"
- then
- if test ! -z "$junk"
+ while true
+ do
+
+ ts_ints_now="`cat /proc/interrupts |grep action| tail -1 | awk '{print $2}'`"
+
+ if test "$ts_ints_now" = "$ts_ints_old"
then
- parse_module_flags "$junk"
-
+ ints_now="`cat /proc/interrupts | grep "$KBD_INT" | awk '{print $2}'`"
+
+ if test "$ints_now" -gt "$ints_old"
+ then
+ # Only react on every second interupt as both PRESS and RELEASE generate
+ # one.
+ if test -n "$tmp"
+ then
+ #debug_echo "wait_for_input(): PRESS/RELEASE EVENT [$ints_now <-> $ints_old]"
+
+ MAX_ENTRIES="$cnt"
+
+ test "$x" = "$cnt" && x=1 || let x=$x+1
+
+ #\r : go to beginning of the current line
+ #\033[K : completely clear the current line
+ echo -en "\r\033[KYour Choice: [$x / $cnt]"
+
+
+ tmp=""
+ else
+ tmp=blahh
+ fi
+ fi
+
+ ints_old="$ints_now"
+ else
+# debug_echo "wait_for_input(): TOUCHSCREEN EVENT [$ts_ints_now <-> $ts_ints_old]"
+ ts_ints_old="$ts_ints_now"
+
+ parse_module_flags "$x"
+
if test "$RE%s
>>> DIFF TRUNCATED @ 16K
More information about the Openembedded-commits
mailing list