aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/initrdscripts
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/initrdscripts
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
downloadopenembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/initrdscripts')
-rw-r--r--recipes/initrdscripts/devimage/devimage.sh17
-rw-r--r--recipes/initrdscripts/devimage/dropbear_rsa_host_keybin0 -> 426 bytes
-rw-r--r--recipes/initrdscripts/devimage/passwd1
-rw-r--r--recipes/initrdscripts/devimage_0.1.bb14
-rw-r--r--recipes/initrdscripts/dropbear-backdoor/dropbear_rsa_host_keybin0 -> 426 bytes
-rw-r--r--recipes/initrdscripts/dropbear-backdoor/passwd1
-rw-r--r--recipes/initrdscripts/dropbear-backdoor_0.1.bb11
-rw-r--r--recipes/initrdscripts/files/00-psplash.sh6
-rw-r--r--recipes/initrdscripts/files/01-bootldr-buster.sh41
-rw-r--r--recipes/initrdscripts/files/10-initfs.sh6
-rw-r--r--recipes/initrdscripts/files/30-bootmenu.sh180
-rw-r--r--recipes/initrdscripts/files/80-ext3.sh17
-rw-r--r--recipes/initrdscripts/files/80-loopboot.sh52
-rw-r--r--recipes/initrdscripts/files/80-nfsboot.sh45
-rw-r--r--recipes/initrdscripts/files/80-squashfs.sh17
-rw-r--r--recipes/initrdscripts/files/85-blockboot.sh12
-rw-r--r--recipes/initrdscripts/files/87-kexecboot.sh19
-rw-r--r--recipes/initrdscripts/files/90-check-modules.sh24
-rw-r--r--recipes/initrdscripts/files/98-aufs.sh17
-rw-r--r--recipes/initrdscripts/files/99-psplash.sh4
-rw-r--r--recipes/initrdscripts/files/init.sh97
-rw-r--r--recipes/initrdscripts/initramfs-jffs2/jffs2boot.sh19
-rw-r--r--recipes/initrdscripts/initramfs-jffs2_0.1.bb10
-rw-r--r--recipes/initrdscripts/initramfs-module-aufs_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-block_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-bootldr-buster_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-bootmenu_1.0.bb14
-rw-r--r--recipes/initrdscripts/initramfs-module-check-modules_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-ext3_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-initfs_1.0.bb13
-rw-r--r--recipes/initrdscripts/initramfs-module-kexecboot_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-module-loop_1.0.bb14
-rw-r--r--recipes/initrdscripts/initramfs-module-nfs_1.0.bb13
-rw-r--r--recipes/initrdscripts/initramfs-module-psplash_1.0.bb13
-rw-r--r--recipes/initrdscripts/initramfs-module-squashfs_1.0.bb12
-rw-r--r--recipes/initrdscripts/initramfs-uniboot_1.0.bb11
36 files changed, 772 insertions, 0 deletions
diff --git a/recipes/initrdscripts/devimage/devimage.sh b/recipes/initrdscripts/devimage/devimage.sh
new file mode 100644
index 0000000000..8a264ed33d
--- /dev/null
+++ b/recipes/initrdscripts/devimage/devimage.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+mkdir /proc
+mount -t proc proc /proc
+mkdir /sys
+mount -t sysfs sysfs /sys
+mkdir -p /dev/pts
+mount -t devpts devpts /dev/pts
+
+modprobe g_ether
+ifconfig usb0 192.168.2.202
+
+export PATH=$PATH:/usr/sbin
+
+/usr/sbin/dropbear -E
+
+/bin/sh
diff --git a/recipes/initrdscripts/devimage/dropbear_rsa_host_key b/recipes/initrdscripts/devimage/dropbear_rsa_host_key
new file mode 100644
index 0000000000..18d832332e
--- /dev/null
+++ b/recipes/initrdscripts/devimage/dropbear_rsa_host_key
Binary files differ
diff --git a/recipes/initrdscripts/devimage/passwd b/recipes/initrdscripts/devimage/passwd
new file mode 100644
index 0000000000..233d68fae1
--- /dev/null
+++ b/recipes/initrdscripts/devimage/passwd
@@ -0,0 +1 @@
+root::0:0:root:/:/bin/sh
diff --git a/recipes/initrdscripts/devimage_0.1.bb b/recipes/initrdscripts/devimage_0.1.bb
new file mode 100644
index 0000000000..0622dd0330
--- /dev/null
+++ b/recipes/initrdscripts/devimage_0.1.bb
@@ -0,0 +1,14 @@
+DESCRIPTION = "Set of files to initialize bare system suitable for kernel, etc. testing."
+SRC_URI = "file://devimage.sh file://passwd file://dropbear_rsa_host_key"
+PR = "r4"
+
+do_install() {
+ install -d ${D}/etc/dropbear
+ install -d ${D}/sbin
+ install -m 0755 ${WORKDIR}/devimage.sh ${D}/init
+ install -m 0600 ${WORKDIR}/dropbear_rsa_host_key ${D}/etc/dropbear/
+ install -m 0644 ${WORKDIR}/passwd ${D}/etc/
+ ln -s /init ${D}/sbin/init
+}
+
+FILES_${PN} += " /init /etc/* /sbin/*"
diff --git a/recipes/initrdscripts/dropbear-backdoor/dropbear_rsa_host_key b/recipes/initrdscripts/dropbear-backdoor/dropbear_rsa_host_key
new file mode 100644
index 0000000000..18d832332e
--- /dev/null
+++ b/recipes/initrdscripts/dropbear-backdoor/dropbear_rsa_host_key
Binary files differ
diff --git a/recipes/initrdscripts/dropbear-backdoor/passwd b/recipes/initrdscripts/dropbear-backdoor/passwd
new file mode 100644
index 0000000000..233d68fae1
--- /dev/null
+++ b/recipes/initrdscripts/dropbear-backdoor/passwd
@@ -0,0 +1 @@
+root::0:0:root:/:/bin/sh
diff --git a/recipes/initrdscripts/dropbear-backdoor_0.1.bb b/recipes/initrdscripts/dropbear-backdoor_0.1.bb
new file mode 100644
index 0000000000..bbed32b834
--- /dev/null
+++ b/recipes/initrdscripts/dropbear-backdoor_0.1.bb
@@ -0,0 +1,11 @@
+DESCRIPTION = "Set of files to open up unlimited access to dropbear daemon - DEBUG ONLY!"
+SRC_URI = "file://passwd file://dropbear_rsa_host_key"
+PR = "r0"
+
+do_install() {
+ install -d ${D}/etc/dropbear
+ install -m 0600 ${WORKDIR}/dropbear_rsa_host_key ${D}/etc/dropbear/
+ install -m 0644 ${WORKDIR}/passwd ${D}/etc/
+}
+
+FILES_${PN} += " /etc/* "
diff --git a/recipes/initrdscripts/files/00-psplash.sh b/recipes/initrdscripts/files/00-psplash.sh
new file mode 100644
index 0000000000..db8aabedd7
--- /dev/null
+++ b/recipes/initrdscripts/files/00-psplash.sh
@@ -0,0 +1,6 @@
+if ! grep -Eq '\s?psplash=false\s?' /proc/cmdline; then
+ mkdir -p /mnt/.psplash
+ mount tmpfs -t tmpfs /mnt/.psplash -o,size=40k
+
+ psplash &
+fi
diff --git a/recipes/initrdscripts/files/01-bootldr-buster.sh b/recipes/initrdscripts/files/01-bootldr-buster.sh
new file mode 100644
index 0000000000..c3b79b5328
--- /dev/null
+++ b/recipes/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/recipes/initrdscripts/files/10-initfs.sh b/recipes/initrdscripts/files/10-initfs.sh
new file mode 100644
index 0000000000..c2a843eb12
--- /dev/null
+++ b/recipes/initrdscripts/files/10-initfs.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+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/recipes/initrdscripts/files/30-bootmenu.sh b/recipes/initrdscripts/files/30-bootmenu.sh
new file mode 100644
index 0000000000..5ebeead430
--- /dev/null
+++ b/recipes/initrdscripts/files/30-bootmenu.sh
@@ -0,0 +1,180 @@
+#
+# (c) 2007 Paul Sokolovsky
+#
+
+# If root is explicitly specified, skip interactive selection
+if [ -z "$ROOT_DEVICE" ]; then
+##############################
+
+E="\033["
+MOUNTLOC="tmp"
+LOOP_IMG_MASK='*.img'
+
+if ! (echo " " | read -n1 foo) >/dev/null 2>&1; then
+ echo "'read' command lacks -n switch support, aborting"
+ exit 1
+fi
+
+mkdir -p $MOUNTLOC
+
+list=""
+
+add_menu_item()
+{
+ if [ -n "$list" ]; then
+ list="$list\n"
+ fi
+
+ list="$list$1"
+}
+
+show_menu() {
+ 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" >$CONSOLE
+ fi
+ echo -e "$cnt: $l${E}0m" >$CONSOLE
+ cnt=$((cnt + 1))
+ done
+}
+
+get_menu_selection()
+{
+ cnt=0
+ sel=`echo -e $list | \
+ while read l; do
+ if [ $cnt == $num ]; then
+ echo $l
+ break
+ fi
+ cnt=$((cnt + 1))
+ done`
+}
+
+get_partition_type()
+{
+# fstype=`mount -f --guess-fstype /dev/$dev $MOUNTLOC`
+ fstype=`fstype </dev/$dev`
+ fstype=`expr "$fstype" : 'FSTYPE=\([A-Za-z0-9]*\).*'`
+}
+
+scan_for_loopimgs()
+{
+# Scan a device for loopback images, add to the list if found
+ mount /dev/$dev $MOUNTLOC
+ p=$PWD
+ cd $MOUNTLOC
+ for img in `ls -1 $LOOP_IMG_MASK 2>/dev/null`; do
+ add_menu_item "$dev/$img (loop img on vfat)"
+ done
+ cd $p
+ umount $MOUNTLOC
+}
+
+# Scan all available device/partitions
+while read maj min nblk dev; do
+ if [ -z "$maj" -o "$maj" == "major" ]; then
+ continue;
+ fi
+
+ get_partition_type
+ if [ "$fstype" != "ext2" -a "$fstype" != "ext3" -a "$fstype" != "vfat" -a "$fstype" != "jffs2" ]; then
+ # Comment following line to show all available block devices regardless of FS (for debug purposes)
+ continue
+ true
+ fi
+
+ if [ "$fstype" == "vfat" ]; then
+ scan_for_loopimgs
+ continue
+ fi
+
+ add_menu_item "$dev ($fstype)"
+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
+
+# Draw UI
+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 -s -n1 i; do
+ case "$i" in
+ "A")
+ num=$((num - 1))
+ if [ $num -lt 0 ]; then
+ num=$(($total - 1))
+ fi
+ ;;
+ ["B"-"Z"])
+ num=$((num + 1))
+ if [ $num -ge $total ]; then
+ num=0
+ fi
+ ;;
+ "q")
+ exec sh
+ ;;
+ "")
+ break
+ ;;
+ esac
+ show_menu
+# echo "*$esc$i"
+done < $CONSOLE
+
+stty echo
+
+# Process results of user selection, prepare input arguments
+# for boot modules
+
+get_menu_selection
+echo Selected: $sel
+
+dev=`expr "$sel" : '\([^ /]*\)'`
+path=`expr "$sel" : '[^/]*\([^ ]*\).*'`
+fstype=`expr "$sel" : '[^ ]* *\(.*\)'`
+
+if [ "$dev" == "Shell" ]; then
+ if [ -x /usr/sbin/dropbear ]; then
+ modprobe g_ether
+ ifconfig usb0 192.168.2.202
+ mkdir -p /dev/pts
+ mount -t devpts devpts /dev/pts
+ export PATH=$PATH:/usr/sbin
+ /usr/sbin/dropbear -E
+ echo "Started dropbear @192.168.2.202"
+ fi
+
+ exec /bin/sh
+elif [ "$dev" == "NFS" ]; then
+ ROOT_DEVICE="/dev/nfs"
+ CMDLINE="$CMDLINE root=/dev/nfs nfsroot=192.168.2.200:/srv/nfs/oe/image"
+elif [ -n "$path" ]; then
+ ROOT_DEVICE="/dev/loop"
+ 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 >$CONSOLE
+echo CMDLINE=$CMDLINE >$CONSOLE
+
+##############################
+fi
diff --git a/recipes/initrdscripts/files/80-ext3.sh b/recipes/initrdscripts/files/80-ext3.sh
new file mode 100644
index 0000000000..1f52d391fa
--- /dev/null
+++ b/recipes/initrdscripts/files/80-ext3.sh
@@ -0,0 +1,17 @@
+ext3_mount () {
+ modprobe -q ext3
+
+ mkdir -p $2
+ mount -t ext3 -onoatime,data=journal,errors=continue $1 $2
+}
+
+for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ echo $arg xxx $optarg
+ case $arg in
+ ext3=*)
+ dev=`expr "$optarg" : '\([^:]*\).*'`
+ path=`expr "$optarg" : '[^:]*:\([^:]*\).*'`
+ ext3_mount $dev $path ;;
+ esac
+done
diff --git a/recipes/initrdscripts/files/80-loopboot.sh b/recipes/initrdscripts/files/80-loopboot.sh
new file mode 100644
index 0000000000..d84244428e
--- /dev/null
+++ b/recipes/initrdscripts/files/80-loopboot.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+if [ "$ROOT_DEVICE" = "/dev/loop" ]; then
+ loop_mount() {
+ loopdev=/dev/loop$loop_num
+ mountpt=/mnt/loop$loop_num
+
+ [ -e $loopdev ] || mknod $loopdev b 7 $loop_num
+
+ # if only one argument was specified, let it be path not dev
+ if [ -z "$path" ] && [ -n "$dev" ]; then
+ path="$dev"
+ dev=""
+ fi
+ [ -z "$offset" ] && offset=0
+
+ if [ -n "$dev" ]; then
+ hostpt=`expr "$dev" : '.*/\([^/]*\)'`
+ [ -z "$hostpt" ] && hostpt="$dev"
+
+ echo "Mounting $dev on $hostpt"
+ mkdir $hostpt
+ mount $dev $hostpt
+ fi
+
+ echo "Loopback setup of $path (offset $offset)"
+ losetup -o "$offset" "$loopdev" "$hostpt/$path"
+
+ echo "Mounting $loopdev on $mountpt"
+ mkdir "$mountpt"
+ mount "$loopdev" "$mountpt"
+ cd "$mountpt"
+ BOOT_ROOT="$mountpt"
+ loop_num=`expr "$loop_num" + 1`
+ }
+
+ modprobe loop
+
+ loop_num=0
+
+ for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ echo $arg xxx $optarg
+ case $arg in
+ looproot=*)
+ dev=`expr "$optarg" : '\([^:]*\).*'`
+ path=`expr "$optarg" : '[^:]*:\([^:]*\).*'`
+ offset=`expr "$optarg" : '[^:]*:[^:]*:\([^:]*\).*'`
+ loop_mount ;;
+ esac
+ done
+fi
diff --git a/recipes/initrdscripts/files/80-nfsboot.sh b/recipes/initrdscripts/files/80-nfsboot.sh
new file mode 100644
index 0000000000..e1588c16a8
--- /dev/null
+++ b/recipes/initrdscripts/files/80-nfsboot.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+if [ "$ROOT_DEVICE" = "/dev/nfs" ]; then
+
+ # These correspond to what kernel itself uses
+ # DO NOT CHANGE!
+ NFS_OPTIONS="-o nfsvers=2,nolock"
+
+ for arg in $CMDLINE; do
+ echo $arg
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ echo $optarg
+ case $arg in
+ nfsroot=*)
+ nfsroot=$optarg ;;
+ ip=*)
+ ip=$optarg ;;
+ esac
+ done
+
+ echo $ip | (IFS=: read client_ip server_ip gw_ip netmask hostname device autoconf; \
+ echo client_ip=$client_ip;
+ echo server_ip=$server_ip;
+ echo gw_ip=$gw_ip;
+ echo netmask=$netmask;
+ echo hostname=$hostname;
+ echo device=$device;
+ echo autoconf=$autoconf;
+
+ case "$device" in
+ usb*)
+ echo "USB"
+ modprobe g_ether
+ sleep 5
+ ;;
+ esac
+
+ ifconfig $device $client_ip
+ ping -c 2 $server_ip
+ )
+
+ echo "booting from NFS: $nfsroot"
+ mount -t nfs $NFS_OPTIONS $nfsroot /mnt
+ BOOT_ROOT=/mnt
+fi
diff --git a/recipes/initrdscripts/files/80-squashfs.sh b/recipes/initrdscripts/files/80-squashfs.sh
new file mode 100644
index 0000000000..22c09544a0
--- /dev/null
+++ b/recipes/initrdscripts/files/80-squashfs.sh
@@ -0,0 +1,17 @@
+squashfs_mount () {
+ modprobe -q squashfs
+
+ mkdir $2
+ mount -t squashfs $1 $2
+}
+
+for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ echo $arg xxx $optarg
+ case $arg in
+ squashfs=*)
+ dev=`expr "$optarg" : '\([^:]*\).*'`
+ path=`expr "$optarg" : '[^:]*:\([^:]*\).*'`
+ squashfs_mount $dev $path ;;
+ esac
+done
diff --git a/recipes/initrdscripts/files/85-blockboot.sh b/recipes/initrdscripts/files/85-blockboot.sh
new file mode 100644
index 0000000000..e1c3ed893e
--- /dev/null
+++ b/recipes/initrdscripts/files/85-blockboot.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Allow booting from a normal block device.
+
+if [ -e "$ROOT_DEVICE" ]; then
+ echo "booting from: $ROOT_DEVICE"
+ 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/recipes/initrdscripts/files/87-kexecboot.sh b/recipes/initrdscripts/files/87-kexecboot.sh
new file mode 100644
index 0000000000..0d2f040a83
--- /dev/null
+++ b/recipes/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:" >$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 $initramfs --command-line="$CMDLINE nokexec" -f "$BOOT_ROOT/boot/zImage" >$CONSOLE
+ sleep 10
+ /usr/sbin/kexec $initramfs --command-line="$CMDLINE nokexec" -f "$BOOT_ROOT/boot/zImage"
+ sleep 10000
+ fi
+fi
diff --git a/recipes/initrdscripts/files/90-check-modules.sh b/recipes/initrdscripts/files/90-check-modules.sh
new file mode 100644
index 0000000000..2423d7f8c5
--- /dev/null
+++ b/recipes/initrdscripts/files/90-check-modules.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Check that modules for the current kernel exist, error out otherwise
+
+uname=`cat /proc/version`
+ver=`expr "x$uname" : 'xLinux version \([^ ]\+\) '`
+
+if [ -n "$BOOT_ROOT" -a ! -d "$BOOT_ROOT/lib/modules/$ver" ]; then
+ echo -e "\033[1m===================="
+ echo "ERROR!"
+ echo "There are no modules for this kernel"
+ echo "version ($ver) in the root file "
+ echo "system, which will lead to boot failure or"
+ echo "broken functionally. If you performed"
+ echo "a kernel upgrade, make sure that version"
+ echo "installed in root filesystem matches"
+ echo "version used in bootloader."
+ echo -e "====================\033[0m"
+ echo
+
+ echo "System halted"
+ while true; do
+ sleep 10000
+ done
+fi
diff --git a/recipes/initrdscripts/files/98-aufs.sh b/recipes/initrdscripts/files/98-aufs.sh
new file mode 100644
index 0000000000..5f7cc11432
--- /dev/null
+++ b/recipes/initrdscripts/files/98-aufs.sh
@@ -0,0 +1,17 @@
+aufs_mount () {
+ modprobe -q aufs
+
+ mkdir -p $2 /mnt
+ mount -t aufs -o br:$1:$2 none /mnt
+}
+
+for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ case $arg in
+ aufs=*)
+ rw=`expr "$optarg" : '\([^:]*\).*'`
+ ro=`expr "$optarg" : '[^:]*:\([^:]*\).*'`
+ aufs_mount $rw $ro
+ BOOT_ROOT=/mnt ;;
+ esac
+done
diff --git a/recipes/initrdscripts/files/99-psplash.sh b/recipes/initrdscripts/files/99-psplash.sh
new file mode 100644
index 0000000000..3d5f1d60d1
--- /dev/null
+++ b/recipes/initrdscripts/files/99-psplash.sh
@@ -0,0 +1,4 @@
+if ! grep -Eq '\s?psplash=false\s?' /proc/cmdline; then
+ mkdir -p /mnt/mnt/.psplash
+ mount -n -o move /mnt/.psplash /mnt/mnt/.psplash
+fi
diff --git a/recipes/initrdscripts/files/init.sh b/recipes/initrdscripts/files/init.sh
new file mode 100644
index 0000000000..221b8f56b9
--- /dev/null
+++ b/recipes/initrdscripts/files/init.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+MODULE_DIR=/initrd.d
+BOOT_ROOT=
+ROOT_DEVICE=
+
+early_setup() {
+ mkdir /proc
+ mount -t proc proc /proc
+ mkdir /mnt
+ modprobe -q mtdblock
+}
+
+dev_setup()
+{
+ echo -n "initramfs: Creating device nodes: "
+ grep '^ *[0-9]' /proc/partitions | while read major minor blocks dev
+ do
+ if [ ! -e /dev/$dev ]; then
+ echo -n "$dev "
+ [ -e /dev/$dev ] || mknod /dev/$dev b $major $minor
+ fi
+ done
+ echo
+}
+
+read_args() {
+ [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+ for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ case $arg in
+ root=*)
+ ROOT_DEVICE=$optarg ;;
+ rootfstype=*)
+ ROOT_FSTYPE=$optarg ;;
+ rootdelay=*)
+ rootdelay=$optarg ;;
+ debug) set -x ;;
+ shell) sh ;;
+ esac
+ done
+}
+
+do_depmod() {
+ [ -e "/lib/modules/$(uname -r)/modules.dep" ] || depmod
+}
+
+load_module() {
+ # Cannot redir to $CONSOLE here easily - may not be set yet
+ echo "initramfs: Loading $module module"
+ source $1
+}
+
+load_modules() {
+ for module in $MODULE_DIR/$1; do
+ [ -e "$module" ] && load_module $module
+ done
+}
+
+boot_root() {
+ cd $BOOT_ROOT
+ exec switch_root -c /dev/console $BOOT_ROOT /sbin/init
+}
+
+fatal() {
+ echo $1 >$CONSOLE
+ echo >$CONSOLE
+ exec sh
+}
+
+
+echo "Starting initramfs boot..."
+early_setup
+load_modules '0*'
+do_depmod
+
+[ -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..." >$CONSOLE
+ sleep $rootdelay
+fi
+
+dev_setup
+
+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/recipes/initrdscripts/initramfs-jffs2/jffs2boot.sh b/recipes/initrdscripts/initramfs-jffs2/jffs2boot.sh
new file mode 100644
index 0000000000..f81fc5226f
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-jffs2/jffs2boot.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+echo "Starting initrd boot..."
+mkdir /proc
+mount -t proc proc /proc
+
+modprobe -q mtdblock
+modprobe mtdram total_size=25088 erase_size=256
+sleep 1
+
+ID=`grep "mtdram test device" /proc/mtd | cut -d: -f1| cut -b4-`
+
+cat /initrd.jffs2 >/dev/mtdblock$ID
+
+mkdir /mnt
+mount -t jffs2 /dev/mtdblock$ID /mnt
+
+cd /mnt
+exec switch_root -c /dev/console /mnt /sbin/init
diff --git a/recipes/initrdscripts/initramfs-jffs2_0.1.bb b/recipes/initrdscripts/initramfs-jffs2_0.1.bb
new file mode 100644
index 0000000000..812e612126
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-jffs2_0.1.bb
@@ -0,0 +1,10 @@
+SRC_URI = "file://jffs2boot.sh"
+PR = "r3"
+RRECOMMENDS = "kernel-module-mtdblock kernel-module-mtdram"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/jffs2boot.sh ${D}/init
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /init "
diff --git a/recipes/initrdscripts/initramfs-module-aufs_1.0.bb b/recipes/initrdscripts/initramfs-module-aufs_1.0.bb
new file mode 100644
index 0000000000..aa31ceee36
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-aufs_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://98-aufs.sh"
+PR = "r1"
+DESCRIPTION = "An initramfs module for mount aufs."
+RDEPENDS = "initramfs-uniboot aufs"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/98-aufs.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-block_1.0.bb b/recipes/initrdscripts/initramfs-module-block_1.0.bb
new file mode 100644
index 0000000000..b4b2d43150
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-block_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://85-blockboot.sh"
+PR = "r3"
+RDEPENDS = "initramfs-uniboot"
+DESCRIPTION = "An initramfs module for booting off normal block devices."
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/85-blockboot.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-bootldr-buster_1.0.bb b/recipes/initrdscripts/initramfs-module-bootldr-buster_1.0.bb
new file mode 100644
index 0000000000..8c4c2f7e93
--- /dev/null
+++ b/recipes/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/recipes/initrdscripts/initramfs-module-bootmenu_1.0.bb b/recipes/initrdscripts/initramfs-module-bootmenu_1.0.bb
new file mode 100644
index 0000000000..f4fd3beee2
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-bootmenu_1.0.bb
@@ -0,0 +1,14 @@
+SRC_URI = "file://30-bootmenu.sh"
+PR = "r18"
+DESCRIPTION = "An initramfs module with UI for selection of boot device."
+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"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/30-bootmenu.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-check-modules_1.0.bb b/recipes/initrdscripts/initramfs-module-check-modules_1.0.bb
new file mode 100644
index 0000000000..6986316a6f
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-check-modules_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://90-check-modules.sh"
+PR = "r0"
+DESCRIPTION = "An initramfs module for checking that kernel modules exist in rootfs"
+RDEPENDS = "initramfs-uniboot"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/90-check-modules.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-ext3_1.0.bb b/recipes/initrdscripts/initramfs-module-ext3_1.0.bb
new file mode 100644
index 0000000000..e95dcdc2ed
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-ext3_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://80-ext3.sh"
+PR = "r1"
+DESCRIPTION = "An initramfs module for mount ext3."
+RDEPENDS = "initramfs-uniboot"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/80-ext3.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-initfs_1.0.bb b/recipes/initrdscripts/initramfs-module-initfs_1.0.bb
new file mode 100644
index 0000000000..2c2ec07bf5
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-initfs_1.0.bb
@@ -0,0 +1,13 @@
+SRC_URI = "file://10-initfs.sh"
+PR = "r4"
+DESCRIPTION = "An initramfs module for initializing filesystems."
+RDEPENDS = "initramfs-uniboot"
+RRECOMMENDS = "kernel-module-vfat kernel-module-ext2"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/10-initfs.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-kexecboot_1.0.bb b/recipes/initrdscripts/initramfs-module-kexecboot_1.0.bb
new file mode 100644
index 0000000000..3080269920
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-kexecboot_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://87-kexecboot.sh"
+PR = "r2"
+DESCRIPTION = "An initramfs module for kexecing kernel from rootfs."
+RDEPENDS = "initramfs-uniboot kexec-static"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/87-kexecboot.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-loop_1.0.bb b/recipes/initrdscripts/initramfs-module-loop_1.0.bb
new file mode 100644
index 0000000000..1a2d0a9754
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-loop_1.0.bb
@@ -0,0 +1,14 @@
+SRC_URI = "file://80-loopboot.sh"
+PR = "r2"
+DESCRIPTION = "An initramfs module for booting a filesystem image by loopback \
+ mounting it."
+RDEPENDS = "initramfs-uniboot initramfs-module-initfs"
+RRECOMMENDS = "kernel-module-loop kernel-module-vfat"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/80-loopboot.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-nfs_1.0.bb b/recipes/initrdscripts/initramfs-module-nfs_1.0.bb
new file mode 100644
index 0000000000..77c38799f3
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-nfs_1.0.bb
@@ -0,0 +1,13 @@
+SRC_URI = "file://80-nfsboot.sh"
+PR = "r2"
+DESCRIPTION = "An initramfs module for booting via NFS."
+RDEPENDS = "initramfs-uniboot"
+RRECOMMENDS = "kernel-module-g-ether kernel-module-nfs"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/80-nfsboot.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-psplash_1.0.bb b/recipes/initrdscripts/initramfs-module-psplash_1.0.bb
new file mode 100644
index 0000000000..44781fb6bf
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-psplash_1.0.bb
@@ -0,0 +1,13 @@
+SRC_URI = "file://00-psplash.sh file://99-psplash.sh"
+PR = "r3"
+RDEPENDS = "initramfs-uniboot virtual/psplash"
+DESCRIPTION = "An initramfs module to enable psplash."
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/00-psplash.sh ${D}/initrd.d/
+ install -m 0755 ${WORKDIR}/99-psplash.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-module-squashfs_1.0.bb b/recipes/initrdscripts/initramfs-module-squashfs_1.0.bb
new file mode 100644
index 0000000000..f3d50ffa49
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-squashfs_1.0.bb
@@ -0,0 +1,12 @@
+SRC_URI = "file://80-squashfs.sh"
+PR = "r1"
+DESCRIPTION = "An initramfs module for mount squashfs."
+RDEPENDS = "initramfs-uniboot"
+
+do_install() {
+ install -d ${D}/initrd.d
+ install -m 0755 ${WORKDIR}/80-squashfs.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
diff --git a/recipes/initrdscripts/initramfs-uniboot_1.0.bb b/recipes/initrdscripts/initramfs-uniboot_1.0.bb
new file mode 100644
index 0000000000..07e94f1dfc
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-uniboot_1.0.bb
@@ -0,0 +1,11 @@
+SRC_URI = "file://init.sh"
+PR = "r10"
+DESCRIPTON = "A modular initramfs init script system."
+RRECOMMENDS = "kernel-module-mtdblock"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/init.sh ${D}/init
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /init "