diff --git a/kdump.conf b/gen-kdump-conf.sh old mode 100644 new mode 100755 similarity index 95% rename from kdump.conf rename to gen-kdump-conf.sh index e598a49..a9f124f --- a/kdump.conf +++ b/gen-kdump-conf.sh @@ -1,3 +1,11 @@ +#!/bin/bash +# $1: target arch + +SED_EXP="" + +generate() +{ + sed "$SED_EXP" << EOF # This file contains a series of commands to perform (in order) in the kdump # kernel after a kernel crash in the crash kernel(1st kernel) has happened. # @@ -192,3 +200,32 @@ core_collector makedumpfile -l --message-level 7 -d 31 #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" #fence_kdump_args -p 7410 -f auto -c 0 -i 10 #fence_kdump_nodes node1 node2 +EOF +} + +update_param() +{ + SED_EXP="${SED_EXP}s/^$1.*$/$1 $2/;" +} + +case "$1" in +aarch64) ;; + +i386) ;; + +ppc64) ;; + +ppc64le) ;; + +s390x) + update_param core_collector \ + "makedumpfile -c --message-level 7 -d 31" + ;; +x86_64) ;; + +*) + echo "Warning: Unknown architecture '$1', using default kdump.conf template." + ;; +esac + +generate diff --git a/kexec-tools.spec b/kexec-tools.spec index df6cdd6..e5f5e34 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -16,7 +16,7 @@ Source3: kdump.sysconfig.x86_64 Source4: kdump.sysconfig.i386 Source5: kdump.sysconfig.ppc64 Source7: mkdumprd -Source8: kdump.conf +Source8: gen-kdump-conf.sh Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz Source10: kexec-kdump-howto.txt Source11: fadump-howto.txt @@ -152,6 +152,9 @@ cp %{SOURCE27} . cp %{SOURCE34} . cp %{SOURCE37} . +# Generate kdump.conf file +%{SOURCE8} %{_target_cpu} > kdump.conf + make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic-%{eppic_ver}/libeppic @@ -190,7 +193,7 @@ install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd -install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf +install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8