diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2023-05-30 16:46:02 -0400 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2023-05-30 17:52:11 -0400 |
commit | 060b33c6d7683b5d762be96a3382dc6061f79f6f (patch) | |
tree | 103a49055a020d8d95e9539e483dc3d2d6d7ee07 /eclass | |
parent | profiles: mark media-plugins/gst-plugins-libmms as deprecated (diff) | |
download | gentoo-060b33c6d7683b5d762be96a3382dc6061f79f6f.tar.gz gentoo-060b33c6d7683b5d762be96a3382dc6061f79f6f.tar.bz2 gentoo-060b33c6d7683b5d762be96a3382dc6061f79f6f.zip |
linux-mod-r1.eclass: generate and install depmod.d files
Sneaking in another quick improvement while the eclass still has
low tree usage, file is not *essential* so it can wait till next
merge of the package to be active.
e.g. if have (filesystem order):
/lib/modules/6.3.4/not-right/ryzen_smu.ko
/lib/modules/6.3.4/extra/ryzen_smu.ko
It will load not-right/ryzen_smu.ko by default.
But with /lib/depmod.d/ryzen_smu.conf having:
override ryzen_smu 6.3.4 extra
We more deterministically get extra's. Lacking this can be a problem
when either want to override the kernel's own modules, or if portage
left over behind modules in an outdated directory due to the default
UNINSTALL_IGNORE for modules.
Can be worse with e.g. nvidia given loading the wrong version of
the module means everything will fail. And not everyone upgrade
their kernel regularly to cleanup, some also install modules that
aren't tracked by portage in different subdirs (including nvidia's...)
which is not entirely surprising considering many build their kernel
without portage/dist-kernel.
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/linux-mod-r1.eclass | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass index d665c42f9dd8..c914a7223efb 100644 --- a/eclass/linux-mod-r1.eclass +++ b/eclass/linux-mod-r1.eclass @@ -544,6 +544,7 @@ modules_post_process() { (( ${#mods[@]} )) || die "${FUNCNAME[0]} was called with no installed modules under ${path}" + _modules_process_depmod.d "${mods[@]#"${path}/"}" _modules_process_strip "${mods[@]}" _modules_process_sign "${mods[@]}" _modules_sanity_modversion "${mods[@]}" # after strip/sign in case broke it @@ -850,6 +851,27 @@ _modules_process_compress() { fi } +# @FUNCTION: _modules_process_depmod.d +# @USAGE: <relative-module-path>... +# @INTERNAL +# @DESCRIPTION: +# Generate a depmod.d file to ensure priority if duplicate modules +# exist, such as stale modules in different directories, or to +# override the kernel's own modules. +_modules_process_depmod.d() { + ( + [[ ${SLOT%/*} == 0 ]] && slot= || slot=-${SLOT%/*} + insinto /lib/depmod.d + newins - ${PN}${slot}.conf < <( + echo "# Automatically generated by linux-mod-r1.eclass for ${CATEGORY}/${PN}" + for mod; do + [[ ${mod} =~ ^(.+)/(.+).ko$ ]] && + echo "override ${BASH_REMATCH[2]} ${KV_FULL} ${BASH_REMATCH[1]}" + done + ) + ) +} + # @FUNCTION: _modules_process_sign # @USAGE: <module>... # @INTERNAL |