1 |
commit: caa98450d35c8884eaf502547db5b13932fb163a |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Oct 31 18:46:28 2017 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 31 18:46:28 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=caa98450 |
7 |
|
8 |
gen_configkernel: validate depmod/MODULE_COMPRESS |
9 |
|
10 |
If there is a mismatch between compression support in depmod and the |
11 |
kernel module settings, a bad initramfs would have been generated prior |
12 |
to this commit. Validate and die early instead of building that bad |
13 |
initramfs, so you don't get boot failures. |
14 |
|
15 |
Impacts before: |
16 |
- modules.dep and related files can be empty. |
17 |
- module dependency verification for initramfs assembly can miss |
18 |
dependent modules. |
19 |
|
20 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
21 |
|
22 |
gen_configkernel.sh | 15 +++++++++++++++ |
23 |
1 file changed, 15 insertions(+) |
24 |
|
25 |
diff --git a/gen_configkernel.sh b/gen_configkernel.sh |
26 |
index 476a883..26e4610 100755 |
27 |
--- a/gen_configkernel.sh |
28 |
+++ b/gen_configkernel.sh |
29 |
@@ -125,6 +125,21 @@ config_kernel() { |
30 |
if isTrue "$cfg_CONFIG_MODULES" ; then |
31 |
# yes, we support modules, set 'm' for new stuff. |
32 |
newcfg_setting='m' |
33 |
+ # Compare the kernel module compression vs the depmod module compression support |
34 |
+ # WARNING: if the buildhost has +XZ but the target machine has -XZ, you will get failures! |
35 |
+ cfg_CONFIG_MODULE_COMPRESS_GZIP=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_MODULE_COMPRESS_GZIP") |
36 |
+ cfg_CONFIG_MODULE_COMPRESS_XZ=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_MODULE_COMPRESS_XZ") |
37 |
+ if isTrue "${cfg_CONFIG_MODULE_COMPRESS_GZIP}"; then |
38 |
+ depmod_GZIP=$(/sbin/depmod -V | tr ' ' '\n' | awk '/ZLIB/{print $1; exit}') |
39 |
+ if [[ "${depmod_GZIP}" != "+ZLIB" ]]; then |
40 |
+ gen_die 'depmod does not support ZLIB/GZIP, cannot build with CONFIG_MODULE_COMPRESS_GZIP' |
41 |
+ fi |
42 |
+ elif isTrue "${cfg_CONFIG_MODULE_COMPRESS_XZ}" ; then |
43 |
+ depmod_XZ=$(/sbin/depmod -V | tr ' ' '\n' | awk '/XZ/{print $1; exit}') |
44 |
+ if [[ "${depmod_XZ}" != "+XZ" ]]; then |
45 |
+ gen_die 'depmod does not support XZ, cannot build with CONFIG_MODULE_COMPRESS_XZ' |
46 |
+ fi |
47 |
+ fi |
48 |
else |
49 |
# no, we support modules, set 'y' for new stuff. |
50 |
newcfg_setting='y' |