diff options
author | Dave Reisner <dreisner@archlinux.org> | 2020-03-07 19:45:30 +0100 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2020-03-12 23:39:17 +0100 |
commit | c9544f97258858587958654f0b000937b2f62354 (patch) | |
tree | c0dfa17d99813d3519e6d6f5c62c9ed14aebd959 | |
parent | b6361a3836a50f9bbe06dba4bf5740c3bfb1af3d (diff) | |
download | mkinitcpio-c9544f97258858587958654f0b000937b2f62354.tar.gz mkinitcpio-c9544f97258858587958654f0b000937b2f62354.tar.xz |
Read from modules.builtin.modinfo if it exists
There's a lot more to be gained from reading this file -- builtins might
have aliases which aren't available in the older modules.builtin index.
Fixes FS#65725.
-rwxr-xr-x | mkinitcpio | 34 |
1 files changed, 26 insertions, 8 deletions
@@ -312,6 +312,31 @@ process_preset() ( exit $ret ) +preload_builtin_modules() { + local modname field value path + + # Prime the _addedmodules list with the builtins for this kernel. We prefer + # the modinfo file if it exists, but this requires a recent enough kernel + # and kmod>=27. + + if [[ -r $_d_kmoduledir/modules.builtin.modinfo ]]; then + while IFS=.= read -rd '' modname field value; do + _addedmodules[${modname//-/_}]=2 + case $field in + alias) + _addedmodules["${value//-/_}"]=2 + ;; + esac + done <"$_d_kmoduledir/modules.builtin.modinfo" + + elif [[ -r $_d_kmoduledir/modules.builtin ]]; then + while IFS=/ read -ra path; do + modname=${path[-1]%.ko} + _addedmodules["${modname//-/_}"]=2 + done <"$_d_kmoduledir/modules.builtin" + fi +} + . "$_f_functions" trap 'cleanup 130' INT @@ -498,14 +523,7 @@ declare -i _builderrors=0 set -o functrace trap '(( $? )) && [[ $FUNCNAME = add_* ]] && (( ++_builderrors ))' RETURN -# prime the _addedmodules list with the builtins for this kernel -if [[ -r $_d_kmoduledir/modules.builtin ]]; then - while IFS=/ read -a path; do - modname=${path[-1]%.ko} - _addedmodules["${modname//-/_}"]=2 - done <"$_d_kmoduledir/modules.builtin" - unset modname path -fi +preload_builtin_modules map run_build_hook "${_hooks[@]}" || (( ++_builderrors )) |