From 550341ce8adf4fed720939050f36a53d6044227d Mon Sep 17 00:00:00 2001 From: Thomas Deutschmann Date: Tue, 14 Jul 2020 16:42:53 +0200 Subject: gen_configkernel.sh: config_kernel(): Re-order config checks Re-order config checks for better logical grouping. Signed-off-by: Thomas Deutschmann --- gen_configkernel.sh | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'gen_configkernel.sh') diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 6ee57edb..b76d1b76 100755 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -333,25 +333,35 @@ config_kernel() { local -a required_kernel_options [ -f "${KCONFIG_MODIFIED_MARKER}" ] && rm "${KCONFIG_MODIFIED_MARKER}" - # Ensure kernel supports initramfs if isTrue "${BUILD_RAMDISK}" then + # We really need this or we will fail to boot + print_info 2 "$(get_indent 1)>> Ensure that required kernel options for genkernel's initramfs usage are set ..." + + # Ensure kernel supports initramfs kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_BLK_DEV_INITRD" "y" - fi - # --integrated-initramfs handling - if isTrue "${INTEGRATED_INITRAMFS}" - then - local cfg_CONFIG_INITRAMFS_SOURCE=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_SOURCE") - if [[ -n "${cfg_CONFIG_INITRAMFS_SOURCE}" && ${#cfg_CONFIG_INITRAMFS_SOURCE} -gt 2 ]] + # Stuff required by init script + kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_TTY" "y" \ + && required_kernel_options+=( 'CONFIG_TTY' ) + + kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_UNIX98_PTYS" "y" \ + && required_kernel_options+=( 'CONFIG_UNIX98_PTYS' ) + + # --integrated-initramfs handling + if isTrue "${INTEGRATED_INITRAMFS}" + then + local cfg_CONFIG_INITRAMFS_SOURCE=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_SOURCE") + if [[ -n "${cfg_CONFIG_INITRAMFS_SOURCE}" && ${#cfg_CONFIG_INITRAMFS_SOURCE} -gt 2 ]] + then + # Checking value length to allow 'CONFIG_INITRAMFS_SOURCE=' and 'CONFIG_INITRAMFS_SOURCE=""' + print_info 2 "$(get_indent 1)>> CONFIG_INITRAMFS_SOURCE is already set; Unsetting to avoid clashing with --integrated-initramfs ..." + kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_SOURCE" "" + fi + elif isTrue "${COMPRESS_INITRD}" then - # Checking value length to allow 'CONFIG_INITRAMFS_SOURCE=' and 'CONFIG_INITRAMFS_SOURCE=""' - print_info 2 "$(get_indent 1)>> CONFIG_INITRAMFS_SOURCE is already set; Unsetting to avoid clashing with --integrated-initramfs ..." - kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_SOURCE" "" + set_initramfs_compression_method "${KERNEL_OUTPUTDIR}/.config" fi - elif isTrue "${COMPRESS_INITRD}" - then - set_initramfs_compression_method "${KERNEL_OUTPUTDIR}/.config" fi # Force this on if we are using --genzimage @@ -443,17 +453,6 @@ config_kernel() { fi fi - if isTrue "${BUILD_RAMDISK}" - then - # We really need this or we will fail to boot - print_info 2 "$(get_indent 1)>> Ensure that required kernel options for genkernel's initramfs usage are set ..." - kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_TTY" "y" \ - && required_kernel_options+=( 'CONFIG_TTY' ) - - kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_UNIX98_PTYS" "y" \ - && required_kernel_options+=( 'CONFIG_UNIX98_PTYS' ) - fi - # If the user has configured DM as built-in, we need to respect that. local cfg_CONFIG_BLK_DEV_DM=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_BLK_DEV_DM") case "${cfg_CONFIG_BLK_DEV_DM}" in -- cgit v1.2.3-65-gdbad