summaryrefslogtreecommitdiff
path: root/eclass/linux-mod-r1.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-05-31 03:22:19 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-05-31 03:22:19 +0100
commit3810dd6a469ba3e0014a390d92f1fc220dd20c3b (patch)
treeb7dd01f1153f84e36981e0ae398c7e047d878cc4 /eclass/linux-mod-r1.eclass
parent2f210c93c08515a806199783aabe37d12a0197cb (diff)
gentoo auto-resync : 31:05:2023 - 03:22:19
Diffstat (limited to 'eclass/linux-mod-r1.eclass')
-rw-r--r--eclass/linux-mod-r1.eclass37
1 files changed, 35 insertions, 2 deletions
diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass
index d665c42f9dd8..30395c1496f5 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
@@ -1197,8 +1219,19 @@ _modules_update_depmod() {
einfo "Updating module dependencies for kernel ${KV_FULL} ..."
if [[ -f ${map} ]]; then
- nonfatal edob depmod -ae -F "${map}" -b "${EROOT:-/}" "${KV_FULL}" &&
- return 0
+ local depmodargs=( -ae -F "${map}" "${KV_FULL}" )
+
+ # for nicer postinst display, keep command shorter if EROOT is unset
+ [[ ${EROOT} ]] &&
+ depmodargs+=(
+ -b "${EROOT}"
+
+ # EROOT from -b is not used when looking for configuration
+ # directories, so pass the whole list from kmod's tools/depmod.c
+ --config="${EROOT}"/{etc,run,usr/local/lib,lib}/depmod.d
+ )
+
+ nonfatal edob depmod "${depmodargs[@]}" && return 0
else
eerror
eerror "System.map for kernel ${KV_FULL} was not found, may be due to the"