Blob Blame History Raw
From 7ef5ead6f4cf4834b84ea6d9546b77ddc0da394b Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Thu, 30 Jan 2020 13:48:11 +0100
Subject: [PATCH] Add module "90nvdimm" for NVDIMM support

Detection of persistent memory devices works mostly out of the box
already. Only the "provider" modules for ndbus devices, which are responsible
to extract information of available NVDIMM devices and their configuration
from system firmware, are only indirectly linked into the module stack.
Examples for such modules are nfit.ko, nd_e820.ko, and virtio-pmem.ko.

Add a module that resolves these dependencies.
---
 modules.d/90nvdimm/module-setup.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/modules.d/90nvdimm/module-setup.sh b/modules.d/90nvdimm/module-setup.sh
new file mode 100755
index 00000000..6d58efd7
--- /dev/null
+++ b/modules.d/90nvdimm/module-setup.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# called by dracut
+check() {
+    if [[ ! $hostonly ]]; then
+        return 0
+    fi
+    [[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] && \
+        grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
+    return 255
+}
+
+# called by dracut
+depends() {
+    return 0
+}
+
+# called by dracut
+installkernel() {
+    # Directories to search for NVDIMM "providers" (firmware drivers)
+    # These modules call "nvdimm_bus_register()".
+    local _provider_dirs='=drivers/nvdimm =drivers/acpi =arch/powerpc'
+
+    #instmods() will take care of hostonly
+    dracut_instmods -o -s nvdimm_bus_register $_provider_dirs
+}
+
+# called by dracut
+install() {
+    inst_multiple -o ndctl
+}