config: allow to build BRANCHes not listed in KERNEL_TARGET as long as the config is valid

- useful for `collabora` and other experimental kernels, we don't want to have to add it to each individual board's KERNEL_TARGES one by one
- but we don't want to allow typos in BRANCH to emit very strange unrelated errors
This commit is contained in:
Ricardo Pardini 2024-04-01 19:15:41 +02:00 committed by monkaBlyat
parent 025eb5454e
commit 309825efe8
2 changed files with 12 additions and 1 deletions

View File

@ -55,6 +55,11 @@ function late_family_config__common_defaults_for_mainline_kernel() {
# KERNEL_MAJOR_MINOR is the key to all this stuff. It must be set.
if [[ -z ${KERNEL_MAJOR_MINOR} ]]; then
display_alert "KERNEL_MAJOR_MINOR is unset" "common_defaults_for_mainline" "warn"
# Done late (here) to allow family to set it first, so we don't have to add KERNEL_TARGET to all boards for experimental kernels.
if [[ "${BRANCH_VALID_FOR_BOARD}" == "no" ]]; then # Set in config-interactive by comparing KERNEL_TARGETS
exit_with_error "Invalid BRANCH='${BRANCH}' for BOARD='${BOARD}'; please select a valid branch for this board, eg one of '${KERNEL_TARGET}'"
fi
((problems++))
fi

View File

@ -22,7 +22,13 @@ function config_possibly_interactive_kernel_board() {
function config_possibly_interactive_branch_release_desktop_minimal() {
interactive_config_ask_branch
[[ -z $BRANCH ]] && exit_with_error "No kernel branch selected: BRANCH"
[[ ${KERNEL_TARGET} != *${BRANCH}* && ${BRANCH} != "ddk" ]] && exit_with_error "Kernel branch not defined for this board: '${BRANCH}' for '${BOARD}'"
# Check for BRANCH validity, warn but don't break the build if invalid; mark it as invalid for later checks -- if really no valid config, common.conf will exit with error later.
declare -g BRANCH_VALID_FOR_BOARD='yes'
if [[ ${KERNEL_TARGET} != *${BRANCH}* && ${BRANCH} != "ddk" ]]; then
display_alert "BRANCH not found for board" "BRANCH='${BRANCH}' not valid for BOARD='${BOARD}' - listed KERNEL_TARGET='${KERNEL_TARGET}'" "warn"
declare -g BRANCH_VALID_FOR_BOARD='no'
fi
interactive_config_ask_release
# If building image or rootfs (and thus "NEEDS_BINFMT=yes"), then RELEASE must be set.