Handle crypto modules with and without modaliases

If new kernels have modules split out, handle the case, where modules
have to modalias and just install them.

Also add the crypto drivers and names to host_modalias.
Harald Hoyer 2013-10-30 12:22:52 +01:00
parent 352a49a21d
commit ee916b72cc
3 changed files with 15 additions and 5 deletions

View File

@ -1480,7 +1480,7 @@ dracut_kernel_post() {


module_is_host_only() { module_is_host_only() {
local _mod=$1 local _mod=$1
local _modenc a i local _modenc a i _k _s _v _aliases
_mod=${_mod##*/} _mod=${_mod##*/}
_mod=${_mod%.ko} _mod=${_mod%.ko}
_modenc=${_mod//-/_} _modenc=${_mod//-/_}
@ -1497,19 +1497,25 @@ module_is_host_only() {
# this covers the case, where a new module is introduced # this covers the case, where a new module is introduced
# or a module was renamed # or a module was renamed
# or a module changed from builtin to a module # or a module changed from builtin to a module

if [[ -d /lib/modules/$kernel_current ]]; then if [[ -d /lib/modules/$kernel_current ]]; then
# if the modinfo can be parsed, but the module # if the modinfo can be parsed, but the module
# is not loaded, then we can safely return 1 # is not loaded, then we can safely return 1
modinfo -F filename "$_mod" &>/dev/null && return 1 modinfo -F filename "$_mod" &>/dev/null && return 1
fi fi


# Finally check all modalias, if we install for a kernel _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null)
# different from the current one
for a in $(modinfo -k $kernel -F alias $_mod 2>/dev/null); do # if the module has no aliases, install it
[[ $_aliases ]] || return 0

# finally check all modalias
for a in $_aliases; do
for i in "${!host_modalias[@]}"; do for i in "${!host_modalias[@]}"; do
[[ $i == $a ]] && return 0 [[ $i == $a ]] && return 0
done done
done done

fi fi


return 1 return 1

View File

@ -968,6 +968,11 @@ if [[ $hostonly ]]; then


rm -f -- "$initdir/.modalias" rm -f -- "$initdir/.modalias"


while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
host_modalias["$_v"]=1
done </proc/crypto

# check /proc/modules # check /proc/modules
declare -A host_modules declare -A host_modules
while read m rest; do while read m rest; do

View File

@ -96,7 +96,6 @@ do_fips()
_found=0 _found=0
while read _k _s _v; do while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue [ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
[ "$_v" != "$_module" ] && continue [ "$_v" != "$_module" ] && continue
_found=1 _found=1
break break