1 |
commit: 5745d52ff41afb75cca4002db768ed76994cc4ae |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 3 05:05:39 2017 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 3 05:05:39 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5745d52f |
7 |
|
8 |
Allow complete override of MODULES_* |
9 |
|
10 |
The long-standing but undocumented AMODULES_* options allow adding |
11 |
ADDITIONAL modules during boot, but there was no way to completely |
12 |
override the MODULES_* variables. |
13 |
|
14 |
Add this functionality now, and document it in genkernel.conf. |
15 |
|
16 |
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=186652 |
17 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
18 |
|
19 |
genkernel | 20 +++++++++++++++++--- |
20 |
genkernel.conf | 7 +++++++ |
21 |
2 files changed, 24 insertions(+), 3 deletions(-) |
22 |
|
23 |
diff --git a/genkernel b/genkernel |
24 |
index eeaf5dd..444c559 100755 |
25 |
--- a/genkernel |
26 |
+++ b/genkernel |
27 |
@@ -105,16 +105,30 @@ echo |
28 |
# Set ${ARCH} |
29 |
get_official_arch |
30 |
|
31 |
-# Read arch-specific config |
32 |
print_info 1 "Using genkernel.conf from ${_GENKERNEL_CONF}" |
33 |
+# Save any customizations of MODULES_* first. |
34 |
+override_module_vars="$(compgen -A variable |grep '^MODULES_')" |
35 |
+for v in $override_module_vars ; do |
36 |
+ print_info 1 "Saving $v to override defaults" |
37 |
+ newvar=override_$v |
38 |
+ eval "${newvar}='${!v}'" |
39 |
+done |
40 |
+ |
41 |
+# Read arch-specific config |
42 |
print_info 1 "Sourcing arch-specific config.sh from ${ARCH_CONFIG} .." |
43 |
source ${ARCH_CONFIG} || gen_die "Could not read ${ARCH_CONFIG}" |
44 |
_MODULES_LOAD=${GK_SHARE}/arch/${ARCH}/modules_load |
45 |
print_info 1 "Sourcing arch-specific modules_load from ${_MODULES_LOAD} .." |
46 |
source "${_MODULES_LOAD}" || gen_die "Could not read ${_MODULES_LOAD}" |
47 |
-echo |
48 |
|
49 |
-# Merge modules_load from config |
50 |
+# Now apply customizations of MODULES_* |
51 |
+for v in $override_module_vars; do |
52 |
+ newvar=override_$v |
53 |
+ print_info 1 "Override $v, default (${!v}), new value (${!newvar})" |
54 |
+ eval "${v}='${!newvar}'" |
55 |
+done |
56 |
+ |
57 |
+# Merge additional modules_load from config |
58 |
for group_modules in ${!AMODULES_*}; do |
59 |
group="$(echo $group_modules | cut -d_ -f2)" |
60 |
eval cmodules="\$$group_modules" |
61 |
|
62 |
diff --git a/genkernel.conf b/genkernel.conf |
63 |
index 9ff7e4f..10a03bc 100644 |
64 |
--- a/genkernel.conf |
65 |
+++ b/genkernel.conf |
66 |
@@ -300,6 +300,13 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" |
67 |
# Use this with caution. |
68 |
#AMODULES_group="module-to-include another-module" |
69 |
|
70 |
+# Override the default modules in the ramdisk, for a given group, as defined by |
71 |
+# /usr/share/genkernel/default/modules_load and the per-arch modules_load |
72 |
+# files. You PROBABLY want to use AMODULES_* above, and NOT MODULES_* here. |
73 |
+# If you use MODULES_* here, the default and per-arch modules will NOT be used. |
74 |
+#MODULES_group1="some-module" |
75 |
+#MODULES_group2="" # Load no modules for this group |
76 |
+ |
77 |
# File to output a .tar.bz2'd modules after the |
78 |
# callbacks have run |
79 |
#MODULESPACKAGE="/path/to/file.bz2" |