Hello community,

here is the log from the commit of package kdump.15153 for 
openSUSE:Leap:15.2:Update checked in at 2020-11-28 06:42:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2:Update/kdump.15153 (Old)
 and      /work/SRC/openSUSE:Leap:15.2:Update/.kdump.15153.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kdump.15153"

Sat Nov 28 06:42:41 2020 rev:1 rq:851182 version:0.9.0

Changes:
--------
New Changes file:

--- /dev/null   2020-11-18 17:46:03.679371574 +0100
+++ /work/SRC/openSUSE:Leap:15.2:Update/.kdump.15153.new.5913/kdump.changes     
2020-11-28 06:42:43.248776211 +0100
@@ -0,0 +1,1443 @@
+-------------------------------------------------------------------
+Mon Nov 23 12:04:00 UTC 2020 - Petr Tesařík <[email protected]>
+
+- kdump-remove-console-hvc0-from-commandline.patch: remove
+  console=hvc0 from commandline (bsc#1173914).
+- kdump-set-serial-console-from-Xen-cmdline.patch: set serial
+  console from Xen cmdline (bsc#1173914).
+
+-------------------------------------------------------------------
+Fri Nov 20 17:23:45 UTC 2020 - Petr Tesařík <[email protected]>
+
+- kdump-do-not-add-rd.neednet.patch: Do not add 'rd.neednet=1' to
+  dracut command line (bsc#1177196).
+
+-------------------------------------------------------------------
+Mon Mar 30 11:40:15 UTC 2020 - Petr Tesařík <[email protected]>
+
+- kdump-make-sure-that-the-udev-runtime-directory-exists.patch:
+  Make sure that the udev runtime directory exists (bsc#1164713).
+
+-------------------------------------------------------------------
+Mon Jan 27 16:35:50 UTC 2020 - Martin Wilck <[email protected]>
+
+- kdump-activate-udev-rules-late-during-boot.patch: Activate
+  kdump udev rules late during boot (bsc#1154837)
+
+-------------------------------------------------------------------
+Fri Jan 24 13:45:05 UTC 2020 - Dominique Leuenberger <[email protected]>
+
+- Use BuildRequire(udev) instead of udev: allow OBS to shortcut
+  through the -mini flavors.
+- Use systemd_ordering instead of systemd_requires: systemd is not
+  a strict requirement, but if the system is going to use it, we
+  want it to beinstalled prior to kdump.
+
+-------------------------------------------------------------------
+Tue Dec 17 10:00:30 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-calibrate-Update-values.patch: calibrate: Update values
+  (bsc#1130529).
+
+-------------------------------------------------------------------
+Tue Dec 17 09:59:08 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-prefer-by-path-and-device-mapper.patch: Prefer by-path and
+  device-mapper aliases over kernel device names (bsc#1101149,
+  LTC#168532).
+
+-------------------------------------------------------------------
+Fri Dec 13 15:11:32 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-powerpc-no-reload-on-CPU-removal.patch: powerpc: Do not
+  reload on CPU hot removal (bsc#1133407, LTC#176111).
+
+-------------------------------------------------------------------
+Fri Dec 13 14:04:26 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-Add-force-option-to-KDUMP_NETCONFIG.patch: Add ":force"
+  option to KDUMP_NETCONFIG (bsc#1108919).
+- kdump-Add-fence_kdump_send-when-fence-agents-installed.patch: Add
+  fence_kdump_send when fence-agents installed (bsc#1108919).
+- kdump-FENCE_KDUMP_SEND-variable.patch: Use var for path of
+  fence_kdump_send and remove the unnecessary PRESCRIPT check
+  (bsc#1108919).
+- kdump-Document-fence_kdump_send.patch: Document kdump behaviour
+  for fence_kdump_send (bsc#1108919).
+
+-------------------------------------------------------------------
+Mon Dec  9 09:57:37 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-nss-modules.patch: Improve the handling of NSS
+  (bsc#1021846).
+
+-------------------------------------------------------------------
+Mon Dec  9 09:54:01 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-skip-mounts-if-no-proc-vmcore.patch: Skip kdump-related
+  mounts if there is no /proc/vmcore (bsc#1102252, bsc#1125011).
+- kdump-clean-up-kdump-mount-points.patch: Make sure that kdump
+  mount points are cleaned up (bsc#1102252, bsc#1125011).
+
+-------------------------------------------------------------------
+Fri Dec  6 16:50:06 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch:
+  Clean up the use of current vs. boot network interface names
+  (bsc#1094444, bsc#1116463, bsc#1141064).
+- kdump-Use-a-custom-namespace-for-physical-NICs.patch: Use a
+  custom namespace for physical NICs (bsc#1094444, bsc#1116463,
+  bsc#1141064).
+
+-------------------------------------------------------------------
+Fri Dec  6 10:49:48 UTC 2019 - Petr Tesařík <[email protected]>
+
+- kdump-preserve-white-space.patch: Preserve white space when
+  removing kernel command line options (bsc#1117652).
+
+-------------------------------------------------------------------
+Tue Nov 12 08:11:26 UTC 2019 - Jiri Slaby <[email protected]>
+
+- add kdump-savedump-search-also-for-vmlinux.xz.patch (bnc#1155921)
+
+-------------------------------------------------------------------
+Wed Jun 12 15:04:56 UTC 2019 - Dominique Leuenberger <[email protected]>
+
+- BuildRequire pkgconfig(systemd) instead of systemd: allow OBS to
+  shortcut the build queues by allowing usage of systemd-mini
+
+-------------------------------------------------------------------
+Fri Apr 26 07:36:54 UTC 2019 - Petr Tesarik <[email protected]>
+
+- kdump-kdumprd-Look-for-boot-image-and-boot-Image.patch: kdumprd:
+  Look for /boot/image-* and /boot/Image-* (bsc#1132799).
+
+-------------------------------------------------------------------
+Tue Apr 16 09:12:51 UTC 2019 - [email protected]
+
+- kdump-Add-skip_balance-option-to-BTRFS-mounts.patch: Add
+  skip_balance option to BTRFS mounts (bsc#1108255).
+
+-------------------------------------------------------------------
+Wed Mar 20 15:35:29 UTC 2019 - [email protected]
+
+- Use %license instead of %doc (bsc#1082318, bsc#1129947).
+
+-------------------------------------------------------------------
+Wed Mar 20 13:34:40 UTC 2019 - [email protected]
+
+- kdump-fix-multipath-user_friendly_names.patch: Fix multipath
+  configuration with user_friendly_names and/or aliases
+  (bsc#1111207, LTC#171953, bsc#1125218, LTC#175465).
+
+-------------------------------------------------------------------
+Wed Mar 20 13:34:16 UTC 2019 - [email protected]
+
+- kdump-recover-from-missing-CRASHTIME.patch: Recover from missing
+  CRASHTIME= in VMCOREINFO (bsc#1112387).
+
+-------------------------------------------------------------------
+Wed Mar 20 13:26:08 UTC 2019 - [email protected]
+
+- kdump-fallback-re-register-fadump-from-userspace.patch:
+  Re-register FADUMP from userspace if the kernel cannot do it
+  (bsc#1108170, LTC#171288, bsc#1094016, LTC#168050)
+
+-------------------------------------------------------------------
+Wed Mar 20 13:21:56 UTC 2019 - [email protected]
+
+- kdump-Restore-only-static-routes-in-kdump-initrd.patch: Restore
+  only static routes in kdump initrd (bsc#1093795).
+
+-------------------------------------------------------------------
+Wed Mar 20 13:14:45 UTC 2019 - [email protected]
+
+- kdump-on-error-option-yesno.patch: Support yes/no style for
+  KDUMP_CONTINUE_ON_ERROR (bsc#1083155).
+
+-------------------------------------------------------------------
+Wed Mar 20 13:06:26 UTC 2019 - [email protected]
+
+- kdump-use-pbl.patch: Replace obsolete perl-Bootloader library
+  with a simpler script (bsc#1050349).
+
+-------------------------------------------------------------------
+Wed Mar 20 12:48:55 UTC 2019 - [email protected]
+
+- Ensure added kdump-early.service is enabled properly after update
+  (bsc#1021484).
+
+-------------------------------------------------------------------
+Thu Mar  7 20:40:39 UTC 2019 - [email protected]
+
+- kdump-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch: Remove
+  noefi and acpi_rsdp for EFI firmware (bsc#1123940).
+
+-------------------------------------------------------------------
+Fri Oct  5 14:31:49 UTC 2018 - [email protected]
+
+- kdump-turn-off-NUMA-in-kdump-kernel.patch: Turn off NUMA in the
+  kdump kernel (bsc#1109784, bsc#1102609).
+
+-------------------------------------------------------------------
+Fri Oct  5 14:29:47 UTC 2018 - [email protected]
+
+- kdump-fadump-add-udev-support.patch: fadump: add udev event
+  support for fadump (bsc#1108170).
+
+-------------------------------------------------------------------
+Fri Oct  5 14:28:01 UTC 2018 - [email protected]
+
+- kdump-fadump-avoid-multipath-optimizations.patch: fadump: avoid
+  multipath optimizations that break regular boot (bsc#1101730).
+- kdump-split-cmdline-purpose-wise.patch: cmdline: split kdump
+  cmdline purpose wise (bsc#1101730).
+- kdump-fadump-fix-network-bring-up.patch: fadump: fix network
+  bring up issue during default boot (bsc#1101730).
+
++++ 1246 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:Leap:15.2:Update/.kdump.15153.new.5913/kdump.changes

New:
----
  kdump-0.9.0.tar.bz2
  kdump-Add-fence_kdump_send-when-fence-agents-installed.patch
  kdump-Add-force-option-to-KDUMP_NETCONFIG.patch
  kdump-Add-skip_balance-option-to-BTRFS-mounts.patch
  kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch
  kdump-Document-fence_kdump_send.patch
  kdump-FENCE_KDUMP_SEND-variable.patch
  kdump-Restore-only-static-routes-in-kdump-initrd.patch
  kdump-Use-a-custom-namespace-for-physical-NICs.patch
  kdump-activate-udev-rules-late-during-boot.patch
  kdump-block-initrd-parse-etc.service.patch
  kdump-calibrate-Update-values.patch
  kdump-clean-up-kdump-mount-points.patch
  kdump-do-not-add-rd.neednet.patch
  kdump-fadump-add-udev-support.patch
  kdump-fadump-avoid-multipath-optimizations.patch
  kdump-fadump-fix-network-bring-up.patch
  kdump-fallback-re-register-fadump-from-userspace.patch
  kdump-fillupdir-fixes.patch
  kdump-fix-multipath-user_friendly_names.patch
  kdump-kdumprd-Look-for-boot-image-and-boot-Image.patch
  kdump-make-sure-that-the-udev-runtime-directory-exists.patch
  kdump-nss-modules.patch
  kdump-on-error-option-yesno.patch
  kdump-powerpc-no-reload-on-CPU-removal.patch
  kdump-prefer-by-path-and-device-mapper.patch
  kdump-preserve-white-space.patch
  kdump-recover-from-missing-CRASHTIME.patch
  kdump-remove-console-hvc0-from-commandline.patch
  kdump-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch
  kdump-rpmlintrc
  kdump-savedump-search-also-for-vmlinux.xz.patch
  kdump-set-serial-console-from-Xen-cmdline.patch
  kdump-skip-mounts-if-no-proc-vmcore.patch
  kdump-split-cmdline-purpose-wise.patch
  kdump-turn-off-NUMA-in-kdump-kernel.patch
  kdump-use-pbl.patch
  kdump.changes
  kdump.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kdump.spec ++++++
#
# spec file for package kdump
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


# on systemd distros, rpm-build requires systemd-rpm-macros,
# which in turn defines %%systemd_requires
%define systemd_present %{defined systemd_requires}

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif

%define dracutlibdir %{_prefix}/lib/dracut

Name:           kdump
Version:        0.9.0
Release:        0
Summary:        Script for kdump
License:        GPL-2.0-or-later
Group:          System/Kernel
URL:            https://github.com/openSUSE/kdump
Source:         %{name}-%{version}.tar.bz2
Source2:        %{name}-rpmlintrc
Patch1:         %{name}-fillupdir-fixes.patch
Patch2:         %{name}-block-initrd-parse-etc.service.patch
Patch3:         %{name}-fadump-avoid-multipath-optimizations.patch
Patch4:         %{name}-split-cmdline-purpose-wise.patch
Patch5:         %{name}-fadump-fix-network-bring-up.patch
Patch6:         %{name}-fadump-add-udev-support.patch
Patch7:         %{name}-turn-off-NUMA-in-kdump-kernel.patch
Patch8:         %{name}-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch
Patch9:         %{name}-use-pbl.patch
Patch10:        %{name}-on-error-option-yesno.patch
Patch11:        %{name}-Restore-only-static-routes-in-kdump-initrd.patch
Patch12:        %{name}-fallback-re-register-fadump-from-userspace.patch
Patch13:        %{name}-recover-from-missing-CRASHTIME.patch
Patch14:        %{name}-fix-multipath-user_friendly_names.patch
Patch15:        %{name}-Add-skip_balance-option-to-BTRFS-mounts.patch
Patch16:        %{name}-kdumprd-Look-for-boot-image-and-boot-Image.patch
Patch17:        %{name}-savedump-search-also-for-vmlinux.xz.patch
Patch18:        %{name}-preserve-white-space.patch
Patch19:        %{name}-Clean-up-the-use-of-current-vs-boot-network-iface.patch
Patch20:        %{name}-Use-a-custom-namespace-for-physical-NICs.patch
Patch21:        %{name}-clean-up-kdump-mount-points.patch
Patch22:        %{name}-skip-mounts-if-no-proc-vmcore.patch
Patch23:        %{name}-nss-modules.patch
Patch24:        %{name}-Add-force-option-to-KDUMP_NETCONFIG.patch
Patch25:        %{name}-Add-fence_kdump_send-when-fence-agents-installed.patch
Patch26:        %{name}-FENCE_KDUMP_SEND-variable.patch
Patch27:        %{name}-Document-fence_kdump_send.patch
Patch28:        %{name}-powerpc-no-reload-on-CPU-removal.patch
Patch29:        %{name}-prefer-by-path-and-device-mapper.patch
Patch30:        %{name}-calibrate-Update-values.patch
Patch31:        %{name}-activate-udev-rules-late-during-boot.patch
Patch32:        %{name}-make-sure-that-the-udev-runtime-directory-exists.patch
Patch33:        %{name}-do-not-add-rd.neednet.patch
Patch34:        %{name}-remove-console-hvc0-from-commandline.patch
Patch35:        %{name}-set-serial-console-from-Xen-cmdline.patch
BuildRequires:  asciidoc
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libblkid-devel
BuildRequires:  libcurl-devel
BuildRequires:  libelf-devel
BuildRequires:  libesmtp-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libxslt
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(udev)
#!BuildIgnore:  fop
Requires:       curl
Requires:       kexec-tools
Requires:       makedumpfile
Requires:       openssh
# FIXME: use proper Requires(pre/post/preun/...)
PreReq:         %fillup_prereq
PreReq:         coreutils
PreReq:         dracut
PreReq:         sed
Recommends:     cifs-utils
Recommends:     nfs-client
# update should detect the split-off from kexec-tools
Provides:       kexec-tools:%{_initddir}/kdump
ExcludeArch:    s390 ppc
%if %{systemd_present}
BuildRequires:  pkgconfig(systemd)
%else
# FIXME: use proper Requires(pre/post/preun/...)
PreReq:         %insserv_prereq
%endif
%if %{systemd_present}
%systemd_ordering
%endif

%description
kdump is a package that includes several scripts for kdump, including
the kdump service and configuration files

The kernel package and this package are all that are required for a
crash dump to occur. However, if you wish to debug the crash dump
yourself you will need several debugging packages installed for each
kernel flavor and release you wish to debug.

For example, if you are debugging kernel-default, you will need:
- kernel-default-debuginfo
- kernel-default-devel
- kernel-default-devel-debuginfo

These packages are not needed to create the dump and can be installed
after a crash dump has occured.

%prep
%setup -q
%if 0%{?suse_version} >= 1330
%patch1 -p1
%endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1

%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=gnu++98"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
make %{?_smp_mflags}

%check
cd build
ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} 

%install
DESTDIR=%{buildroot} make -C build %{?_smp_mflags} install
# remove executable bit from non-binaries
chmod -x %{buildroot}/lib/kdump/setup-kdump.functions
# empty directory
mkdir -p %{buildroot}%{_localstatedir}/crash

# symlink for init script
%if %{systemd_present}
rm %{buildroot}%{_initddir}/boot.kdump
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump
%else
rm %{buildroot}%{_prefix}/lib/systemd/system/kdump.service
rm %{buildroot}%{_prefix}/lib/systemd/system/kdump-early.service
ln -s ../..%{_initddir}/boot.kdump %{buildroot}%{_sbindir}/rckdump
%endif

%if %{systemd_present}
%pre
%service_add_pre kdump.service
%service_add_pre kdump-early.service
%endif

%post
# change only permission if the file exists before /etc/sysconfig/kdump
# has been created from %%{_fillupdir}/sysconfig.kdump
change_permission=0
if [ ! -f %{_sysconfdir}/sysconfig/kdump ] ; then
    change_permission=1
fi
%if %{systemd_present}
%{fillup_only -n kdump}
%service_add_post kdump.service
%service_add_post kdump-early.service
# ensure newly added kdump-early.service is-enabled matches prior state
if [ -x %{_bindir}/systemctl ] && %{_bindir}/systemctl is-enabled kdump.service 
&>/dev/null ; then
        %{_bindir}/systemctl reenable kdump.service || :
fi
%else
%{fillup_and_insserv -n kdump boot.kdump}
%endif
if [ "$change_permission" = 1 ]; then
    chmod 0600 %{_sysconfdir}/sysconfig/kdump
fi
# if /var/log/dump is empty, make it a symlink to /var/crash
if test -d %{_localstatedir}/log/dump && rmdir %{_localstatedir}/log/dump 
>/dev/null 2>&1 ||
        ! test -d %{_localstatedir}/log/dump ; then
    ln -snf %{_localstatedir}/crash %{_localstatedir}/log/dump
fi

%preun
echo "Stopping kdump ..."
%if %{systemd_present}
%service_del_preun kdump.service
%service_del_preun kdump-early.service
%else
%stop_on_removal boot.kdump
%endif

%postun
# force regeneration of kdumprd
touch %{_sysconfdir}/sysconfig/kdump
# delete symbolic link
rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true
%if %{systemd_present}
%service_del_postun kdump.service
%service_del_postun kdump-early.service
%else
%restart_on_update boot.kdump
%insserv_cleanup
%endif

# Compatibility cruft
# there is no %%license prior to SLE12
%if %{undefined _defaultlicensedir}
%define license %doc
%else
# filesystem before SLE12 SP3 lacks /usr/share/licenses
%if 0%(test ! -d %{_defaultlicensedir} && echo 1)
%define _defaultlicensedir %{_defaultdocdir}
%endif
%endif
# End of compatibility cruft

%files
%defattr(-,root,root)
%license COPYING
%doc ChangeLog README NEWS
%{_sbindir}/kdumptool
%{_sbindir}/mkdumprd
%{_mandir}/man5/kdump.5%{?ext_man}
%{_mandir}/man7/kdump.7%{?ext_man}
%{_mandir}/man8/kdumptool.8%{?ext_man}
%{_mandir}/man8/mkdumprd.8%{?ext_man}
%{_fillupdir}/sysconfig.kdump
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/modules.d/99kdump/
%dir /lib/kdump
/lib/kdump/*
%dir /usr/lib/kdump
/usr/lib/kdump/70-kdump.rules
%if %{systemd_present}
%{_unitdir}/kdump.service
%{_unitdir}/kdump-early.service
%else
%{_sysconfdir}/init.d/boot.kdump
%endif
%{_sbindir}/rckdump

%changelog
++++++ kdump-Add-fence_kdump_send-when-fence-agents-installed.patch ++++++
From: Nick Wang <[email protected]>
Date: Wed, 28 Nov 2018 18:07:56 +0800
Subject: Add fence_kdump_send when fence-agents installed.
References: bsc#1108919
Upstream: merged
Git-commit: 93822c5ee738e186a3a70f6d7a6e59bdea4b46b1

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/module-setup.sh       |    5 +++++
 init/setup-kdump.functions |    7 +++++++
 2 files changed, 12 insertions(+)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,6 +25,11 @@ kdump_check_net() {
     elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
         # always set up network
         kdump_neednet=y
+    elif [ -f "/usr/lib/fence_kdump_send" ] &&
+         ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
+         [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+        # setup network when fence_kdump_send included and configured
+        kdump_neednet=y
     else
         kdump_neednet=
         for protocol in "${kdump_Protocol[@]}" ; do
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -917,6 +917,13 @@ function kdump_modify_config()                             
                   #
        KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
     fi
 
+    # copy fence_kdump_send if exists
+    if [ -f "/usr/lib/fence_kdump_send" ] &&
+       ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
+       [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+        KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS 
/usr/lib/fence_kdump_send"
+    fi
+
     # make sure NSS works somehow
     cp /etc/hosts "${dest}/etc"
     { cat <<-EOF
++++++ kdump-Add-force-option-to-KDUMP_NETCONFIG.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Tue, 20 Nov 2018 10:23:28 +0100
Subject: Add ":force" option to KDUMP_NETCONFIG
References: bsc#1108919
Upstream: merged
Git-commit 4e112a28055a57dbcdf9a72c4bdcf586296ec81a

Make it possible to force network setup in kdump initrd by adding a
":force" suffix to KDUMP_NETCONFIG. This is needed to configure
fence_kdump.

Signed-off-by: Petr Tesarik <[email protected]>

---
 doc/man/kdump.5.txt.in |    6 ++++++
 init/module-setup.sh   |   37 +++++++++++++++++++++----------------
 sysconfig.kdump.in     |    6 +++++-
 3 files changed, 32 insertions(+), 17 deletions(-)

--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -544,6 +544,12 @@ Auto-detection cannot be used to set up
 because of limitations in the implementation of the _ip=_ initrd command line
 option.
 
+Network is configured only if needed, e.g. the dump target is on a remote
+machine, or an email notification should be sent. If network is needed by
+something else, such as a custom script used as KDUMP_PRESCRIPT or
+KDUMP_POSTSCRIPT, add a _:force_ suffix to the network configuration, for
+example "auto:force" or "eth0:dhcp4:force".
+
 Use a _netdevice:mode_ string to force a specific network device to be used. A
 _netdevice_ is for example "eth0". The _mode_ can be:
 
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -19,20 +19,25 @@ kdump_needed() {
 }
 
 kdump_check_net() {
-    kdump_neednet=
-    for protocol in "${kdump_Protocol[@]}" ; do
-       if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
-           kdump_neednet=y
-       fi
-    done
+    if [ -z "$KDUMP_NETCONFIG" ]; then
+        # network explicitly disabled in configuration
+        kdump_neednet=
+    elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
+        # always set up network
+        kdump_neednet=y
+    else
+        kdump_neednet=
+        for protocol in "${kdump_Protocol[@]}" ; do
+           if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
+               kdump_neednet=y
+           fi
+        done
 
-    # network configuration
-    if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
-       kdump_neednet=y
+        # network configuration
+        if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
+           kdump_neednet=y
+        fi
     fi
-
-    # network explicitly disabled in configuration?
-    [ -z "$KDUMP_NETCONFIG" ] && kdump_neednet=
 }
 
 kdump_get_fs_type() {
@@ -161,13 +166,13 @@ kdump_cmdline_zfcp() {
 kdump_cmdline_ip() {
     [ "$kdump_neednet" = y ] || return 0
 
-    if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
+    local _cfg="${KDUMP_NETCONFIG%:force}"
+    if [ "$_cfg" = "auto" ] ; then
        kdump_host_if=default
        kdump_net_mode=auto
     else
-       set -- ${KDUMP_NETCONFIG//:/ }
-       kdump_host_if=$1
-       kdump_net_mode=$2
+       kdump_host_if="${_cfg%%:*}"
+       kdump_net_mode="${_cfg#*:}"
     fi
 
     if [ "$kdump_host_if" = "default" ] ; then
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -294,9 +294,13 @@ KDUMPTOOL_FLAGS=""
 # that contains the network device and the mode (static, dhcp, dhcp6, auto6),
 # separated by a colon. Example: "eth0:static" or "eth1:dhcp".
 #
-# For static configuration, you have to add the configuration to
+# For static configuration, you may have to add the configuration to
 # KDUMP_COMMANDLINE_APPEND.
 #
+# By default, network is set up only if needed. Add ":force" to make sure
+# that network is always available (e.g. for use by a custom pre- or
+# post-script).
+#
 # See also: kdump(5)
 #
 KDUMP_NETCONFIG="auto"
++++++ kdump-Add-skip_balance-option-to-BTRFS-mounts.patch ++++++
From f46c26fcf879f368726acf650c43eacde909dc9d Mon Sep 17 00:00:00 2001
From: Petr Tesarik <[email protected]>
Date: Tue, 16 Apr 2019 11:05:18 +0200
Subject: Add skip_balance option to BTRFS mounts
References: bsc#1108255
Upstream: merged
Git-commit: f46c26fcf879f368726acf650c43eacde909dc9d

If a crash happens while a balance operation is being performed on a
target btrfs filesystem, then this balance operation is resumed in
the kdump environment, which is not desirable. Skip it by adding a
'skip_balance' mount option to the kdump initrd.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/setup-kdump.functions | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/init/setup-kdump.functions b/init/setup-kdump.functions
index 46b2902..9ff5efc 100644
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -764,6 +764,10 @@ function kdump_update_mount()                              
                   # {{{
        mountpoint="/kdump/mnt$i/${mountpoint#/kdump/mnt*/}"
     done
 
+    if [ "$fstype" = "btrfs" ] ; then
+       opts="$opts,skip_balance"
+    fi
+
     kdump_mnt[i]="${mountpoint%/}"
     kdump_dev[i]="$device"
     kdump_fstype[i]="$fstype"
-- 
2.16.4

++++++ kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch ++++++
From e32374a88bb3b1dc0c5f493d6c1966558d996c4f Mon Sep 17 00:00:00 2001
From: Petr Tesarik <[email protected]>
Date: Tue, 27 Nov 2018 14:52:06 +0100
Subject: Clean up the use of current vs. boot network interface names
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: e32374a88bb3b1dc0c5f493d6c1966558d996c4f

Strictly differentiate between the interface name as seen during
dracut execution and at boot time (in initrd environment).

Most importantly, it is necessary to store both names for generating
qeth udev rules.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/setup-kdump.functions |   51 +++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -426,9 +426,9 @@ function kdump_hwaddr()                                     
                   # {{{
     local _type=$(<"/sys/class/net/$_iface/addr_assign_type")
     if [ "$_type" -eq 0 ]
     then
-       cat "/sys/class/net/$kdump_iface/address"
+       cat "/sys/class/net/$_iface/address"
     else
-       ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//'
+       ethtool -P "$_iface" | sed 's/^[^:]*: *//'
     fi
 }                                                                         # }}}
 
@@ -440,42 +440,43 @@ function kdump_hwaddr()                                   
                   # {{{
 #   kdump_netif  corresponding ifname= initrd parameter added
 #   kdump_iface  device name in initrd
 #   kdump_kmods  additional kernel modules updated
-#   kdump_hwif   hardware interfaces updated
+#   kdump_ifmap  hardware network interface map updated
 function kdump_ifname_config()                                            # {{{
 {
-    kdump_iface="$1"
-    local ifkind=$(kdump_ifkind "$kdump_iface")
+    local _iface="$1"
+    local _ifkind=$(kdump_ifkind "$_iface")
 
-    if [ -z "$ifkind" ]
+    if [ -z "$_ifkind" ]
     then
-       kdump_hwif="$kdump_hwif $kdump_iface"
-       local _drv=$( readlink "/sys/class/net/$kdump_iface/device/driver" )
+       kdump_iface="$_iface"
+       kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
 
+       local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
        case "$_drv" in
            */qeth)
                ;;
            *)
-               local hwaddr=$(kdump_hwaddr "$kdump_iface")
+               local hwaddr=$(kdump_hwaddr "$_iface")
                [ -n "$hwaddr" ] && kdump_netif="$kdump_netif 
ifname=$kdump_iface:$hwaddr"
                ;;
        esac
 
-       local mod="/sys/class/net/$kdump_iface/device/driver/module"
+       local mod="/sys/class/net/$_iface/device/driver/module"
        if [ -L "$mod" ]
        then
            mod=$(readlink "$mod")
            kdump_kmods="$kdump_kmods ${mod##*/}"
        fi
     else
-       case "$ifkind" in
+       case "$_ifkind" in
            bridge)
-               kdump_bridge_config "$kdump_iface"
+               kdump_bridge_config "$_iface"
                ;;
            bond)
-               kdump_bond_config "$kdump_iface"
+               kdump_bond_config "$_iface"
                ;;
            vlan)
-               kdump_vlan_config "$kdump_iface"
+               kdump_vlan_config "$_iface"
                ;;
            *)
                return 1
@@ -1070,13 +1071,13 @@ function kdump_filter_sysctl()                          
                   #
 # Set up a QETH network interface
 # Parameters:
 #   1) _root:   initrd temporary root
-#   2) _iface:  interface name
-# Input variables:
-#   kdump_hwif   hardware network interfaces
+#   2) _iface:  current interface name
+#   3) _bootif: interface name in initrd
 function kdump_setup_qeth()                                               # {{{
 {
     local _root="$1"
     local _iface="$2"
+    local _bootif="$3"
     local _dev=$( readlink "/sys/class/net/$_iface/device" )
     _dev="${_dev##*/}"
     local _cdev0=$( readlink "/sys/class/net/$_iface/device/cdev0" )
@@ -1113,8 +1114,8 @@ ACTION=="add", SUBSYSTEM=="ccwgroup", KE
 ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{online}="1"
 EOF
 
-    cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_iface}.rules" <<EOF
-SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, 
KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_iface"
+    cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_bootif}.rules" <<EOF
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, 
KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_bootif"
 EOF
 }                                                                         # }}}
 
@@ -1123,18 +1124,20 @@ EOF
 # Parameters:
 #   1) _root:   initrd temporary root
 # Input variables:
-#   kdump_hwif   hardware network interfaces
+#   kdump_ifmap  hardware network interface map
 function kdump_setup_hwif()                                               # {{{
 {
     local _root="$1"
-    local _iface _drv
+    local _spec _iface _bootif _drv
 
-    for _iface in $kdump_hwif
+    for _spec in $kdump_ifmap
     do
+       _iface="${_spec%:*}"
+       _bootif="${_spec##*:}"
        _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
        case "$_drv" in
            */qeth)
-               kdump_setup_qeth "$_root" "$_iface"
+               kdump_setup_qeth "$_root" "$_iface" "$_bootif"
                ;;
        esac
     done
@@ -1149,7 +1152,7 @@ function kdump_setup_hwif()                               
                   # {{
 # Input variables:
 #   KDUMP_*      see kdump_get_config
 #   kdump_mnt[]  mountpoints in kdump environment
-#   kdump_hwif   hardware network interfaces
+#   kdump_ifmap  hardware network interface map
 # Output variables:
 #   KDUMP_REQUIRED_PROGRAMS updated as necessary
 function kdump_setup_files()                                              # {{{
++++++ kdump-Document-fence_kdump_send.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Fri, 30 Nov 2018 09:29:10 +0100
Subject: Document kdump behaviour for fence_kdump_send
References: bsc#1108919
Upstream: merged
Git-commit: dcbe901dbec7d0b5e70014564da5a34f673e2248

Add an explanation paragraph to the manual page.

Signed-off-by: Petr Tesarik <[email protected]>

---
 doc/man/kdump.5.txt.in |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -483,7 +483,11 @@ KDUMP_POSTSCRIPT
 ~~~~~~~~~~~~~~~~
 
 Program that is executed after taking the dump and before the system is
-rebooted. You have to include that program in KDUMP_POSTSCRIPT.
+rebooted. You have to include that program in KDUMP_REQUIRED_PROGRAMS.
+
+As a special case, if KDUMP_POSTSCRIPT contains +/usr/lib/fence_kdump_send+,
+this script is automatically added to the initrd, and network is configured by
+default.
 
 Default: ""
 
++++++ kdump-FENCE_KDUMP_SEND-variable.patch ++++++
From: Nick Wang <[email protected]>
Date: Fri, 30 Nov 2018 10:03:17 +0800
Subject: Use var for path of fence_kdump_send and remove the unnecessary 
PRESCRIPT check
References: bsc#1108919
Upstream: merged
Git-commit: f69533d0d8e974b8c27a2c9a651fb9e98c16194b

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/module-setup.sh       |    5 ++---
 init/setup-kdump.functions |    8 ++++----
 2 files changed, 6 insertions(+), 7 deletions(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,9 +25,8 @@ kdump_check_net() {
     elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
         # always set up network
         kdump_neednet=y
-    elif [ -f "/usr/lib/fence_kdump_send" ] &&
-         ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
-         [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+    elif [ -f "$FENCE_KDUMP_SEND" ] &&
+         [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
         # setup network when fence_kdump_send included and configured
         kdump_neednet=y
     else
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -10,6 +10,7 @@
 #
 
 KDUMP_CONFIG=/etc/sysconfig/kdump
+FENCE_KDUMP_SEND=/usr/lib/fence_kdump_send
 
 #
 # Global variables
@@ -918,10 +919,9 @@ function kdump_modify_config()                             
                   #
     fi
 
     # copy fence_kdump_send if exists
-    if [ -f "/usr/lib/fence_kdump_send" ] &&
-       ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
-       [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
-        KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS 
/usr/lib/fence_kdump_send"
+    if [ -f "$FENCE_KDUMP_SEND" ] &&
+       [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
+        KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS $FENCE_KDUMP_SEND"
     fi
 
     # make sure NSS works somehow
++++++ kdump-Restore-only-static-routes-in-kdump-initrd.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Thu, 24 May 2018 06:54:28 +0200
Subject: Restore only static routes in kdump initrd
References: bsc#1093795
Upstream: merged
Git-commit: c4484c33a5b228d4a1ebe7c99f14c3b7f38f34ef

All existing routes are now added through the rd.route= dracut
parameter. However, this includes routes that need not or should not
be added explicitly (e.g. installed automatically by the kernel or
dynamically by a routing daemon).

If possible, use wicked to get configured routes. If not, use the
routing protocol identifier to limit the list.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/setup-kdump.functions |   86 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 77 insertions(+), 9 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -518,6 +518,42 @@ kdump_prefix2netmask() {                                   
           # {{{
 }                                                                         # }}}
 
 #
+# Get the IPv4 rd.route= parameters for a given device
+#
+# Parameters:
+#   1) iface   current interface name
+#   2) bootif  interface name in initrd
+# Output:
+#   string that can be used for the rd.route= initrd parameter
+function kdump_ip_routes()                                                # {{{
+{
+    local _iface="$1"
+    local _bootif="$2"
+
+    # remove default routes
+    local _rmdefault='/^default /d'
+    # transform the output of "ip route" into rd.route=
+    local _xform='s/\([^ ]*\)\( via \([^ ]*\)\)\?.*/rd.route=\1:\3/'
+    # add interface name and print
+    local _addintf="s/\$/:${_bootif}/p"
+
+    # get configured routes using wicked if possible
+    if [ -n "$(type -P wicked)" ]
+    then
+       wicked show-config | \
+           wicked xpath --reference \
+                  "/interface[name='$_iface']/ipv4:static/route" \
+                  "rd.route=%{destination}:%{?nexthop/gateway}:$_bootif" \
+                  2>/dev/null
+    else
+        ip route show dev "$_iface" proto boot | \
+           sed -ne "$_rmdefault;$_xform;$_addintf"
+        ip route show dev "$_iface" proto static | \
+           sed -ne "$_rmdefault;$_xform;$_addintf"
+    fi
+}                                                                         # }}}
+
+#
 # Get the IPv4 ip= parameter for a given device
 #
 # Parameters:
@@ -556,12 +592,47 @@ function kdump_ip_config()                                
                   # {{{
 
     if [ -n "$ipaddr" ] ; then
         echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
+       kdump_ip_routes "$iface" "$bootif"
+    fi
+}                                                                         # }}}
+
+#
+# Get the IPv6 rd.route= parameters for a given device
+#
+# Parameters:
+#   1) iface   current interface name
+#   2) bootif  interface name in initrd
+# Output:
+#   string that can be used for the rd.route= initrd parameter
+function kdump_ip6_routes()                                               # {{{
+{
+    local _iface="$1"
+    local _bootif="$2"
 
-        routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ 
]*\).*/\1:\2/p')
-        for r in $routes ; do
-            echo "rd.route=$r:$bootif"
-        done
-    fi 
+    # remove default routes
+    local _rmdefault='/^default /d'
+    # transform the output of "ip route" into rd.route=
+    local _xform='s/\([^ ]*\)\( via \([^ ]*\)\)\?.*/rd.route=[\1]:[\3]/'
+    # remove gateway if empty
+    local _rmgw='s/\[\]$//'
+    # add interface name and print
+    local _addintf="s/\$/:${_bootif}/p"
+
+    # get configured routes using wicked if possible
+    if [ -n "$(type -P wicked)" ]
+    then
+       wicked show-config | \
+           wicked xpath \
+                  --reference "/interface[name='$_iface']/ipv6:static/route" \
+                  "rd.route=[%{destination}]:[%{?nexthop/gateway}]" \
+                  2>/dev/null | \
+           sed -ne "$_rmgw;$_addintf"
+    else
+        ip -6 route show dev "$_iface" proto boot | \
+           sed -ne "$_rmdefault;$_xform;$_rmgw;$_addintf"
+        ip -6 route show dev "$_iface" proto static | \
+           sed -ne "$_rmdefault;$_xform;$_rmgw;$_addintf"
+    fi
 }                                                                         # }}}
 
 #
@@ -604,10 +675,7 @@ function kdump_ip6_config()                                
                   # {{
        echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
     done < <(ip -6 address show dev "$iface" permanent scope global)
 
-    routes=$(ip -6 route show dev "$iface" | sed -n 's/\([0-9a-fA-F:].*\) via 
\([^ ]*\).*/[\1]:[\2]/p')
-    for r in $routes ; do
-        echo "rd.route=$r:$bootif"
-    done
+    kdump_ip6_routes "$iface" "$bootif"
 }                                                                         # }}}
 
 #
++++++ kdump-Use-a-custom-namespace-for-physical-NICs.patch ++++++
From c5a6c610e1b3b4ce34a8769b7772a682fb826bda Mon Sep 17 00:00:00 2001
From: Petr Tesarik <[email protected]>
Date: Thu, 29 Nov 2018 12:54:57 +0100
Subject: Use a custom namespace for physical NICs
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: c5a6c610e1b3b4ce34a8769b7772a682fb826bda

To prevent rename conflicts, use kdumpX as the interface name
instead of the current name.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/setup-kdump.functions |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -11,6 +11,13 @@
 
 KDUMP_CONFIG=/etc/sysconfig/kdump
 
+#
+# Global variables
+#
+
+# Next network interface number
+kdump_ifnum=0
+
 # Extract the device name from a route
 #
 # Input:
@@ -448,7 +455,8 @@ function kdump_ifname_config()                              
                   #
 
     if [ -z "$_ifkind" ]
     then
-       kdump_iface="$_iface"
+       kdump_iface="kdump$kdump_ifnum"
+       kdump_ifnum=$(( $kdump_ifnum + 1 ))
        kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
 
        local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
++++++ kdump-activate-udev-rules-late-during-boot.patch ++++++
From 3405c3b3b53f35459f425d7cf3c0ffaf759cade4 Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
Date: Mon, 27 Jan 2020 17:30:24 +0100
Subject: [PATCH] kdump: activate udev rules late during boot

The kdump udev rule is very broad in scope and may slow down
booting strongly, especially during the coldplug phase where
"add" events for lots of CPU and memory devices have to be
processed. Therefore, activate this rule (which has the purpose
to support real hotplug rather than coldplug) late in the boot
sequence.
---
 CMakeLists.txt     | 2 +-
 init/kdump.service | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f16f532..03eb133 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -206,7 +206,7 @@ ADD_CUSTOM_TARGET(
 INSTALL(FILES
     ${CMAKE_CURRENT_BINARY_DIR}/70-kdump.rules
     DESTINATION
-        /etc/udev/rules.d
+        /usr/lib/kdump
 )
 
 #
diff --git a/init/kdump.service b/init/kdump.service
index 997805f..fb19f84 100644
--- a/init/kdump.service
+++ b/init/kdump.service
@@ -5,6 +5,8 @@ After=local-fs.target network.service 
YaST2-Second-Stage.service YaST2-Firstboot
 [Service]
 Type=oneshot
 ExecStart=/lib/kdump/load.sh --update
+ExecStartPost=-/usr/bin/cp /usr/lib/kdump/70-kdump.rules 
/run/udev/rules.d/70-kdump.rules
+ExecStopPost=-/usr/bin/rm -f /run/udev/rules.d/70-kdump.rules
 ExecStop=/lib/kdump/unload.sh
 RemainAfterExit=true
 
-- 
2.25.0

++++++ kdump-block-initrd-parse-etc.service.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Fri, 4 May 2018 12:55:44 +0200
Subject: Block initrd-parse-etc.service until dump is saved
References: bsc#1091186
Upstream: merged
Git-commit: ac14396b33a7d507a65999aa7f70668f9cd15e8e

During boot, custom services like kdump-save.service run in parallel
with other generic initrd services up until initrd.target. However,
a reload from real root may change the dependency graph in a way
that prevents kdump-save.service from finishing. Since kdump needs
only the explicitly listed mount points, boot process may pause
while the dump is being saved. In fact, it is preferable to do so,
lest other processes interfere with kdump itself in the restricted
environment.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/kdump-save.service.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/kdump-save.service.in b/init/kdump-save.service.in
index 7879dc2..a4d6a65 100644
--- a/init/kdump-save.service.in
+++ b/init/kdump-save.service.in
@@ -11,7 +11,7 @@
 Description=save kernel crash dump
 Documentation=man:kdump(7)
 RequiresMountsFor=@KDUMP_MOUNTPOINTS@
-Before=initrd-cleanup.service
+Before=initrd-parse-etc.service
 ConditionPathExists=/etc/initrd-release
 ConditionPathExists=/proc/vmcore
 
-- 
2.13.6

++++++ kdump-calibrate-Update-values.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Tue, 17 Dec 2019 10:49:19 +0100
Subject: calibrate: Update values
References: bsc#1130529
Upstream: merged
Git-commit: 898b9e7fb7f80bd19268678b4abaf74792a3c229

Kernel base image has grown by approx. 20%.
Unpacked initramfs has grown by approx. 50%.

Signed-off-by: Petr Tesarik <[email protected]>

---
 kdumptool/calibrate.cc |   56 ++++++++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -58,10 +58,10 @@
 //
 
 #if defined(__x86_64__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(32)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(38)
 # define KERNEL_INIT_KB                MB(5)
-# define INIT_KB               MB(34)
+# define INIT_KB               MB(51)
 # define INIT_NET_KB           MB(3)
 # define SIZE_STRUCT_PAGE      64
 # define KDUMP_PHYS_LOAD       0
@@ -69,10 +69,10 @@
 # define PERCPU_KB             108
 
 #elif defined(__i386__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(28)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(34)
 # define KERNEL_INIT_KB                MB(4)
-# define INIT_KB               MB(29)
+# define INIT_KB               MB(44)
 # define INIT_NET_KB           MB(2)
 # define SIZE_STRUCT_PAGE      36
 # define KDUMP_PHYS_LOAD       0
@@ -80,10 +80,10 @@
 # define PERCPU_KB             56
 
 #elif defined(__powerpc64__)
-# define DEF_RESERVE_KB                MB(256)
-# define KERNEL_KB             MB(32)
+# define DEF_RESERVE_KB                MB(384)
+# define KERNEL_KB             MB(38)
 # define KERNEL_INIT_KB                MB(5)
-# define INIT_KB               MB(58)
+# define INIT_KB               MB(87)
 # define INIT_NET_KB           MB(4)
 # define SIZE_STRUCT_PAGE      64
 # define KDUMP_PHYS_LOAD       MB(128)
@@ -91,10 +91,10 @@
 # define PERCPU_KB             172     // FIXME: is it non-linear?
 
 #elif defined(__powerpc__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(24)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(29)
 # define KERNEL_INIT_KB                MB(5)
-# define INIT_KB               MB(34)
+# define INIT_KB               MB(51)
 # define INIT_NET_KB           MB(2)
 # define SIZE_STRUCT_PAGE      36
 # define KDUMP_PHYS_LOAD       MB(128)
@@ -102,10 +102,10 @@
 # define PERCPU_KB             0       // TODO !!!
 
 #elif defined(__s390x__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(26)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(31)
 # define KERNEL_INIT_KB                512
-# define INIT_KB               MB(34)
+# define INIT_KB               MB(51)
 # define INIT_NET_KB           MB(2)
 # define SIZE_STRUCT_PAGE      64
 # define KDUMP_PHYS_LOAD       0
@@ -115,10 +115,10 @@
 # define align_memmap          s390x_align_memmap
 
 #elif defined(__s390__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(24)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(29)
 # define KERNEL_INIT_KB                512
-# define INIT_KB               MB(29)
+# define INIT_KB               MB(44)
 # define INIT_NET_KB           MB(2)
 # define SIZE_STRUCT_PAGE      36
 # define KDUMP_PHYS_LOAD       0
@@ -128,10 +128,10 @@
 # define align_memmap          s390_align_memmap
 
 #elif defined(__ia64__)
-# define DEF_RESERVE_KB                MB(512)
-# define KERNEL_KB             MB(64)
+# define DEF_RESERVE_KB                MB(768)
+# define KERNEL_KB             MB(77)
 # define KERNEL_INIT_KB                MB(3)
-# define INIT_KB               MB(44)
+# define INIT_KB               MB(66)
 # define INIT_NET_KB           MB(4)
 # define SIZE_STRUCT_PAGE      64
 # define KDUMP_PHYS_LOAD       0
@@ -139,21 +139,21 @@
 # define PERCPU_KB             0       // TODO !!!
 
 #elif defined(__aarch64__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(26)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(31)
 # define KERNEL_INIT_KB                MB(1)
-# define INIT_KB               MB(29)
-# define INIT_NET_KB           MB(2)
+# define INIT_KB               MB(51)
+# define INIT_NET_KB           MB(3)
 # define SIZE_STRUCT_PAGE      64
 # define KDUMP_PHYS_LOAD       0
 # define CAN_REDUCE_CPUS       1
 # define PERCPU_KB             0       // TODO !!!
 
 #elif defined(__arm__)
-# define DEF_RESERVE_KB                MB(128)
-# define KERNEL_KB             MB(24)
+# define DEF_RESERVE_KB                MB(192)
+# define KERNEL_KB             MB(29)
 # define KERNEL_INIT_KB                MB(1)
-# define INIT_KB               MB(29)
+# define INIT_KB               MB(44)
 # define INIT_NET_KB           MB(2)
 # define SIZE_STRUCT_PAGE      36
 # define KDUMP_PHYS_LOAD       0
++++++ kdump-clean-up-kdump-mount-points.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Mon, 2 Sep 2019 10:01:47 +0200
Subject: Make sure that kdump mount points are cleaned up
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit 83e48556428339668e6f23e1dccc0196a52d1b68

If the system continues to boot, kdump mount points must be
unmounted before switching to the system root. Otherwise, some
filesystems may remain mounted under the now-unavailable initrd
root, keeping the underlying devices busy during system shutdown.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/module-setup.sh |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -246,7 +246,19 @@ install() {
                gsub(/@KDUMP_MOUNTPOINTS@/, mountpoints)
                print
            }' "$moddir/kdump-save.service.in" > \
-           "$initdir/$systemdsystemunitdir"/kdump-save.service
+               "$initdir/$systemdsystemunitdir"/kdump-save.service
+
+        local _d _mp
+        _d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
+        mkdir -p "$_d"
+        (
+            echo "[Unit]"
+            for _mp in "${kdump_mnt[@]}" ; do
+                echo -n "Conflicts="
+                systemd-escape -p --suffix=mount "$_mp"
+            done
+        ) > "$_d"/kdump.conf
+
        ln_r "$systemdsystemunitdir"/kdump-save.service \
            "$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
     else
++++++ kdump-do-not-add-rd.neednet.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Thu, 22 Oct 2020 10:07:56 +0200
Subject: Do not add 'rd.neednet=1' to dracut command line
References: bsc#1177196
Upstream: merged
Git-commit: 2ad80dd96b91b889db44dd8c955cb127840a2be2

According to Thomas Blume, this parameter tries to set up an IP
address on all configured interfaces. That fails e.g. for enslaved
interfaces, which do not have an IP address.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/module-setup.sh |    1 -
 1 file changed, 1 deletion(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -191,7 +191,6 @@ kdump_cmdline_ip() {
 
     kdump_ifname_config "$kdump_host_if"
 
-    echo -n "rd.neednet=1"
     echo -n "$kdump_netif"
 
     case "$kdump_net_mode" in
++++++ kdump-fadump-add-udev-support.patch ++++++
From: Hari Bathini <[email protected]>
Subject: fadump: add udev event support for fadump
References: bsc#1108170
Upstream: merged
Git-commit: eb5784f6cb8368b346b9b52be66116fc5a47f720

Currently, the udev rules written in kdump package only support reloading
kdump on memory/cpu hot add/remove operation. But this is needed as much
for FADump as well. The rules were not updated to support fadump owing to
lack of support in the kernel for re-registering FADump. This support is
now added to kernel with commit 0823c68b054b ("powerpc/fadump: re-register
firmware-assisted dump if already registered"). Update kdump udev rules
to load fadump on memory/cpu DLPAR operations.

Signed-off-by: Hari Bathini <[email protected]>
Signed-off-by: Petr Tesarik <[email protected]>
---
 70-kdump.rules.in |    3 +++
 init/load.sh      |   29 ++++++++++++++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

--- a/70-kdump.rules.in
+++ b/70-kdump.rules.in
@@ -21,6 +21,9 @@ GOTO="kdump_end"
 # Reload only if panic kernel is already loaded
 LABEL="kdump_try_restart"
 PROGRAM="/bin/cat /sys/kernel/kexec_crash_loaded", RESULT!="0", 
RUN+="/lib/kdump/load-once.sh"
+@if @ARCH@ ppc64 ppc64le
+TEST=="/sys/kernel/fadump_registered", PROGRAM="/bin/cat 
/sys/kernel/fadump_registered", RESULT!="0", RUN+="/lib/kdump/load-once.sh"
+@endif
 
 LABEL="kdump_end"
 @endif
--- a/init/load.sh
+++ b/init/load.sh
@@ -243,21 +243,24 @@ function load_kdump_fadump()
 
     local msg
     local result=0
+    local output
 
-    # The kernel fails with EINVAL if registered already
-    # (see bnc#814780)
-    if [ "$(cat $FADUMP_REGISTERED)" != "1" ] ; then
-        local output
-
-        output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
-        if [ $? -eq 0 ] ; then
-           msg="Registered fadump"
-       else
-           msg="FAILED to register fadump: $output"
-            result=1
-       fi
+    # Re-registering of FADump is supported in kernel (see bsc#1108170).
+    # So, don't bother about whether FADump was registered already
+    output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
+    if [ $? -eq 0 ] ; then
+        msg="Registered fadump"
     else
-       msg="fadump is already registered"
+        # For backward compatibility on older kernel that
+        # returns -EEXIST/-EINVAL
+        if [ "$(cat $FADUMP_REGISTERED)" == "1" ] ; then
+            # TODO: unregiser/register OR warn user to stop/start?
+            # Best bet is to update to latest kernel.
+            msg="fadump is already registered"
+        else
+            msg="FAILED to register fadump: $output"
+            result=1
+        fi
     fi
 
     echo "$msg"
++++++ kdump-fadump-avoid-multipath-optimizations.patch ++++++
From: Hari Bathini <[email protected]>
Date: Mon, 20 Aug 2018 16:11:38 +0200
Subject: fadump: avoid multipath optimizations that break regular boot
References: bsc#1101730
Upstream: merged
Git-commit: dc29a820687a3a267c56ad1b125cb670dbd194ad

Since commit 9a3764178a91 ("Blacklist unneeded multipath devices")
multipath devices that are not needed while capturing dump were
blacklisted. This reduces the memory requirements on kdump kernel.
But when this optimization is added to default initrd by including
dump capturing support for FADump, it is observed to mess with the
initialization of such blacklisted multipath devices while booting
the production kernel. To avoid such issues, use this optimization
only while booting a capture kernel.

Signed-off-by: Hari Bathini <[email protected]>
Acked-by: Petr Tesarik <[email protected]>
---
 init/CMakeLists.txt        |    1 +
 init/kdump-boot.sh         |   16 ++++++++++++++++
 init/module-setup.sh       |    1 +
 init/setup-kdump.functions |    2 +-
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100755 init/kdump-boot.sh

--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -98,6 +98,7 @@ INSTALL(
 INSTALL(
     FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/kdump-root.sh
+        ${CMAKE_CURRENT_SOURCE_DIR}/kdump-boot.sh
         ${CMAKE_CURRENT_SOURCE_DIR}/module-setup.sh
         ${CMAKE_CURRENT_SOURCE_DIR}/mount-kdump.sh
     DESTINATION
--- /dev/null
+++ b/init/kdump-boot.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# An Initrd with dump capturing support can boot a production kernel
+# as well (FADump). In such scenario, apply optimizations only while
+# booting the capture kernel - this is a kernel that
+#   a) has a /proc/vmcore file waiting to be saved.
+#   b) reboots after saving the dump.
+
+# apply multipath optimizations
+if [ -s /proc/vmcore ]; then
+    # Replace the multipath.conf file with the one optimized for kdump.
+    rm -f /etc/multipath.conf
+    mv /etc/multipath.conf.kdump /etc/multipath.conf
+fi
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -264,6 +264,7 @@ install() {
     kdump_setup_files "$initdir" "$kdump_mpath_wwids"
 
     inst_hook cmdline 50 "$moddir/kdump-root.sh"
+    inst_hook cmdline 50 "$moddir/kdump-boot.sh"
     if dracut_module_included "systemd" ; then
        inst_binary "$moddir/device-timeout-generator" \
            "$systemdutildir"/system-generators/kdump-device-timeout-generator
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -1179,7 +1179,7 @@ function kdump_setup_files()                              
                   # {
     #
     # create modified multipath.conf
     #
-    kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf"
+    kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf.kdump"
 
     #
     # filter out problematic sysctl settings
++++++ kdump-fadump-fix-network-bring-up.patch ++++++
From: Hari Bathini <[email protected]>
Date: Mon, 20 Aug 2018 16:12:51 +0200
Subject: fadump: fix network bring up issue during default boot
References: bsc#1101730
Upstream: merged
Git-commit: 0ad221c8a81ee812b3afec6a9c873bd5bd1c228b

If ssh is used for dump target, kdump module enforces bringing up the
network (rd.neednet=1). If bringing up the network fails, it drops to
emergency shell. This sounds ok for a kdump kernel as it's only job is
to save dump to the specified dump target and reboot. But in case of
FADump, kdump module, which adds dump capturing support in the initrd,
is added to the regular initrd. If network bring up fails, production
kernel also falls to emergency shell while booting. Considering this
requirement has no relevance in booting a production kerne, that could
have been avoided. Fix it here by enforcing rd.neednet=1 only while
booting a capture kernel.

Signed-off-by: Hari Bathini <[email protected]>
Acked-by: Petr Tesarik <[email protected]>
---
 init/kdump-boot.sh |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/init/kdump-boot.sh
+++ b/init/kdump-boot.sh
@@ -3,8 +3,9 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 # An Initrd with dump capturing support can boot a production kernel
-# as well (FADump). In such scenario, apply optimizations only while
-# booting the capture kernel - this is a kernel that
+# as well (FADump). In such scenario, apply optimizations and enforce
+# bringing up dump target only while booting the capture kernel - this
+# is a kernel that
 #   a) has a /proc/vmcore file waiting to be saved.
 #   b) reboots after saving the dump.
 
@@ -13,4 +14,7 @@ if [ -s /proc/vmcore ]; then
     # Replace the multipath.conf file with the one optimized for kdump.
     rm -f /etc/multipath.conf
     mv /etc/multipath.conf.kdump /etc/multipath.conf
+else
+    # avoid enforing network bring up while booting production kernel.
+    rm -f /etc/cmdline.d/99kdump-net.conf
 fi
++++++ kdump-fallback-re-register-fadump-from-userspace.patch ++++++
From 4084339bb6e7c605dab7a48a98b97510f555d343 Mon Sep 17 00:00:00 2001
From: Hari Bathini <[email protected]>
Date: Thu, 27 Sep 2018 17:11:58 +0200
Subject: Re-register FADUMP from userspace if the kernel cannot do it
Reference: bsc#1108170, LTC#171288, bsc#1094016, LTC#168050
Upstream: merged
Git-commit: 4084339bb6e7c605dab7a48a98b97510f555d343

If the kernel does not allow writing a "1" to fadump_registered,
unregister and register again from userspace.

Signed-off-by: Hari Bathini <[email protected]>
Acked-by: Petr Tesarik <[email protected]>
---
 init/load.sh | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/init/load.sh
+++ b/init/load.sh
@@ -251,15 +251,20 @@ function load_kdump_fadump()
     if [ $? -eq 0 ] ; then
         msg="Registered fadump"
     else
-        # For backward compatibility on older kernel that
-        # returns -EEXIST/-EINVAL
+        msg="FAILED to register fadump: $output"
+        result=1
+
+        # For re-registering on an older kernel that returns -EEXIST/-EINVAL,
+        # if fadump was already registered.
         if [ "$(cat $FADUMP_REGISTERED)" == "1" ] ; then
-            # TODO: unregiser/register OR warn user to stop/start?
-            # Best bet is to update to latest kernel.
-            msg="fadump is already registered"
-        else
-            msg="FAILED to register fadump: $output"
-            result=1
+            echo 0 > "$FADUMP_REGISTERED"
+            output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
+            if [ $? -eq 0 ] ; then
+                msg="Registered fadump"
+                result=0
+            else
+                msg="FAILED to register fadump: $output"
+            fi
         fi
     fi
 
++++++ kdump-fillupdir-fixes.patch ++++++
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77205e1..3032d3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,7 +182,7 @@ ADD_CUSTOM_TARGET(
 INSTALL(FILES
     ${CMAKE_CURRENT_BINARY_DIR}/sysconfig.kdump
     DESTINATION
-        /var/adm/fillup-templates/
+        /usr/share/fillup-templates/
 )
 
 ADD_CUSTOM_COMMAND(
++++++ kdump-fix-multipath-user_friendly_names.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Thu, 25 Oct 2018 10:02:43 +0200
Subject: Fix multipath configuration with user_friendly_names and/or aliases
References: bsc#1111207, LTC#171953, bsc#1125218, LTC#175465, bsc#1153601
Upstream: merged
Git-commit: 4b4dacfddd456a51c04a878e31d4544223ea9701

The setup script incorrectly uses the name of the multipath device
instead of its WWID (which can be retrieved from the device mapper
UUID simply by removing the "mpath-" prefix).

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/setup-kdump.functions |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -962,9 +962,9 @@ function kdump_map_mpath_wwid()
     local f _dir _uuid _wwid _dev
     for f in /sys/block/*/dm/uuid ; do
        eval "_uuid=\$(<$f)" 2>/dev/null
-       [[ "$_uuid" = mpath-* ]] || continue
+       _wwid="${_uuid#mpath-}"
+       [ "$_wwid" != "$_uuid" ] || continue
        _dir="${f%/dm/uuid}"
-       _wwid=$(<"$_dir"/dm/name)
        _dev=$(<"$_dir"/dev)
        eval kdump_mpath_wwid_${_dev/:/_}=\$_wwid
     done
++++++ kdump-kdumprd-Look-for-boot-image-and-boot-Image.patch ++++++
From d332bb87cd1d093f8b78ff3d79413d84fa26dea3 Mon Sep 17 00:00:00 2001
From: Petr Tesarik <[email protected]>
Date: Fri, 26 Apr 2019 09:27:40 +0200
Subject: kdumprd: Look for /boot/image-* and /boot/Image-*
References: bsc#1132799
Upstream: merged
Git-commit: d332bb87cd1d093f8b78ff3d79413d84fa26dea3

These kernel image names are used on s390(x) and arm*/aarch64,
respectively. Without this change, the path to the kernel must be
given explicitly on the command line if a specific kernel version is
required.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/mkdumprd |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -125,9 +125,9 @@ shift $(($OPTIND -1))
 if [ -z "$KERNEL" ] ; then
     if [ -n "$KERNELVERSION" ] ; then
         KERNEL=/boot/vmlinuz-$KERNELVERSION
-        if ! [ -f "$KERNEL" ] ; then
-            KERNEL=/boot/vmlinux-$KERNELVERSION
-        fi
+        test -f "$KERNEL" || KERNEL=/boot/image-$KERNELVERSION
+        test -f "$KERNEL" || KERNEL=/boot/Image-$KERNELVERSION
+        test -f "$KERNEL" || KERNEL=/boot/vmlinux-$KERNELVERSION
     else
         output=$(kdumptool find_kernel $find_kernel_args)
         KERNEL=$(echo "$output" | grep ^Kernel | cut -f 2)
++++++ kdump-make-sure-that-the-udev-runtime-directory-exists.patch ++++++
From c79aa44d58ef29e22516986641970c343cb15cd0 Mon Sep 17 00:00:00 2001
From: Petr Tesarik <[email protected]>
Date: Tue, 25 Feb 2020 14:47:02 +0100
Subject: Make sure that the udev runtime directory exists
References: bsc#1164713
Upstream: merged
Git-commit: c79aa44d58ef29e22516986641970c343cb15cd0

Hotplug operations will not work with kdump if the udev runtime
directory does not exist at startup.

While fixing it, move udev rules handling to load.sh / unload.sh.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/kdump.service |    2 --
 init/load.sh       |    3 +++
 init/unload.sh     |    2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

--- a/init/kdump.service
+++ b/init/kdump.service
@@ -5,8 +5,6 @@ After=local-fs.target network.service Ya
 [Service]
 Type=oneshot
 ExecStart=/lib/kdump/load.sh --update
-ExecStartPost=-/usr/bin/cp /usr/lib/kdump/70-kdump.rules 
/run/udev/rules.d/70-kdump.rules
-ExecStopPost=-/usr/bin/rm -f /run/udev/rules.d/70-kdump.rules
 ExecStop=/lib/kdump/unload.sh
 RemainAfterExit=true
 
--- a/init/load.sh
+++ b/init/load.sh
@@ -7,6 +7,7 @@ KDUMPTOOL=/usr/sbin/kdumptool
 KEXEC=/sbin/kexec
 FADUMP_ENABLED=/sys/kernel/fadump_enabled
 FADUMP_REGISTERED=/sys/kernel/fadump_registered
+UDEV_RULES_DIR=/run/udev/rules.d
 
 #
 # Remove an option from the kernel command line
@@ -324,6 +325,8 @@ result=$?
 
 if [ $result = 0 ] ; then
     echo 1 > /proc/sys/kernel/panic_on_oops
+    mkdir -p "$UDEV_RULES_DIR"
+    cp /usr/lib/kdump/70-kdump.rules "$UDEV_RULES_DIR"/70-kdump.rules
 fi
 
 exit $result
--- a/init/unload.sh
+++ b/init/unload.sh
@@ -6,6 +6,7 @@
 KDUMPTOOL=/usr/sbin/kdumptool
 KEXEC=/sbin/kexec
 FADUMP_REGISTERED=/sys/kernel/fadump_registered
+UDEV_RULES_DIR=/run/udev/rules.d
 
 eval $($KDUMPTOOL dump_config)
 
@@ -21,4 +22,5 @@ fi
 
 test $? -eq 0 || exit 1
 
+rm -f "$UDEV_RULES_DIR"/70-kdump.rules
 exit 0
++++++ kdump-nss-modules.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Thu, 14 Nov 2019 19:13:39 +0100
Subject: Improve the handling of NSS
References: bsc#1021846
Upstream: merged
Git-commit 598d7517ccbbf29dc51e0a9c14146722d2324731

The current code mostly works, but can be improved in two ways:

1. Only the 'hosts' database is really needed in the kdump
   environment, and its settings should be copied from the running
   system. The openSSH client also needs 'passwd' (and maybe
   'group'), but it is not necessary to handle fancy setups (such
   as NIS or AD). The client merely requires that UID 0 can be
   translated to a user name. The 'file' service is more than
   sufficient for that purpose.

2. The NSS configuration file may not contain configuration of all
   categories. If configuration for a given category is missing,
   glibc will use a default setting, but kdump will not install
   the corresponding modules. Fix it by adding the glibc default
   to the configuration file explicitly if needed.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/setup-kdump.functions |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -892,8 +892,6 @@ function kdump_modify_config()                              
                   #
             KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
        elif [ "$protocol" != "srcfile" ] ; then
             KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
-            cp /etc/hosts "${dest}/etc"
-            grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
        fi
 
        #
@@ -919,6 +917,26 @@ function kdump_modify_config()                             
                   #
        KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
     fi
 
+    # make sure NSS works somehow
+    cp /etc/hosts "${dest}/etc"
+    { cat <<-EOF
+       passwd: files
+       shadow: files
+       group: files
+EOF
+      grep '^[[:space:]]*hosts:' /etc/nsswitch.conf \
+         || echo 'hosts: dns [!UNAVAIL=return] files'
+    } > "${dest}/etc/nsswitch.conf"
+
+    # install necessary NSS modules
+    local _nssmods=$(
+       sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
+           "${dest}/etc/nsswitch.conf" \
+           | tr -s '[:space:]' '\n' | sort -u | tr '\n' '|' )
+    _nssmods=${_nssmods#|}
+    _nssmods=${_nssmods%|}
+    inst_libdir_file -n "/libnss_($_nssmods)" 'libnss_*.so*'
+
     #
     # dump the configuration file, modifying:
     #   KDUMP_SAVEDIR  -> resolved path
++++++ kdump-on-error-option-yesno.patch ++++++
From: Lance Wang <[email protected]>
Subject: Support yes/no style for KDUMP_CONTINUE_ON_ERROR
References: bsc#1083155
Upstream: tbd

The /etc/sysconfig/kdump in latest kdump initrd is generated by
kdumptool. So the value of KDUMP_CONTINUE_ON_ERROR is yes instead
of true. This patch make save_dump.sh support this value.

Signed-off-by: Lance Wang <[email protected]>
Acked-by: Petr Tesarik <[email protected]>

---
 init/save_dump.sh |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

--- a/init/save_dump.sh
+++ b/init/save_dump.sh
@@ -101,16 +101,20 @@ function continue_error()
 
     echo "Last command failed ($status)."
 
-    if ! [ "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \
-                "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ] ; then
-        echo
-        echo "Something failed. You can try to debug that here."
-        echo "Type 'reboot -f' to reboot the system or 'exit' to"
-        echo "boot in a normal system that still is running in the"
-        echo "kdump environment with restricted memory!"
-        bash
-       return 1
+    if [ "$KDUMP_CONTINUE_ON_ERROR" = "yes" -o \
+         "$KDUMP_CONTINUE_ON_ERROR" = "YES" -o \
+         "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \
+         "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ]; then
+        return 0
     fi
+
+    echo
+    echo "Something failed. You can try to debug that here."
+    echo "Type 'reboot -f' to reboot the system or 'exit' to"
+    echo "boot in a normal system that still is running in the"
+    echo "kdump environment with restricted memory!"
+    bash
+    return 1
 }
 
 function rw_fixup()
++++++ kdump-powerpc-no-reload-on-CPU-removal.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Fri, 6 Dec 2019 09:54:57 +0100
Subject: powerpc: Do not reload on CPU hot removal
References: bsc#1133407, LTC#176111
Git-commit: d1c4f630f0da0bf43928e3c975f02e832b2df50f

Skipping reload after a CPU goes offline does not have any adverse
impact, as /sys/devices/system/cpu/cpuX nodes are present for all
"possible" CPUs on PPC64.

The udev rule for CPU online operation is still needed. If reload
is skipped and the system crashes on a hot-added CPU, the kdump
kernel fails to get the 'boot_cpuid' after a hot plug and
eventually fails (see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file).

Signed-off-by: Petr Tesarik <[email protected]>

---
 70-kdump.rules.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/70-kdump.rules.in
+++ b/70-kdump.rules.in
@@ -13,7 +13,7 @@
 
 SUBSYSTEM=="memory", ACTION=="add|remove", GOTO="kdump_try_restart"
 @if @ARCH@ ppc ppc64 ppc64le
-SUBSYSTEM=="cpu", ACTION=="online|offline", GOTO="kdump_try_restart"
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_try_restart"
 @endif
 
 GOTO="kdump_end"
++++++ kdump-prefer-by-path-and-device-mapper.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Mon, 16 Dec 2019 13:33:19 +0100
Subject: Prefer by-path and device-mapper aliases over kernel names
References: bsc#1101149, LTC#168532
Upsream: merged
Git-commit: f153c9ac3f1baf8d1cf66c901b41f7bff19ff528

Mounting by kernel names (e.g. /dev/sda) is generally broken, since
these names are allocated dynamically by the kernel and may change
after a panic kexec. This issue can be usually avoided by using a
more stable tag in /etc/fstab (e.g. UUID=xyz).

However, there are supported ways to mount a filesystem with no
corresponding line in /etc/fstab, and kdump uses /proc/mounts as
fallback. This file shows the block device using the name that was
given as argument to the mount syscall. This name is usually
translated to the kernel name by libblkid(3). As a result, it does
not reflect the original intention, e.g.:

    ezekiel:~ # mount UUID=9A4D-9B2B /mnt/data/
    ezekiel:~ # grep /mnt/data /proc/mounts
    /dev/sda /mnt/data vfat 
rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
 0 0
    ezekiel:~ # grep /mnt/data /proc/self/mountinfo
    187 94 8:0 / /mnt/data rw,relatime shared:56 - vfat /dev/sda 
rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro

As the original intention cannot be recovered, it is probably
better to prefer the by-path alias. The semantic of this alias is
closest to the traditional UNIX use of raw block device names: it's
always the drive attached to a known physical connector, regardless
of which medium is inserted.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/module-setup.sh       |    3 ++-
 init/setup-kdump.functions |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -90,7 +90,8 @@ kdump_add_mnt() {
     mkdir -p "$initdir/etc"
     local _passno=2
     [ "${kdump_fstype[_idx]}" = nfs ] && _passno=0
-    echo "${kdump_dev[_idx]} ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} 
${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
+    _dev=$(kdump_mount_dev "${kdump_dev[_idx]}")
+    echo "$_dev ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 
$_passno" >> "$initdir/etc/fstab"
 }
 
 check() {
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -716,6 +716,33 @@ function kdump_get_targets()                               
                   # {
 }                                                                         # }}}
 
 #
+# Get a block device specification that is suitable for use as the
+# first column in /etc/fstab.
+# Since device node names may change after kexec, more stable symlink
+# are preferred (by-path alias or device mapper name).
+# Parameters:
+#   1) _dev: block device specification
+# Output:
+#   block device specification to be used in /etc/fstab
+function kdump_mount_dev()                                                # {{{
+{
+    local _dev="$1"
+
+    if [ ! -L "$_dev" -a -b "$_dev" ] ; then
+       local _symlink
+       for _symlink in $(udevadm info --root --query=symlink "$_dev")
+       do
+           case "$_symlink" in
+               */by-path/*|*/mapper/*)
+                   _dev="$_symlink"
+                   break
+           esac
+       done
+    fi
+    echo "$_dev"
+}                                                                         # }}}
+
+#
 # Read and normalize /etc/fstab and /proc/mounts (if exists).
 # The following transformations are done:
 #   - initial TABs and SPACEs are removed
++++++ kdump-preserve-white-space.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Tue, Nov 12 2019 14:53:37 +0100
Subject: Preserve white space when removing kernel command line options
References: bsc#1117652
Upstream: merged
Git-commit: 23d593b54a9c97a204ea7412e53c60d3d3852cab

The function was originally designed to remove unwanted options
from the panic kernel command line. It is now also used to check
whether the current command line contains a fadump option or not,
but the check is broken, because remove_from_commandline() may
change the amount (and type) of white space. For example, it
always adds an extra space if the original string ends with a
space.

Modify the function to copy original separators verbatim, except
that any white space preceding the removed option is removed.

Fixes: a4718a2c7b714d0594903fc8dc5ae47252a9b9ba
Signed-off-by: Petr Tesarik <[email protected]>

---
 init/load.sh |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

--- a/init/load.sh
+++ b/init/load.sh
@@ -17,15 +17,13 @@ function remove_from_commandline()
     awk 'BEGIN { ORS="" }
     {
         while(length()) {
-            sub(/^[[:space:]]+/,"");
-            pstart=match($0,/("[^"]*"?|[^"[:space:]])+/);
-            plength=RLENGTH;
-            param=substr($0,pstart,plength);
-            raw=param;
+            match($0,/^([[:space:]]*)(.*)/,w);
+            match(w[2],/(("[^"]*"?|[^"[:space:]])+)(.*)/,p);
+            raw=p[1];
             gsub(/"/,"",raw);
             if (raw !~ /^('"$option"')(=|$)/)
-                print param " ";
-            $0=substr($0,pstart+plength);
+                print w[1] p[1];
+            $0=p[3];
         }
         print "\n";
     }'
++++++ kdump-recover-from-missing-CRASHTIME.patch ++++++
From: Petr Tesarik <[email protected]>
Subject: Recover from missing CRASHTIME= in VMCOREINFO
References: bsc#1112387
Upstream: merged
Git-commit: 0bc94943a1df4d923aa20b9bd1ff01ed2e49d70c

CRASHTIME= may be missing in Xen Dom0 dumps.
Vmcoreinfo::getLLongValue throws an exception in that case, but then
OSRELEASE will not even be attempted. Consequently, kernel and
system map files are not copied, producing the following message:

INFO: Don't copy the kernel and System.map because of missing crash kernel 
release.

Signed-off-by: Petr Tesarik <[email protected]>
---
 kdumptool/savedump.cc |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -469,13 +469,23 @@ void SaveDump::fillVmcoreinfo()
 {
     Vmcoreinfo vm;
     vm.readFromELF(m_dump.c_str());
-    unsigned long long time = vm.getLLongValue("CRASHTIME");
+    unsigned long long crashtime;
 
-    m_crashtime = Stringutil::formatUnixTime("%Y-%m-%d %H:%M (%z)", time);
+    try {
+       crashtime = vm.getLLongValue("CRASHTIME");
+    } catch (const KError &error) {
+        Debug::debug()->dbg("Error getting CRASHTIME: %s", error.what());
+        crashtime = time(NULL);
+    }
+    m_crashtime = Stringutil::formatUnixTime("%Y-%m-%d %H:%M (%z)", crashtime);
 
-    // don't overwrite m_crashrelease from command line
-    if (m_crashrelease.size() == 0)
-        m_crashrelease = vm.getStringValue("OSRELEASE");
+    try {
+       // don't overwrite m_crashrelease from command line
+       if (m_crashrelease.size() == 0)
+           m_crashrelease = vm.getStringValue("OSRELEASE");
+    } catch (const KError &error) {
+        Debug::debug()->dbg("Error getting OSRELEASE: %s", error.what());
+    }
 
     Debug::debug()->dbg("Using crashtime: %s, crashrelease: %s",
         m_crashtime.c_str(), m_crashrelease.c_str());
++++++ kdump-remove-console-hvc0-from-commandline.patch ++++++
From: Olaf Hering <[email protected]>
Date: Tue, 10 Nov 2020 20:06:23 +0100
Subject: remove console=hvc0 from commandline
References: bsc#1173914
Upstream: merged
Git-commit: fbb4d67a706c9e401272b65fa615da6b04263e5f

If kdump is prepared in a dom0, the dom0 kernel cmdline is used
verbatim for the kdump kernel, modulo known-to-be-bad options.
As a result 'console=hvc0' is passed to the kdump kernel.
In a native environment this option causes the kdump kernel to hang,
the system never comes back.

Remove it from the kdump cmdline to make sure the kdump kernel boots.

Signed-off-by: Olaf Hering <[email protected]>
---
 init/load.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/init/load.sh
+++ b/init/load.sh
@@ -83,7 +83,7 @@ function build_kdump_commandline()
             test -n "$boot_apicid" && \
                commandline="$commandline disable_cpu_apicid=$boot_apicid"
             commandline=$(echo "$commandline" |
-                remove_from_commandline 'unknown_nmi_panic|notsc')
+                remove_from_commandline 'unknown_nmi_panic|notsc|console=hvc0')
             ;;
        s390*)
            commandline="$commandline zfcp.allow_lun_scan=0"
++++++ kdump-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch ++++++
From 3ea13723f93cc22d163f1f1c8e64ccef3fa32471 Mon Sep 17 00:00:00 2001
From: "Lee, Chun-Yi" <[email protected]>
Date: Tue, 5 Mar 2019 15:06:10 +0800
Subject: Remove noefi and acpi_rsdp for EFI firmware
References: bsc#1123940
Upstream: merged
Git-commit: 3ea13723f93cc22d163f1f1c8e64ccef3fa32471

The noefi and acpi_rsdp can be removed because kernel passes necessary
EFI data for kexec via setup_data since 1fec05336 patch be introduced
in v3.14 kernel. (bsc#1098210)

On the other hand, the MOK (machine owner key) doesn't work with noefi.
It causes that third-party signed kernel modules can not be loaded by
crash kernel. Crash kernel can provide EFI runtime services for loading
MOK after noefi be removed. (bsc#1123940)

The kdump without noefi has been tested on Huawei Kunlun, Intel
minnowboard and KVM-OVMF.

Signed-off-by: Lee, Chun-Yi <[email protected]>
Acked-by: Petr Tesarik <[email protected]>
---
 init/load.sh |   11 -----------
 1 file changed, 11 deletions(-)

--- a/init/load.sh
+++ b/init/load.sh
@@ -5,7 +5,6 @@
 
 KDUMPTOOL=/usr/sbin/kdumptool
 KEXEC=/sbin/kexec
-EFI_SYSTAB=/sys/firmware/efi/systab
 FADUMP_ENABLED=/sys/kernel/fadump_enabled
 FADUMP_REGISTERED=/sys/kernel/fadump_registered
 
@@ -97,16 +96,6 @@ function build_kdump_commandline()
             kernelrelease=$(uname -r)
             commandline="$commandline kernelversion=$kernelrelease"
         fi
-
-       if [ -f /sys/firmware/efi/systab ] ; then
-           local acpi_addr
-           if grep -q '^ACPI20=' /sys/firmware/efi/systab ; then
-               acpi_addr=$(awk -F'=' '/^ACPI20=/ {print $2}' "$EFI_SYSTAB")
-           else
-               acpi_addr=$(awk -F'=' '/^ACPI=/ {print $2}' "$EFI_SYSTAB")
-           fi
-           commandline="$commandline noefi acpi_rsdp=$acpi_addr"
-       fi
     fi
 
     commandline="$commandline $KDUMP_COMMANDLINE_APPEND"
++++++ kdump-rpmlintrc ++++++
addFilter("incoherent-init-script-name");

# :mode=python:
++++++ kdump-savedump-search-also-for-vmlinux.xz.patch ++++++
From: Jiri Slaby <[email protected]>
Date: Wed, 6 Nov 2019 11:35:50 +0100
Subject: savedump: search also for vmlinux.xz
Patch-mainline: yes
Git-commit: f1ef93a2fd465c6590edddc6dc1fcb3978c7f26b
References: bnc#1155921

See https://bugzilla.suse.com/show_bug.cgi?id=1155921

Signed-off-by: Jiri Slaby <[email protected]>
---
 kdumptool/savedump.cc | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index 282f52e71f66..b8b6be13c3f8 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -596,7 +596,14 @@ string SaveDump::findKernel()
     if (binaryroot.exists())
         return binary;
 
-    // 3: vmlinuz (check if ELF file)
+    // 3: vmlinux.xz
+    (binary = "/boot").appendPath("vmlinux-" + m_crashrelease + ".xz");
+    (binaryroot = m_rootdir).appendPath(binary);
+    Debug::debug()->dbg("Trying %s", binaryroot.c_str());
+    if (binaryroot.exists())
+        return binary;
+
+    // 4: vmlinuz (check if ELF file)
     (binary = "/boot").appendPath("vmlinuz-" + m_crashrelease);
     (binaryroot = m_rootdir).appendPath(binary);
     Debug::debug()->dbg("Trying %s", binaryroot.c_str());
@@ -605,14 +612,14 @@ string SaveDump::findKernel()
         return binary;
     }
 
-    // 4: image
+    // 5: image
     (binary = "/boot").appendPath("image-" + m_crashrelease);
     (binaryroot = m_rootdir).appendPath(binary);
     Debug::debug()->dbg("Trying %s", binaryroot.c_str());
     if (binaryroot.exists())
         return binary;
 
-    // 5: Image
+    // 6: Image
     (binary = "/boot").appendPath("Image-" + m_crashrelease);
     (binaryroot = m_rootdir).appendPath(binary);
     Debug::debug()->dbg("Trying %s", binaryroot.c_str());
-- 
2.24.0

++++++ kdump-set-serial-console-from-Xen-cmdline.patch ++++++
From: Olaf Hering <[email protected]>
Date: Tue, 10 Nov 2020 21:39:39 +0100
Subject: set serial console from Xen cmdline
References: bsc#1173914
Upstream: merged
Git-commit: e3b10c632c6f05028454bbf98cf4fc0e180c2b0d

In case Xen has its console to a serial port, construct the matching
Linux console= kernel cmdline option for the kdump kernel.

Allow to skip this logic in case KDUMP_COMMANDLINE_APPEND is set.

Signed-off-by: Olaf Hering <[email protected]>
---
 init/load.sh |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

--- a/init/load.sh
+++ b/init/load.sh
@@ -31,6 +31,57 @@ function remove_from_commandline()
     }'
 }
 
+# Construct console= parameter for kdump kernel from current Xen cmdline
+function set_serial_console()
+{
+    local com1 com2 unhandled opt
+    local maybe_console
+    local kdump_console
+
+    test -f /proc/xen/capabilities || return
+    grep -wq 'control_d' /proc/xen/capabilities || return
+    test -x "$(type -P xl)" || return
+
+    read xen_commandline < <(xl info | awk -F ':' '/^xen_commandline/{print 
$2}')
+    test -n "${xen_commandline}" || return
+
+    for opt in ${xen_commandline}
+    do
+        unhandled=
+        case "${opt}" in
+        console=com1) maybe_console='ttyS0' ;;
+        console=com2) maybe_console='ttyS1' ;;
+        com1=*,*) unhandled=1 ; com1= ;;
+        com1=*) com1="${opt#*=}" ;;
+        com2=*,*) unhandled=1 ; com2=;;
+        com2=*) com2="${opt#*=}" ;;
+        console=*com*) unhandled=1 ; maybe_console= ;;
+        *) ;;
+        esac
+        test -n "${unhandled}" && echo >&2 "${opt} in Xen commandline not 
handled"
+    done
+
+    test -n "${maybe_console}" || return
+
+    case "${maybe_console}" in
+    ttyS0)
+        test -n "${com1}" && kdump_console="console=${maybe_console},${com1}"
+    ;;
+    ttyS1)
+        test -n "${com2}" && kdump_console="console=${maybe_console},${com2}"
+    ;;
+    esac
+
+    test -n "${kdump_console}" || return
+
+    if test -n "${KDUMP_COMMANDLINE_APPEND}"
+    then
+        echo >&2 "KDUMP_COMMANDLINE_APPEND is set, assuming it already 
contains '${kdump_console}'"
+        return
+    fi
+
+    echo "${kdump_console}"
+}
 #
 # Get the name of kernel parameter to limit CPUs
 # Linux 2.6.34+ has nr_cpus, older versions must use maxcpus
@@ -98,6 +149,7 @@ function build_kdump_commandline()
         fi
     fi
 
+    commandline="$commandline $(set_serial_console)"
     commandline="$commandline $KDUMP_COMMANDLINE_APPEND"
 
     # Add panic=1 unless there is a panic option already
++++++ kdump-skip-mounts-if-no-proc-vmcore.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Mon, 2 Sep 2019 15:27:24 +0200
Subject: Skip kdump-related mounts if there is no /proc/vmcore
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit b91c1e16d373e5631ce725acf52db097d8248389

With FADUMP, the same initrd is used for saving a dump and for
normal boot. It is not necessary to mount kdump-related filesystems
on a normal boot, so let's add a systemd condition.

Signed-off-by: Petr Tesarik <[email protected]>

---
 init/module-setup.sh |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -249,13 +249,18 @@ install() {
                "$initdir/$systemdsystemunitdir"/kdump-save.service
 
         local _d _mp
+        local _mnt
         _d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
         mkdir -p "$_d"
         (
             echo "[Unit]"
             for _mp in "${kdump_mnt[@]}" ; do
-                echo -n "Conflicts="
-                systemd-escape -p --suffix=mount "$_mp"
+                _mnt=$(systemd-escape -p --suffix=mount "$_mp")
+                _d="$initdir/$systemdsystemunitdir/$_mnt".d
+                mkdir -p "$_d"
+                echo -e "[Unit]\nConditionPathExists=/proc/vmcore" \
+                     > "$_d"/kdump.conf
+                echo "Conflicts=$_mnt"
             done
         ) > "$_d"/kdump.conf
 
++++++ kdump-split-cmdline-purpose-wise.patch ++++++
From: Hari Bathini <[email protected]>
Date: Mon, 20 Aug 2018 16:12:46 +0200
Subject: cmdline: split kdump cmdline purpose wise
References: bsc#1101730
Upstream: merged
Git-commit: 56c8821596ee64c400e66002d17449007d1bd5f0

Generate different cmdline files for different purposes. This gives
flexibilty in handling them independently. The subsequent patch uses
this in handling network bringup more gracefully.

Signed-off-by: Hari Bathini <[email protected]>
Acked-by: Petr Tesarik <[email protected]>
---
 init/module-setup.sh |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -205,10 +205,12 @@ kdump_cmdline_ip() {
     esac
 }
 
-cmdline() {
+cmdline_zfcp() {
     local _arch=$(uname -m)
     [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && kdump_cmdline_zfcp
+}
 
+cmdline_net() {
     kdump_cmdline_ip
 }
 
@@ -219,8 +221,11 @@ installkernel() {
 
 install() {
     if [[ $hostonly_cmdline == "yes" ]] ; then
-        local _cmdline=$(cmdline)
-        [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> 
"${initdir}/etc/cmdline.d/99kdump.conf"
+        local _cmdline=$(cmdline_zfcp)
+        [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> 
"${initdir}/etc/cmdline.d/99kdump-zfcp.conf"
+
+        _cmdline=$(cmdline_net)
+        [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> 
"${initdir}/etc/cmdline.d/99kdump-net.conf"
     fi
 
     # Get a list of required multipath devices
++++++ kdump-turn-off-NUMA-in-kdump-kernel.patch ++++++
From: Petr Tesarik <[email protected]>
Date: Tue, 25 Sep 2018 09:23:04 +0200
Subject: Turn off NUMA in the kdump kernel
References: bsc#1109784, bsc#1102609
Upstream: merged
Git-commit: 4c0e78b9923f0dbba3ad1bacc2336d91f7b520e5

On NUMA systems, the crashkernel reserved region may get allocated
on a different node than the low region (memory below 4G). With NUMA
optimization turned on, the kernel will prefer node-local pages for
all page allocations, which may unnecessarily deplete the DMA and
DMA32 regions with data that could be allocated from the Normal
zone (which is on a remote node).

It makes little sense to address this corner case in the memory
management system, because nobody would build a machine with almost
all memory on a remote node. So, instead, let's turn off NUMA for
kdump and accept the potential performance hit.

Signed-off-by: Petr Tesarik <[email protected]>
---
 init/load.sh |    1 +
 1 file changed, 1 insertion(+)

--- a/init/load.sh
+++ b/init/load.sh
@@ -73,6 +73,7 @@ function build_kdump_commandline()
         fi
         # Use deadline for saving the memory footprint
         commandline="$commandline elevator=deadline sysrq=yes reset_devices 
acpi_no_memhotplug cgroup_disable=memory nokaslr"
+        commandline="$commandline numa=off"
         commandline="$commandline irqpoll ${nr_cpus}"
         commandline="$commandline root=kdump rootflags=bind 
rd.udev.children-max=8"
         case $(uname -i) in
++++++ kdump-use-pbl.patch ++++++
Date: Mon Jul 2 18:12:34 2018 +0200
From: Michal Koutný <[email protected]>
Subject: Replace obsolete perl-Bootloader library with a simpler script
References: bsc#1050349
Upstream: tbd

Signed-off-by: Michal Koutný <[email protected]>
Acked-by: Petr Tesarik <[email protected]>

---
 init/CMakeLists.txt      |    1 
 init/kdump-bootloader.pl |   48 -----------------------------------------------
 init/load.sh             |   14 ++-----------
 3 files changed, 3 insertions(+), 60 deletions(-)

--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -65,7 +65,6 @@ INSTALL(
 INSTALL(
     FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/mkdumprd
-        ${CMAKE_CURRENT_SOURCE_DIR}/kdump-bootloader.pl
     DESTINATION
         /usr/sbin
     PERMISSIONS
--- a/init/load.sh
+++ b/init/load.sh
@@ -214,18 +214,10 @@ function fadump_bootloader()
     local newstate="$1"
 
     # check if the old configuration is still valid
-    boot_opts=$(kdump-bootloader.pl --get)
-    nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump')
-    old_opts=$($KDUMPTOOL -F /dev/null -C <(echo "$boot_opts") \
-               dump_config --usage dump --format kernel --nodefault)
     if [ "$newstate" = on ] ; then
-       curr_opts=$($KDUMPTOOL dump_config --usage dump --format kernel 
--nodefault)
-       if [ "$old_opts" != "$curr_opts" -o \
-            "$boot_opts" = "$nofadump_opts" ] ; then
-           kdump-bootloader.pl --update fadump=on "$curr_opts"
-       fi
-    elif [ "$boot_opts" != "$nofadump_opts" ] ; then
-       kdump-bootloader.pl --update
+        pbl --add-option fadump=on --config
+    else
+        pbl --del-option fadump=on --config
     fi
 }
 
--- a/init/kdump-bootloader.pl
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /usr/bin/perl
-
-use Bootloader::Tools;
-
-Bootloader::Tools::InitLibrary();
-
-my $grub2;
-my $section;
-if (Bootloader::Tools::GetBootloader() =~ /^(grub2|grub2-efi)$/) {
-    $grub2 = true;
-    $section = Bootloader::Tools::GetGlobals();
-} else {
-    $grub2 = false;
-    $section = Bootloader::Tools::GetDefaultSection();
-}
-
-if ($ARGV[0] eq "--get") {
-    print $section->{"append"};
-} elsif ($ARGV[0] eq "--update") {
-    my $input = $section->{"append"};
-    my $result;
-    while (length($input)) {
-       $input =~ s/^[[:space:]]+//;
-       if ($input =~ s/^("[^"]*"?|[^"[:space:]]+)+//) {
-           my $rawparam = $&;
-           my $param = $rawparam;
-           $param =~ s/"//g;
-           $param =~ s/=(.*)//;
-           if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) {
-               $result .= " " if length($result);
-               $result .= $rawparam;
-           }
-       }
-    }
-
-    shift @ARGV;
-    $result .= " " if length($result);
-    $result .= join(" ", @ARGV);
-    if ($grub2) {
-       Bootloader::Tools::SetGlobals("append" => $result);
-    } else {
-       $section->{"append"} = $result;
-       $section->{"__modified"} = 1;
-       Bootloader::Tools::SetGlobals();
-    }
-} else {
-    die "Need an action (--get or --update)";
-}
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to