summaryrefslogtreecommitdiff
path: root/packages/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/initrdscripts')
-rw-r--r--packages/initrdscripts/files/90-check-modules.sh24
-rw-r--r--packages/initrdscripts/initramfs-kexec_1.0.bb25
-rw-r--r--packages/initrdscripts/initramfs-module-check-modules_1.0.bb12
3 files changed, 61 insertions, 0 deletions
diff --git a/packages/initrdscripts/files/90-check-modules.sh b/packages/initrdscripts/files/90-check-modules.sh
new file mode 100644
index 0000000000..2423d7f8c5
--- /dev/null
+++ b/packages/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/packages/initrdscripts/initramfs-kexec_1.0.bb b/packages/initrdscripts/initramfs-kexec_1.0.bb
new file mode 100644
index 0000000000..b5bf497f37
--- /dev/null
+++ b/packages/initrdscripts/initramfs-kexec_1.0.bb
@@ -0,0 +1,25 @@
+DESCRIPTON = "A init script that mounts a device and kexecs a new kernel from it."
+PR = "r3"
+
+do_compile() {
+ cat > init.sh << EOF
+#!/bin/sh
+/bin/mount -t proc proc /proc
+/bin/mount -t ${ROOTFS} /dev/${ROOTDEV} /mnt
+/usr/sbin/kexec -l /mnt/zImage
+/usr/sbin/kexec -e
+EOF
+}
+
+do_install() {
+ install -m 0755 ${S}/init.sh ${D}/init
+ install -d ${D}/proc
+ install -d ${D}/mnt
+}
+
+PACKAGE_ARCH = "all"
+
+FILES_${PN} = "/init /proc /mnt"
+
+ROOTDEV = "mtdblock2"
+ROOTFS = "jffs2"
diff --git a/packages/initrdscripts/initramfs-module-check-modules_1.0.bb b/packages/initrdscripts/initramfs-module-check-modules_1.0.bb
new file mode 100644
index 0000000000..6986316a6f
--- /dev/null
+++ b/packages/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/* "