kdump.conf: use a simple generator script to maintain

Resolves: bz2078460
Upstream: Fedora

commit 787b041aab
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Nov 15 12:00:09 2022 +0800

    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>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2022-11-15 12:00:09 +08:00
parent 576b8fa374
commit aa204a3b63
2 changed files with 42 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

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