1f46d2c999
Add 0207-handle_module_aliases.patch: Handle module aliases correctly to not generate unbootable initrds with different kernel versions. Fix for boo#962694 Patch tested (initrd for 3.12 created on 4.4 and the other way around) and verified. Seems to work :-) OBS-URL: https://build.opensuse.org/request/show/355279 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=245
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
From: Fabian Vogt <fvogt@suse.com>
|
|
Date: Thu, 21 Jan 2016 12:38:05 +0100
|
|
Subject: [PATCH] Correctly handle module aliases
|
|
|
|
Handle module aliases correctly to not generate unbootable
|
|
initrds with different kernel versions. Fix for boo#962694
|
|
See the diff for a detailed explanation.
|
|
|
|
---
|
|
dracut.sh | 20 ++++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
Index: dracut-044/dracut.sh
|
|
===================================================================
|
|
--- dracut-044.orig/dracut.sh
|
|
+++ dracut-044/dracut.sh
|
|
@@ -1214,6 +1214,27 @@ if [[ $hostonly ]]; then
|
|
while read m rest || [ -n "$m" ]; do
|
|
host_modules["$m"]=1
|
|
done </proc/modules
|
|
+
|
|
+ # Explanation of the following section:
|
|
+ # Since kernel 4.4, mpt3sas is a complete replacement for mpt2sas.
|
|
+ # mpt3sas has an alias to mpt2sas now, but since mpt3sas isn't loaded
|
|
+ # when generating the initrd from kernel < 4.4, it's not included.
|
|
+ # The other direction has the same issue:
|
|
+ # When generating the initrd from kernel >= 4.4, mpt2sas isn't loaded,
|
|
+ # so it's not included.
|
|
+ # Both ways result in an unbootable initrd.
|
|
+
|
|
+ # also add aliases of loaded modules
|
|
+ for mod in "${!host_modules[@]}"; do
|
|
+ aliases=$(modinfo -F alias "$mod" 2>&1)
|
|
+ for alias in $aliases; do
|
|
+ host_modules["$alias"]=1
|
|
+ done
|
|
+ # mod might be an alias in the target kernel, find the real module
|
|
+ mod_filename=$(modinfo -k "$kernel" "$mod" -F filename)
|
|
+ [ $? -ne 0 ] && continue
|
|
+ host_modules["$(basename -s .ko "$mod_filename")"]=1
|
|
+ done
|
|
fi
|
|
|
|
unset m
|