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