commit: 5745d52ff41afb75cca4002db768ed76994cc4ae Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Tue Jan 3 05:05:39 2017 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Tue Jan 3 05:05:39 2017 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5745d52f
Allow complete override of MODULES_* The long-standing but undocumented AMODULES_* options allow adding ADDITIONAL modules during boot, but there was no way to completely override the MODULES_* variables. Add this functionality now, and document it in genkernel.conf. Fixes: https://bugs.gentoo.org/show_bug.cgi?id=186652 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> genkernel | 20 +++++++++++++++++--- genkernel.conf | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/genkernel b/genkernel index eeaf5dd..444c559 100755 --- a/genkernel +++ b/genkernel @@ -105,16 +105,30 @@ echo # Set ${ARCH} get_official_arch -# Read arch-specific config print_info 1 "Using genkernel.conf from ${_GENKERNEL_CONF}" +# Save any customizations of MODULES_* first. +override_module_vars="$(compgen -A variable |grep '^MODULES_')" +for v in $override_module_vars ; do + print_info 1 "Saving $v to override defaults" + newvar=override_$v + eval "${newvar}='${!v}'" +done + +# Read arch-specific config print_info 1 "Sourcing arch-specific config.sh from ${ARCH_CONFIG} .." source ${ARCH_CONFIG} || gen_die "Could not read ${ARCH_CONFIG}" _MODULES_LOAD=${GK_SHARE}/arch/${ARCH}/modules_load print_info 1 "Sourcing arch-specific modules_load from ${_MODULES_LOAD} .." source "${_MODULES_LOAD}" || gen_die "Could not read ${_MODULES_LOAD}" -echo -# Merge modules_load from config +# Now apply customizations of MODULES_* +for v in $override_module_vars; do + newvar=override_$v + print_info 1 "Override $v, default (${!v}), new value (${!newvar})" + eval "${v}='${!newvar}'" +done + +# Merge additional modules_load from config for group_modules in ${!AMODULES_*}; do group="$(echo $group_modules | cut -d_ -f2)" eval cmodules="\$$group_modules" diff --git a/genkernel.conf b/genkernel.conf index 9ff7e4f..10a03bc 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -300,6 +300,13 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # Use this with caution. #AMODULES_group="module-to-include another-module" +# Override the default modules in the ramdisk, for a given group, as defined by +# /usr/share/genkernel/default/modules_load and the per-arch modules_load +# files. You PROBABLY want to use AMODULES_* above, and NOT MODULES_* here. +# If you use MODULES_* here, the default and per-arch modules will NOT be used. +#MODULES_group1="some-module" +#MODULES_group2="" # Load no modules for this group + # File to output a .tar.bz2'd modules after the # callbacks have run #MODULESPACKAGE="/path/to/file.bz2"
