]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
removed obsolete kernel module functions and host_modules variable
authorHarald Hoyer <harald@redhat.com>
Fri, 15 Apr 2016 14:25:59 +0000 (16:25 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 15 Apr 2016 14:48:13 +0000 (16:48 +0200)
module_is_host_only()
find_kernel_modules_by_path()
find_kernel_modules()

dracut-init.sh
dracut.sh
modules.d/90multipath/module-setup.sh

index 1056a315fa8ff99e353f436c0491ff56d4828165..a195c32b5cb30c7f40bf946471e3aeb1eb102d74 100644 (file)
@@ -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>
index aaeb0dc6f503a2b777c73a085064c0827ac0a5b9..8232fa48a1190e6fb42884ab8d7ad3500567d9f6 100755 (executable)
--- 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=""
index 0af777d96959d1263735e0a9691a07891c85e3c6..1676798b0c220ff1015a816a53346e2cf837cff6 100755 (executable)
@@ -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