b386772815
- fix for systemd >= 230 - git snapshot
149 lines
4.6 KiB
Diff
149 lines
4.6 KiB
Diff
From 3f60444ec1bff8a57a2cf4ada238e782928890eb Mon Sep 17 00:00:00 2001
|
|
From: Harald Hoyer <harald@redhat.com>
|
|
Date: Fri, 15 Apr 2016 16:25:59 +0200
|
|
Subject: [PATCH] removed obsolete kernel module functions and host_modules
|
|
variable
|
|
|
|
module_is_host_only()
|
|
find_kernel_modules_by_path()
|
|
find_kernel_modules()
|
|
---
|
|
dracut-init.sh | 54 -----------------------------------
|
|
dracut.sh | 30 +------------------
|
|
modules.d/90multipath/module-setup.sh | 2 +-
|
|
3 files changed, 2 insertions(+), 84 deletions(-)
|
|
|
|
diff --git a/dracut-init.sh b/dracut-init.sh
|
|
index 1056a31..a195c32 100644
|
|
--- a/dracut-init.sh
|
|
+++ b/dracut-init.sh
|
|
@@ -943,60 +943,6 @@ dracut_kernel_post() {
|
|
|
|
}
|
|
|
|
-[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
|
-
|
|
-module_is_host_only() {
|
|
- local _mod=$1
|
|
- local _modenc a i _k _s _v _aliases
|
|
- _mod=${_mod##*/}
|
|
- _mod=${_mod%.ko*}
|
|
- _modenc=${_mod//-/_}
|
|
-
|
|
- [[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
|
|
-
|
|
- # check if module is loaded
|
|
- [[ ${host_modules["$_modenc"]} ]] && return 0
|
|
-
|
|
- [[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
|
-
|
|
- if [[ "$kernel_current" != "$kernel" ]]; then
|
|
- # check if module is loadable on the current kernel
|
|
- # this covers the case, where a new module is introduced
|
|
- # or a module was renamed
|
|
- # or a module changed from builtin to a module
|
|
-
|
|
- if [[ -d /lib/modules/$kernel_current ]]; then
|
|
- # if the modinfo can be parsed, but the module
|
|
- # is not loaded, then we can safely return 1
|
|
- modinfo -F filename "$_mod" &>/dev/null && return 1
|
|
- fi
|
|
-
|
|
- # just install the module, better safe than sorry
|
|
- return 0
|
|
- fi
|
|
-
|
|
- return 1
|
|
-}
|
|
-
|
|
-find_kernel_modules_by_path () {
|
|
- local _OLDIFS
|
|
-
|
|
- [[ -f "$srcmods/modules.dep" ]] || return 0
|
|
-
|
|
- _OLDIFS=$IFS
|
|
- IFS=:
|
|
- while read a rest || [ -n "$a" ]; do
|
|
- [[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
|
|
- printf "%s\n" "$srcmods/$a"
|
|
- done < "$srcmods/modules.dep"
|
|
- IFS=$_OLDIFS
|
|
- return 0
|
|
-}
|
|
-
|
|
-find_kernel_modules () {
|
|
- find_kernel_modules_by_path drivers
|
|
-}
|
|
-
|
|
instmods() {
|
|
# instmods [-c [-s]] <kernel module> [<kernel module> ... ]
|
|
# instmods [-c [-s]] <kernel subsystem>
|
|
diff --git a/dracut.sh b/dracut.sh
|
|
index aaeb0dc..8232fa4 100755
|
|
--- a/dracut.sh
|
|
+++ b/dracut.sh
|
|
@@ -1101,8 +1101,6 @@ if (( ${#add_device_l[@]} )); then
|
|
push_host_devs "${add_device_l[@]}"
|
|
fi
|
|
|
|
-declare -A host_modules
|
|
-
|
|
if [[ $hostonly ]]; then
|
|
# in hostonly mode, determine all devices, which have to be accessed
|
|
# and examine them for filesystem types
|
|
@@ -1190,32 +1188,6 @@ if [[ $hostonly ]]; then
|
|
fi
|
|
done < /etc/fstab
|
|
fi
|
|
-
|
|
- # check /proc/modules
|
|
- 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
|
|
@@ -1302,7 +1274,7 @@ export initdir dracutbasedir \
|
|
debug host_fs_types host_devs swap_devs sshkey add_fstab \
|
|
DRACUT_VERSION udevdir prefix filesystems drivers \
|
|
systemdutildir systemdsystemunitdir systemdsystemconfdir \
|
|
- host_modules hostonly_cmdline loginstall \
|
|
+ hostonly_cmdline loginstall \
|
|
tmpfilesdir
|
|
|
|
mods_to_load=""
|
|
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
|
|
index 0af777d..1676798 100755
|
|
--- a/modules.d/90multipath/module-setup.sh
|
|
+++ b/modules.d/90multipath/module-setup.sh
|
|
@@ -41,7 +41,7 @@ depends() {
|
|
# called by dracut
|
|
cmdline() {
|
|
for m in scsi_dh_alua scsi_dh_emc scsi_dh_rdac ; do
|
|
- if module_is_host_only $m ; then
|
|
+ if grep -m 1 -q "$m" /proc/modules ; then
|
|
printf 'rd.driver.pre=%s ' "$m"
|
|
fi
|
|
done
|