summaryrefslogtreecommitdiff
path: root/packages/initrdscripts
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2008-03-22 00:32:21 +0000
committerHolger Freyther <zecke@selfish.org>2008-03-22 00:32:21 +0000
commit0362af65b95845f571763fa56e6031a8089091fc (patch)
treebae11f352af2fc04b16ae6ddae46fc6cb51b36f5 /packages/initrdscripts
parent2f8d9c7a57e00b9acd7f7ac445b3ee6cd4eba886 (diff)
parenta4535d80cb60e8eb76cdd2570e76b39eee2332d0 (diff)
merge of '4216327dbc55e359d557266da86971e66ff5f595'
and 'd72643015c099d3f2c3ec5c5bb1294365effbe54'
Diffstat (limited to 'packages/initrdscripts')
-rw-r--r--packages/initrdscripts/files/01-bootldr-buster.sh41
-rw-r--r--packages/initrdscripts/files/30-bootmenu.sh25
-rw-r--r--packages/initrdscripts/files/87-kexecboot.sh6
-rw-r--r--packages/initrdscripts/files/init.sh23
-rw-r--r--packages/initrdscripts/initramfs-jffs2/jffs2boot.sh1
-rw-r--r--packages/initrdscripts/initramfs-jffs2_0.1.bb3
-rw-r--r--packages/initrdscripts/initramfs-module-bootldr-buster_1.0.bb12
-rw-r--r--packages/initrdscripts/initramfs-module-bootmenu_1.0.bb4
-rw-r--r--packages/initrdscripts/initramfs-module-kexecboot_1.0.bb2
-rw-r--r--packages/initrdscripts/initramfs-uniboot_1.0.bb2
10 files changed, 93 insertions, 26 deletions
diff --git a/packages/initrdscripts/files/01-bootldr-buster.sh b/packages/initrdscripts/files/01-bootldr-buster.sh
new file mode 100644
index 0000000000..c3b79b5328
--- /dev/null
+++ b/packages/initrdscripts/files/01-bootldr-buster.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+cmdl=`cat /proc/cmdline`
+#cmdl="console=ttySA0,115200 console=ttySB0,115200"
+if expr "$cmdl" : '.*mtdparts=ipaq' > /dev/null; then
+ echo "!!!!!!!!"
+ echo "Detected Compaq bootldr or derivative"
+ echo "Kernel command line is assumed to be bogus and ignored"
+ echo "!!!!!!!!"
+ CMDLINE="console=ttyS0,115200 console=tty0"
+ sleep 3
+fi
+
+# The main trouble is the bogus console=ttySA0 passed by bootldr
+# It appears that kernel doesn't have protection against only invalid
+# consoles being passed on the command line, which means that the
+# kernel is deaf and dumb when booted by bootldr
+
+INVALID_CONSOLE=0
+VALID_CONSOLE=0
+
+for arg in $cmdl; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ case $arg in
+ console=*)
+ if expr "$optarg" : 'ttySA[0-9]\+' > /dev/null; then
+ INVALID_CONSOLE=1
+ elif expr "$optarg" : 'ttyS\?[0-9]\+' > /dev/null; then
+ VALID_CONSOLE=1
+ fi
+ ;;
+ esac
+done
+
+if [ $INVALID_CONSOLE -eq 1 -a $VALID_CONSOLE -eq 0 ]; then
+ echo "!!!!!!!!"
+ echo "No valid system console is detected"
+ echo "Explicitly using /dev/tty0 for input/output"
+ echo "!!!!!!!!"
+ CONSOLE="/dev/tty0"
+fi
diff --git a/packages/initrdscripts/files/30-bootmenu.sh b/packages/initrdscripts/files/30-bootmenu.sh
index 3f3b8c7079..c77bd662af 100644
--- a/packages/initrdscripts/files/30-bootmenu.sh
+++ b/packages/initrdscripts/files/30-bootmenu.sh
@@ -29,14 +29,14 @@ add_menu_item()
}
show_menu() {
- echo -e -n "${E}3;0H"
+ echo -e -n "${E}3;0H" >$CONSOLE
cnt=0
echo -e $list | \
while read l; do
if [ $cnt == $num ]; then
- echo -e -n "${E}1m"
+ echo -e -n "${E}1m" >$CONSOLE
fi
- echo -e "$cnt: $l${E}0m"
+ echo -e "$cnt: $l${E}0m" >$CONSOLE
cnt=$((cnt + 1))
done
}
@@ -82,7 +82,8 @@ while read maj min nblk dev; do
get_partition_type
if [ "$fstype" != "ext2" -a "$fstype" != "ext3" -a "$fstype" != "vfat" -a "$fstype" != "jffs2" ]; then
-# continue
+ # Comment following line to show all available block devices regardless of FS (for debug purposes)
+ continue
true
fi
@@ -101,14 +102,14 @@ total=`echo -e $list | wc -l`
num=0
# Draw UI
-stty -echo
-echo -e -n "${E}2J"
-echo -e -n "${E}0;0H"
-echo "Select boot image:"
+stty -F $CONSOLE -echo
+echo -e -n "${E}2J" >$CONSOLE
+echo -e -n "${E}0;0H" >$CONSOLE
+echo "Select boot image:" >$CONSOLE
# Main loop
show_menu
-while read -n1 i; do
+while read -s -n1 i; do
case "$i" in
"A")
num=$((num - 1))
@@ -131,7 +132,7 @@ while read -n1 i; do
esac
show_menu
# echo "*$esc$i"
-done
+done < $CONSOLE
stty echo
@@ -162,8 +163,8 @@ else
CMDLINE="$CMDLINE root=$ROOT_DEVICE"
fi
-echo ROOT_DEVICE=$ROOT_DEVICE
-echo CMDLINE=$CMDLINE
+echo ROOT_DEVICE=$ROOT_DEVICE >$CONSOLE
+echo CMDLINE=$CMDLINE >$CONSOLE
##############################
fi
diff --git a/packages/initrdscripts/files/87-kexecboot.sh b/packages/initrdscripts/files/87-kexecboot.sh
index 9232934f98..2a51b4d9c8 100644
--- a/packages/initrdscripts/files/87-kexecboot.sh
+++ b/packages/initrdscripts/files/87-kexecboot.sh
@@ -3,15 +3,15 @@
if [ -n "$BOOT_ROOT" -a -f "$BOOT_ROOT/boot/zImage" ]; then
if ! expr "$CMDLINE" : '.*nokexec'; then
- echo "Kernel found in rootfs:"
- ls -l "$BOOT_ROOT/boot/zImage"
+ echo "Kernel found in rootfs:" >$CONSOLE
+ ls -l "$BOOT_ROOT/boot/zImage" >$CONSOLE
initramfs=""
if [ -f "$BOOT_ROOT/boot/initramfs.bin" ]; then
echo "Initramfs found in rootfs:"
ls -l "$BOOT_ROOT/boot/initramfs.bin"
initramfs="--initrd=$BOOT_ROOT/boot/initramfs.bin"
fi
- echo /usr/sbin/kexec -f "$BOOT_ROOT/boot/zImage" $initramfs --command-line="$CMDLINE nokexec"
+ echo /usr/sbin/kexec -f "$BOOT_ROOT/boot/zImage" $initramfs --command-line="$CMDLINE nokexec" >$CONSOLE
sleep 10
/usr/sbin/kexec -f "$BOOT_ROOT/boot/zImage" $initramfs --command-line="$CMDLINE nokexec"
sleep 10000
diff --git a/packages/initrdscripts/files/init.sh b/packages/initrdscripts/files/init.sh
index 8b9fe12429..60d2e5da8b 100644
--- a/packages/initrdscripts/files/init.sh
+++ b/packages/initrdscripts/files/init.sh
@@ -25,7 +25,7 @@ dev_setup()
}
read_args() {
- CMDLINE=`cat /proc/cmdline`
+ [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
for arg in $CMDLINE; do
optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
case $arg in
@@ -40,7 +40,8 @@ read_args() {
}
load_modules() {
- for module in $MODULE_DIR/*; do
+ for module in $MODULE_DIR/$1; do
+ # Cannot redir to $CONSOLE here easily - may not be set yet
echo "initramfs: Loading $module module"
source $module
done
@@ -52,24 +53,34 @@ boot_root() {
}
fatal() {
- echo $1
- echo
+ echo $1 >$CONSOLE
+ echo >$CONSOLE
exec sh
}
echo "Starting initramfs boot..."
early_setup
+load_modules '0*'
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
read_args
+if [ -z "$rootdelay" ]; then
+ echo "rootdelay parameter was not passed on kernel command line - assuming 2s delay"
+ echo "If you would like to avoid this delay, pass explicit rootdelay=0"
+ rootdelay="2"
+fi
if [ -n "$rootdelay" ]; then
- echo "Waiting $rootdelay seconds for devices to settle..."
+ echo "Waiting $rootdelay seconds for devices to settle..." >$CONSOLE
sleep $rootdelay
fi
dev_setup
-load_modules
+load_modules '[1-9]*'
+
[ -n "$BOOT_ROOT" ] && boot_root
fatal "No valid root device was specified. Please add root=/dev/something to the kernel command-line and try again."
diff --git a/packages/initrdscripts/initramfs-jffs2/jffs2boot.sh b/packages/initrdscripts/initramfs-jffs2/jffs2boot.sh
index 18f4d93273..f81fc5226f 100644
--- a/packages/initrdscripts/initramfs-jffs2/jffs2boot.sh
+++ b/packages/initrdscripts/initramfs-jffs2/jffs2boot.sh
@@ -4,6 +4,7 @@ echo "Starting initrd boot..."
mkdir /proc
mount -t proc proc /proc
+modprobe -q mtdblock
modprobe mtdram total_size=25088 erase_size=256
sleep 1
diff --git a/packages/initrdscripts/initramfs-jffs2_0.1.bb b/packages/initrdscripts/initramfs-jffs2_0.1.bb
index f938b9d3b1..812e612126 100644
--- a/packages/initrdscripts/initramfs-jffs2_0.1.bb
+++ b/packages/initrdscripts/initramfs-jffs2_0.1.bb
@@ -1,5 +1,6 @@
SRC_URI = "file://jffs2boot.sh"
-PR = "r2"
+PR = "r3"
+RRECOMMENDS = "kernel-module-mtdblock kernel-module-mtdram"
do_install() {
install -m 0755 ${WORKDIR}/jffs2boot.sh ${D}/init
diff --git a/packages/initrdscripts/initramfs-module-bootldr-buster_1.0.bb b/packages/initrdscripts/initramfs-module-bootldr-buster_1.0.bb
new file mode 100644
index 0000000000..8c4c2f7e93
--- /dev/null
+++ b/packages/initrdscripts/initramfs-module-bootldr-buster_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://01-bootldr-buster.sh"
+PR = "r2"
+DESCRIPTION = "An initramfs module for ignoring bogus kernel commandline from Compaq bootldr"
+RDEPENDS = "initramfs-uniboot"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/01-bootldr-buster.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/packages/initrdscripts/initramfs-module-bootmenu_1.0.bb b/packages/initrdscripts/initramfs-module-bootmenu_1.0.bb
index 02d696aa2e..5893420742 100644
--- a/packages/initrdscripts/initramfs-module-bootmenu_1.0.bb
+++ b/packages/initrdscripts/initramfs-module-bootmenu_1.0.bb
@@ -1,7 +1,7 @@
SRC_URI = "file://30-bootmenu.sh"
-PR = "r12"
+PR = "r17"
DESCRIPTION = "An initramfs module with UI for selection of boot device."
-RDEPENDS = "klibc-utils-fstype-static initramfs-uniboot initramfs-module-block initramfs-module-loop initramfs-module-nfs"
+RDEPENDS = "klibc-utils-static-fstype initramfs-uniboot initramfs-module-block initramfs-module-loop initramfs-module-nfs"
# For VFAT mounting.
RRECOMMENDS = "kernel-module-nls-cp437 kernel-module-nls-iso8859-1"
diff --git a/packages/initrdscripts/initramfs-module-kexecboot_1.0.bb b/packages/initrdscripts/initramfs-module-kexecboot_1.0.bb
index 35100a94e6..face73038a 100644
--- a/packages/initrdscripts/initramfs-module-kexecboot_1.0.bb
+++ b/packages/initrdscripts/initramfs-module-kexecboot_1.0.bb
@@ -1,5 +1,5 @@
SRC_URI = "file://87-kexecboot.sh"
-PR = "r0.4"
+PR = "r1"
DESCRIPTION = "An initramfs module for kexecing kernel from rootfs."
RDEPENDS = "initramfs-uniboot kexec-static"
diff --git a/packages/initrdscripts/initramfs-uniboot_1.0.bb b/packages/initrdscripts/initramfs-uniboot_1.0.bb
index e0f726582e..403db0b562 100644
--- a/packages/initrdscripts/initramfs-uniboot_1.0.bb
+++ b/packages/initrdscripts/initramfs-uniboot_1.0.bb
@@ -1,5 +1,5 @@
SRC_URI = "file://init.sh"
-PR = "r4"
+PR = "r8"
DESCRIPTON = "A modular initramfs init script system."
RRECOMMENDS = "kernel-module-mtdblock"