Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 688568 - DEFAULT_KERNEL_CONFIG is ignored
Summary: DEFAULT_KERNEL_CONFIG is ignored
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-23 21:10 UTC by ZyX
Modified: 2020-06-23 18:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ZyX 2019-06-23 21:10:49 UTC
According to the documentation in https://wiki.gentoo.org/wiki/Genkernel the first time genkernel is run for a new sources it takes kernel configuration file from `usr/share/genkernel/arch/x86_64/kernel-config` with the location overridable by `DEFAULT_KERNEL_CONFIG` option. This is really not the case, if you check `/usr/share/genkernel/gen_configkernel.sh` you will see that function `determine_config_file`:

    determine_config_file() {
    	for f in \
    		"${CMD_KERNEL_CONFIG}" \
    		"/etc/kernels/kernel-config-${ARCH}-${KV}" \
    		"${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" \
    		"${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" \
    		"${GK_SHARE}/arch/${ARCH}/generated-config" \
    		"${GK_SHARE}/arch/${ARCH}/kernel-config" \
    		"${DEFAULT_KERNEL_CONFIG}" \
    		; do
    		if [ -n "${f}" -a -f "${f}" ]
    		then
    			if ! grep -sq THIS_CONFIG_IS_BROKEN "$f"
    			then
    				KERNEL_CONFIG="$f" && break
    			fi
    		fi
    	done
    	if [ -z "${KERNEL_CONFIG}" ]
    	then
    		gen_die 'Error: No kernel .config specified, or file not found!'
    	fi
        KERNEL_CONFIG="$(readlink -f "${KERNEL_CONFIG}")"
    	# Validate the symlink result if any
    	if [ ! -f "${KERNEL_CONFIG}" ]
    	then
    		gen_die "Error: No kernel .config: symlinked file not found! ($KERNEL_CONFIG)"
    	fi
    }

has `"${DEFAULT_KERNEL_CONFIG}"` listed *after* `"${GK_SHARE}/..."` and breaks once configuration is found, so given that all `kernel-config` files in `/usr/share` are installed by `genkernel` package and they do have `kernel-config` function will never check for `${DEFAULT_KERNEL_CONFIG}` unless you try to use unknown arch.

I think that line with `${DEFAULT_KERNEL_CONFIG}` must be moved before all lines with `${GK_SHARE}`.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2019-07-06 07:49:18 UTC
Yes and no: Current genkernel makes it impossible to force default cfg but in normal cases, DEFAULT_KERNEL_CONFIG should be last resort. Pending genkernel v4 will do

> [...]
> local -a kconfig_candidates
> kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" )
> kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" )
> kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/generated-config" )
> kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config" )
> kconfig_candidates+=( "${DEFAULT_KERNEL_CONFIG}" )
> 
> if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ]
> then
> 	print_info 1 "Default configuration was forced. Will ignore any user kernel configuration!"
> else
> 	kconfig_candidates=( "/etc/kernels/kernel-config-${ARCH}-${KV}" ${kconfig_candidates[@]} )
> fi
> [...]
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2020-06-23 18:48:52 UTC
v4 containing the changes was release long time ago.