[PATCH 1/2] Add module "90nvdimm" for NVDIMM support

mwilck-IBi9RG/[email protected]
Newsgroups org.kernel.vger.initramfs
Message-ID <[email protected]>
From: Martin Wilck <mwilck-IBi9RG/[email protected]>

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(+)
 create mode 100755 modules.d/90nvdimm/module-setup.sh

diff --git a/modules.d/90nvdimm/module-setup.sh b/modules.d/90nvdimm/module-setup.sh
new file mode 100755
index 0000000..98913a4
--- /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 /usr/bin/ndctl
+}
-- 
2.25.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.