On Tue, Nov 15, 2022 at 12:00:09PM +0800, Pingfan Liu wrote:
This commit has the same motivation as the commit 677da8a "sysconfig: use a simple generator script to maintain".
At present, only the kdump.conf generated for s390x has a slight difference from the other arches, where the core_collector asks the makedumpfile to use "-c" option to compress dump data by each page using zlib, which is more efficient than lzo on s390x.
Signed-off-by: Pingfan Liu piliu@redhat.com Reviewed-by: Philipp Rudo prudo@redhat.com
Patched merged with gen-kdump-conf.sh formatted by shfmt, thanks!
kdump.conf => gen-kdump-conf.sh | 38 +++++++++++++++++++++++++++++++++ kexec-tools.spec | 5 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) rename kdump.conf => gen-kdump-conf.sh (95%) mode change 100644 => 100755
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..b71257d --- a/kdump.conf +++ b/gen-kdump-conf.sh @@ -1,3 +1,12 @@ +#!/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 +201,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 bfa7a5b..cc62984 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -12,8 +12,8 @@ Summary: The kexec/kdump userspace component Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%%7Bname%7D-%%7Bversion%7D.ta... Source1: kdumpctl Source3: gen-kdump-sysconfig.sh +Source4: gen-kdump-conf.sh Source7: mkdumprd -Source8: kdump.conf Source9: https://github.com/makedumpfile/makedumpfile/archive/%%7Bmkdf_ver%7D/makedum... Source10: kexec-kdump-howto.txt Source11: fadump-howto.txt @@ -147,6 +147,7 @@ cp %{SOURCE34} .
# Generate sysconfig file %{SOURCE3} %{_target_cpu} > kdump.sysconfig +%{SOURCE4} %{_target_cpu} > kdump.conf
make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 @@ -180,7 +181,7 @@ install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/ install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd -install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf +install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kdump.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 -- 2.31.1