summaryrefslogtreecommitdiff
path: root/packages/altboot/files
diff options
context:
space:
mode:
authorMatthias Hentges <oe@hentges.net>2007-03-14 01:40:35 +0000
committerMatthias Hentges <oe@hentges.net>2007-03-14 01:40:35 +0000
commit408879acf7c44dd1501a799116b24fe3266e3650 (patch)
tree19aa86f61bf5f1da211b055db400e5203bc11f1c /packages/altboot/files
parent52ecb9d8fff1f3bacb2ea8c13637beaa9da73ce4 (diff)
altboot: Add support for fic-gta01 aka Neo1973. Booting off SD works, NFS / usbnet is untested
Diffstat (limited to 'packages/altboot/files')
-rw-r--r--packages/altboot/files/altboot.func64
-rw-r--r--packages/altboot/files/fic-gta01/.mtn2git_empty0
-rw-r--r--packages/altboot/files/fic-gta01/altboot-2.6.cfg41
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/.mtn2git_empty0
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/00-Default14
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/15-bootSD32
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/Advanced/.mtn2git_empty0
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick47
-rw-r--r--packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS110
-rw-r--r--packages/altboot/files/init.altboot158
10 files changed, 415 insertions, 51 deletions
diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func
index 75808090ba..e990a06862 100644
--- a/packages/altboot/files/altboot.func
+++ b/packages/altboot/files/altboot.func
@@ -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 @@ init_rootfs(){
}
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 ""
diff --git a/packages/altboot/files/fic-gta01/.mtn2git_empty b/packages/altboot/files/fic-gta01/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/.mtn2git_empty
diff --git a/packages/altboot/files/fic-gta01/altboot-2.6.cfg b/packages/altboot/files/fic-gta01/altboot-2.6.cfg
new file mode 100644
index 0000000000..2ad9406083
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-2.6.cfg
@@ -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"
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/.mtn2git_empty b/packages/altboot/files/fic-gta01/altboot-menu/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/.mtn2git_empty
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/00-Default b/packages/altboot/files/fic-gta01/altboot-menu/00-Default
new file mode 100644
index 0000000000..9d29fdae2a
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/00-Default
@@ -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
+
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/15-bootSD b/packages/altboot/files/fic-gta01/altboot-menu/15-bootSD
new file mode 100644
index 0000000000..3cf49deea5
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/15-bootSD
@@ -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
+
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/Advanced/.mtn2git_empty b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/.mtn2git_empty
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick
new file mode 100644
index 0000000000..b573e7a10c
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/30-bootUSB-Stick
@@ -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
+
diff --git a/packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS
new file mode 100644
index 0000000000..4f5c195be2
--- /dev/null
+++ b/packages/altboot/files/fic-gta01/altboot-menu/Advanced/40-bootNFS
@@ -0,0 +1,110 @@
+#! /bin/sh
+#
+# 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: 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
+
diff --git a/packages/altboot/files/init.altboot b/packages/altboot/files/init.altboot
index 033fb2124f..5eb6122a2a 100644
--- a/packages/altboot/files/init.altboot
+++ b/packages/altboot/files/init.altboot
@@ -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,7 +242,11 @@ 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"
@@ -337,41 +341,60 @@ launch_selection() {
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 "$REMEMBER_LAST_SELECTION" != no
then
# Don't remount rw if the drive is already mounted rw
@@ -379,20 +402,75 @@ wait_for_input() {
if test "`mount|sed -n "/\/dev\/root/s/.*(\(.*\))/\1/p"`" != "rw"
then
mount -o remount,rw / >/dev/null 2>&1
- echo "$junk" > /etc/altboot.conf
+ echo "$x" > /etc/altboot.conf
mount -o remount,ro / >/dev/null 2>&1
else
- echo "$junk" > /etc/altboot.conf
+ echo "$x" > /etc/altboot.conf
fi
fi
- else
- junk="$last_selection"
- parse_module_flags "$junk"
+
+ junk="$x"
break
+
+ fi
+ done
+ else
+ while true
+ do
+
+ # 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
- break
- fi
- done
+
+ 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
+
+ junk="`echo "$junk" | sed "s/[a-zA-Z]//g"`"
+
+ if test "$junk" -lt "$cnt" -o "$junk" -eq "$cnt"
+ then
+ if test ! -z "$junk"
+ then
+ parse_module_flags "$junk"
+
+ if test "$REMEMBER_LAST_SELECTION" != no
+ then
+ # Don't remount rw if the drive is already mounted rw
+ # Only helpful for testing / debugging
+ if test "`mount|sed -n "/\/dev\/root/s/.*(\(.*\))/\1/p"`" != "rw"
+ then
+ mount -o remount,rw / >/dev/null 2>&1
+ echo "$junk" > /etc/altboot.conf
+ mount -o remount,ro / >/dev/null 2>&1
+ else
+ echo "$junk" > /etc/altboot.conf
+ fi
+ fi
+ else
+ junk="$last_selection"
+ parse_module_flags "$junk"
+ break
+ fi
+ break
+ fi
+ done
+ fi
}
# * * * * * * This is the main function * * * * * *