kdump.conf: use a simple generator script to maintain

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>
This commit is contained in:
Pingfan Liu 2022-11-15 12:00:09 +08:00 committed by Coiby Xu
parent 523cda8f34
commit 787b041aab
2 changed files with 40 additions and 2 deletions

37
kdump.conf → gen-kdump-conf.sh Normal file → Executable file
View File

@ -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

View File

@ -12,8 +12,8 @@ Summary: The kexec/kdump userspace component
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
Source1: kdumpctl
Source3: gen-kdump-sysconfig.sh
Source4: gen-kdump-conf.sh
Source7: mkdumprd
Source8: kdump.conf
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz
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