|
Harald Hoyer |
b38677 |
From 43819af68c7789ec932c25e699c56889fdf7276c Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
b38677 |
From: Fabian Vogt <fvogt@suse.com>
|
|
Harald Hoyer |
b38677 |
Date: Thu, 21 Jan 2016 17:13:07 +0100
|
|
Harald Hoyer |
b38677 |
Subject: [PATCH] Correctly handle module aliases
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
Handle module aliases correctly to not generate unbootable
|
|
Harald Hoyer |
b38677 |
initrds with different kernel versions when modules were renamed
|
|
Harald Hoyer |
b38677 |
or replaced.
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
Signed-off-by: Fabian Vogt <fvogt@suse.com>
|
|
Harald Hoyer |
b38677 |
---
|
|
Harald Hoyer |
b38677 |
dracut.sh | 21 +++++++++++++++++++++
|
|
Harald Hoyer |
b38677 |
1 file changed, 21 insertions(+)
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
diff --git a/dracut.sh b/dracut.sh
|
|
Harald Hoyer |
b38677 |
index 98dbe0b..ae8772b 100755
|
|
Harald Hoyer |
b38677 |
--- a/dracut.sh
|
|
Harald Hoyer |
b38677 |
+++ b/dracut.sh
|
|
Harald Hoyer |
b38677 |
@@ -1195,6 +1195,27 @@ if [[ $hostonly ]]; then
|
|
Harald Hoyer |
b38677 |
while read m rest || [ -n "$m" ]; do
|
|
Harald Hoyer |
b38677 |
host_modules["$m"]=1
|
|
Harald Hoyer |
b38677 |
done
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ # Explanation of the following section:
|
|
Harald Hoyer |
b38677 |
+ # Since kernel 4.4, mpt3sas is a complete replacement for mpt2sas.
|
|
Harald Hoyer |
b38677 |
+ # mpt3sas has an alias to mpt2sas now, but since mpt3sas isn't loaded
|
|
Harald Hoyer |
b38677 |
+ # when generating the initrd from kernel < 4.4, it's not included.
|
|
Harald Hoyer |
b38677 |
+ # The other direction has the same issue:
|
|
Harald Hoyer |
b38677 |
+ # When generating the initrd from kernel >= 4.4, mpt2sas isn't loaded,
|
|
Harald Hoyer |
b38677 |
+ # so it's not included.
|
|
Harald Hoyer |
b38677 |
+ # Both ways result in an unbootable initrd.
|
|
Harald Hoyer |
b38677 |
+
|
|
Harald Hoyer |
b38677 |
+ # also add aliases of loaded modules
|
|
Harald Hoyer |
b38677 |
+ for mod in "${!host_modules[@]}"; do
|
|
Harald Hoyer |
b38677 |
+ aliases=$(modinfo -F alias "$mod" 2>&1)
|
|
Harald Hoyer |
b38677 |
+ for alias in $aliases; do
|
|
Harald Hoyer |
b38677 |
+ host_modules["$alias"]=1
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
+ # mod might be an alias in the target kernel, find the real module
|
|
Harald Hoyer |
b38677 |
+ mod_filename=$(modinfo -k "$kernel" "$mod" -F filename)
|
|
Harald Hoyer |
b38677 |
+ [ $? -ne 0 ] && continue
|
|
Harald Hoyer |
b38677 |
+ host_modules["$(basename -s .ko "$mod_filename")"]=1
|
|
Harald Hoyer |
b38677 |
+ done
|
|
Harald Hoyer |
b38677 |
fi
|
|
Harald Hoyer |
b38677 |
|
|
Harald Hoyer |
b38677 |
unset m
|