summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-10-31 11:46:28 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-10-31 11:46:28 -0700
commitcaa98450d35c8884eaf502547db5b13932fb163a (patch)
treef133016794648ad5a61e47c434419fe600b1ada9
parentgen_configkernel: if building non-modular, have to set =y not =m. (diff)
downloadgenkernel-caa98450d35c8884eaf502547db5b13932fb163a.tar.gz
genkernel-caa98450d35c8884eaf502547db5b13932fb163a.tar.bz2
genkernel-caa98450d35c8884eaf502547db5b13932fb163a.zip
gen_configkernel: validate depmod/MODULE_COMPRESS
If there is a mismatch between compression support in depmod and the kernel module settings, a bad initramfs would have been generated prior to this commit. Validate and die early instead of building that bad initramfs, so you don't get boot failures. Impacts before: - modules.dep and related files can be empty. - module dependency verification for initramfs assembly can miss dependent modules. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xgen_configkernel.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 476a883..26e4610 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -125,6 +125,21 @@ config_kernel() {
if isTrue "$cfg_CONFIG_MODULES" ; then
# yes, we support modules, set 'm' for new stuff.
newcfg_setting='m'
+ # Compare the kernel module compression vs the depmod module compression support
+ # WARNING: if the buildhost has +XZ but the target machine has -XZ, you will get failures!
+ cfg_CONFIG_MODULE_COMPRESS_GZIP=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_MODULE_COMPRESS_GZIP")
+ cfg_CONFIG_MODULE_COMPRESS_XZ=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_MODULE_COMPRESS_XZ")
+ if isTrue "${cfg_CONFIG_MODULE_COMPRESS_GZIP}"; then
+ depmod_GZIP=$(/sbin/depmod -V | tr ' ' '\n' | awk '/ZLIB/{print $1; exit}')
+ if [[ "${depmod_GZIP}" != "+ZLIB" ]]; then
+ gen_die 'depmod does not support ZLIB/GZIP, cannot build with CONFIG_MODULE_COMPRESS_GZIP'
+ fi
+ elif isTrue "${cfg_CONFIG_MODULE_COMPRESS_XZ}" ; then
+ depmod_XZ=$(/sbin/depmod -V | tr ' ' '\n' | awk '/XZ/{print $1; exit}')
+ if [[ "${depmod_XZ}" != "+XZ" ]]; then
+ gen_die 'depmod does not support XZ, cannot build with CONFIG_MODULE_COMPRESS_XZ'
+ fi
+ fi
else
# no, we support modules, set 'y' for new stuff.
newcfg_setting='y'