File kdump-add-watchdog-modules.patch of Package kdump.25799
Index: kdump-0.8.16/init/module-setup.sh
===================================================================
--- kdump-0.8.16.orig/init/module-setup.sh 2021-09-24 17:18:51.211450946 +0200
+++ kdump-0.8.16/init/module-setup.sh 2021-09-24 17:19:18.355447232 +0200
@@ -148,6 +148,9 @@ depends() {
# drm is needed to get console output, but it is not included
# automatically, because kdump does not use plymouth
_modules[drm]=
+
+ # add watchdog modules (bsc#1189923)
+ _modules[watchdog-modules]=
[ "$kdump_neednet" = y ] && _modules[network]=
Index: kdump-0.8.16/init/CMakeLists.txt
===================================================================
--- kdump-0.8.16.orig/init/CMakeLists.txt 2021-09-24 17:18:51.211450946 +0200
+++ kdump-0.8.16/init/CMakeLists.txt 2021-09-24 17:19:18.355447232 +0200
@@ -111,6 +111,19 @@ INSTALL(
INSTALL(
FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/watchdog-modules-module-setup.sh
+ RENAME
+ module-setup.sh
+ DESTINATION
+ /usr/lib/dracut/modules.d/05watchdog-modules
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+)
+
+INSTALL(
+ FILES
${CMAKE_CURRENT_SOURCE_DIR}/kdump-save.service.in
DESTINATION
/usr/lib/dracut/modules.d/99kdump
Index: kdump-0.8.16/init/watchdog-modules-module-setup.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kdump-0.8.16/init/watchdog-modules-module-setup.sh 2021-09-24 17:21:06.931430951 +0200
@@ -0,0 +1,63 @@
+#!/bin/bash
+# included in the kdump package to backport the watchdog-modules dracut functionality from
+# newer dracut versions (bsc#1189923)
+
+# called by dracut
+check() {
+ return 255
+}
+
+# called by dracut
+depends() {
+ return 0
+}
+
+# called by dracut
+install() {
+ return 0
+}
+
+installkernel() {
+ local -A _drivers
+ local _alldrivers _wdtdrv _wdtppath _dir
+ [[ -d /sys/class/watchdog/ ]] || return 0
+ for _dir in /sys/class/watchdog/*; do
+ [[ -d "$_dir" ]] || continue
+ [[ -f "$_dir/state" ]] || continue
+ # device/modalias will return driver of this device
+ _wdtdrv=$(< "$_dir/device/modalias")
+ # There can be more than one module represented by same
+ # modalias. Currently load all of them.
+ # TODO: Need to find a way to avoid any unwanted module
+ # represented by modalias
+ _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
+ if [[ $_wdtdrv ]]; then
+ instmods $_wdtdrv
+ for i in $_wdtdrv; do
+ _drivers[$i]=1
+ done
+ fi
+ # however in some cases, we also need to check that if there is
+ # a specific driver for the parent bus/device. In such cases
+ # we also need to enable driver for parent bus/device.
+ _wdtppath=$(readlink -f "$_dir/device")
+ while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
+ _wdtppath=$(readlink -f "$_wdtppath/..")
+ [[ -f "$_wdtppath/modalias" ]] || continue
+
+ _wdtdrv=$(< "$_wdtppath/modalias")
+ _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
+ if [[ $_wdtdrv ]]; then
+ instmods $_wdtdrv
+ for i in $_wdtdrv; do
+ _drivers[$i]=1
+ done
+ fi
+ done
+ done
+ # ensure that watchdog module is loaded as early as possible
+ _alldrivers="${!_drivers[*]}"
+ [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
+
+ return 0
+}