summaryrefslogtreecommitdiff
path: root/packages/initrdscripts/files
diff options
context:
space:
mode:
Diffstat (limited to 'packages/initrdscripts/files')
-rw-r--r--packages/initrdscripts/files/10-initfs.sh1
-rw-r--r--packages/initrdscripts/files/30-bootmenu.sh15
-rw-r--r--packages/initrdscripts/files/85-blockboot.sh6
-rw-r--r--packages/initrdscripts/files/87-kexecboot.sh19
-rw-r--r--packages/initrdscripts/files/init.sh12
5 files changed, 45 insertions, 8 deletions
diff --git a/packages/initrdscripts/files/10-initfs.sh b/packages/initrdscripts/files/10-initfs.sh
index bad649e5c2..c2a843eb12 100644
--- a/packages/initrdscripts/files/10-initfs.sh
+++ b/packages/initrdscripts/files/10-initfs.sh
@@ -3,3 +3,4 @@
modprobe -q vfat >/dev/null 2>&1
modprobe -q ext2 >/dev/null 2>&1
modprobe -q ext3 >/dev/null 2>&1
+modprobe -q jffs2 >/dev/null 2>&1
diff --git a/packages/initrdscripts/files/30-bootmenu.sh b/packages/initrdscripts/files/30-bootmenu.sh
index 7bc1429b1b..3f3b8c7079 100644
--- a/packages/initrdscripts/files/30-bootmenu.sh
+++ b/packages/initrdscripts/files/30-bootmenu.sh
@@ -95,6 +95,7 @@ while read maj min nblk dev; do
done < /proc/partitions
add_menu_item "NFS (nfsroot=192.168.2.200:/srv/nfs/oe/image)"
+add_menu_item "Shell"
total=`echo -e $list | wc -l`
num=0
@@ -142,15 +143,23 @@ echo Selected: $sel
dev=`expr "$sel" : '\([^ /]*\)'`
path=`expr "$sel" : '[^/]*\([^ ]*\).*'`
+fstype=`expr "$sel" : '[^ ]* *\(.*\)'`
-if [ "$dev" == "NFS" ]; then
+if [ "$dev" == "Shell" ]; then
+ exec /bin/sh
+elif [ "$dev" == "NFS" ]; then
ROOT_DEVICE="/dev/nfs"
- CMDLINE="$CMDLINE nfsroot=192.168.2.200:/srv/nfs/oe/image"
+ CMDLINE="$CMDLINE root=/dev/nfs nfsroot=192.168.2.200:/srv/nfs/oe/image"
elif [ -n "$path" ]; then
ROOT_DEVICE="/dev/loop"
- CMDLINE="looproot=/dev/$dev:$path"
+ CMDLINE="$CMDLINE root=/dev/loop looproot=/dev/$dev:$path"
else
ROOT_DEVICE="/dev/$dev"
+ # jffs2 is not recognized by mount automagically
+ if [ "$fstype" == "(jffs2)" ]; then
+ ROOT_FSTYPE="jffs2"
+ fi
+ CMDLINE="$CMDLINE root=$ROOT_DEVICE"
fi
echo ROOT_DEVICE=$ROOT_DEVICE
diff --git a/packages/initrdscripts/files/85-blockboot.sh b/packages/initrdscripts/files/85-blockboot.sh
index 567f7e29b3..e1c3ed893e 100644
--- a/packages/initrdscripts/files/85-blockboot.sh
+++ b/packages/initrdscripts/files/85-blockboot.sh
@@ -3,6 +3,10 @@
if [ -e "$ROOT_DEVICE" ]; then
echo "booting from: $ROOT_DEVICE"
- mount "$ROOT_DEVICE" /mnt
+ type=""
+ if [ -n "$ROOT_FSTYPE" ]; then
+ type="-t $ROOT_FSTYPE"
+ fi
+ mount $type "$ROOT_DEVICE" /mnt || fatal "Unable to mount rootfs device"
BOOT_ROOT=/mnt
fi
diff --git a/packages/initrdscripts/files/87-kexecboot.sh b/packages/initrdscripts/files/87-kexecboot.sh
new file mode 100644
index 0000000000..9232934f98
--- /dev/null
+++ b/packages/initrdscripts/files/87-kexecboot.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Allow kexecing to kernel in rootfs
+
+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"
+ 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"
+ sleep 10
+ /usr/sbin/kexec -f "$BOOT_ROOT/boot/zImage" $initramfs --command-line="$CMDLINE nokexec"
+ sleep 10000
+ fi
+fi
diff --git a/packages/initrdscripts/files/init.sh b/packages/initrdscripts/files/init.sh
index f8d5de9173..8b9fe12429 100644
--- a/packages/initrdscripts/files/init.sh
+++ b/packages/initrdscripts/files/init.sh
@@ -8,6 +8,7 @@ early_setup() {
mkdir /proc
mount -t proc proc /proc
mkdir /mnt
+ modprobe -q mtdblock
}
dev_setup()
@@ -30,6 +31,8 @@ read_args() {
case $arg in
root=*)
ROOT_DEVICE=$optarg ;;
+ rootfstype=*)
+ ROOT_FSTYPE=$optarg ;;
rootdelay=*)
rootdelay=$optarg ;;
esac
@@ -48,13 +51,13 @@ boot_root() {
exec switch_root -c /dev/console $BOOT_ROOT /sbin/init
}
-boot_failed() {
- echo "No valid root device was specified. Please add root=/dev/something to"
- echo "the kernel command-line and try again."
+fatal() {
+ echo $1
echo
exec sh
}
+
echo "Starting initramfs boot..."
early_setup
read_args
@@ -68,4 +71,5 @@ dev_setup
load_modules
[ -n "$BOOT_ROOT" ] && boot_root
-boot_failed
+
+fatal "No valid root device was specified. Please add root=/dev/something to the kernel command-line and try again."