aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Minqiang <ptpt52@gmail.com>2022-04-30 23:28:29 +0800
committerChristian Lamparter <chunkeey@gmail.com>2022-06-25 10:14:18 +0200
commite0d8f7ef1ff8ff93b8b55006f2f29749cdcc0aec (patch)
tree13ca2f6437911035f7e9af16f303e88830550f00
parent36483600d337ab3ec8a6dabeaa160614d07f5588 (diff)
downloadupstream-e0d8f7ef1ff8ff93b8b55006f2f29749cdcc0aec.tar.gz
upstream-e0d8f7ef1ff8ff93b8b55006f2f29749cdcc0aec.tar.bz2
upstream-e0d8f7ef1ff8ff93b8b55006f2f29749cdcc0aec.zip
kexec-tools: add kdump scripts util
This add back kdump scripts to save crashlog or vmcore to disk Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
-rw-r--r--package/boot/kexec-tools/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/package/boot/kexec-tools/Makefile b/package/boot/kexec-tools/Makefile
index 0fbbefdc3b..6249efe9e7 100644
--- a/package/boot/kexec-tools/Makefile
+++ b/package/boot/kexec-tools/Makefile
@@ -49,6 +49,17 @@ define Package/kexec/description
The kexec utility allows to load and boot another kernel.
endef
+define Package/kdump
+ $(call Package/kexec-tools/Default)
+ TITLE:=Kernel crash analysis
+ DEPENDS:=+kexec @(i386||x86_64||arm) @KERNEL_CRASH_DUMP
+endef
+
+define Package/kdump/description
+ The kdump package allows to automatically boot into a
+ special kernel for analyzing kernel crashes using kdump.
+endef
+
define Package/kexec/config
source "$(SOURCE)/Config.in"
endef
@@ -95,5 +106,28 @@ define Package/kexec/install
$(LN) ../usr/sbin/kexec $(1)/sbin/kexec
endef
+define Package/kdump/install
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vmcore-dmesg $(1)/usr/sbin
+ $(INSTALL_BIN) ./files/kdump.init $(1)/etc/init.d/kdump
+ $(INSTALL_BIN) ./files/kdump.defaults $(1)/etc/uci-defaults/kdump
+ $(INSTALL_CONF) ./files/kdump.config $(1)/etc/config/kdump
+endef
+
+define Package/kdump/prerm
+#!/bin/sh
+
+case $$(uname -m) in
+ i?86|x86_64)
+ if grep -q " crashkernel=" /boot/grub/grub.cfg; then
+ mount /boot -o remount,rw
+ sed -i 's/ crashkernel=[^ ]*//' /boot/grub/grub.cfg
+ mount /boot -o remount,ro
+ fi
+ ;;
+esac
+endef
+
$(eval $(call BuildPackage,kexec-tools))
$(eval $(call BuildPackage,kexec))
+$(eval $(call BuildPackage,kdump))