From: Hao Zhang <hzh...@ti.com>

- In the case of a kernel crash, the script make the dump file from
kdump and reboot the system.

Signed-off-by: Hao Zhang <hzh...@ti.com>
Signed-off-by: Sam Nelson <sam.nel...@ti.com>
---
 .../crash-recover/crash-recovery.bb                |   18 +++++++++++++++
 .../crash-recover/files/recoveryfs.sh              |   24 ++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 
meta-arago-extras/recipes-support/crash-recover/crash-recovery.bb
 create mode 100755 
meta-arago-extras/recipes-support/crash-recover/files/recoveryfs.sh

diff --git a/meta-arago-extras/recipes-support/crash-recover/crash-recovery.bb 
b/meta-arago-extras/recipes-support/crash-recover/crash-recovery.bb
new file mode 100644
index 0000000..3ee7cc1
--- /dev/null
+++ b/meta-arago-extras/recipes-support/crash-recover/crash-recovery.bb
@@ -0,0 +1,18 @@
+DESCRIPTION = "Initscripts for kdump recovery mechanism"
+LICENSE = "BSD-3-Clause"
+
+COMPATIBLE_MACHINE = "keystone"
+LIC_FILES_CHKSUM = "file://recoveryfs.sh;md5=e1cea7fe03a879dfe71592798e89ed0d"
+
+S = "${WORKDIR}"
+SRC_URI = "file://recoveryfs.sh"
+
+INITSCRIPT_NAME = "recoveryfs.sh"
+INITSCRIPT_PARAMS = "defaults 10"
+
+inherit update-rc.d
+
+do_install_append() {
+        install -d ${D}${sysconfdir}/init.d/
+        install -c -m 755 ${WORKDIR}/recoveryfs.sh 
${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+}
diff --git 
a/meta-arago-extras/recipes-support/crash-recover/files/recoveryfs.sh 
b/meta-arago-extras/recipes-support/crash-recover/files/recoveryfs.sh
new file mode 100755
index 0000000..665b95e
--- /dev/null
+++ b/meta-arago-extras/recipes-support/crash-recover/files/recoveryfs.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -f /proc/vmcore ] ; then
+  mkdir -p /mnt/boot2
+  mount -t ubifs /dev/ubi0_2 /mnt/boot2
+  if [ $? -eq 0 ] ; then
+     if [ -f /usr/bin/makedumpfile ] ; then
+       makedumpfile -E -d 31 /proc/vmcore /mnt/boot2/home/root/coredump.elf
+       gzip -c /mnt/boot2/home/root/coredump.elf > \
+           /mnt/boot2/home/root/coredump.elf.gz
+       rm -rf /mnt/boot2/home/root/coredump.elf
+       sync
+       reboot
+     else
+       echo "makedumpfile not found"
+       exit 1
+     fi
+  else
+    echo "mount unsuccessful"
+    exit 1
+  fi
+fi
+
+exit 0
-- 
1.7.9.5

_______________________________________________
meta-arago mailing list
meta-arago@arago-project.org
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to