Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/functions/artifacts/artifact-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function artifact_kernel_prepare_version() {

# run the extensions. they _must_ behave, and not try to modify the .config, instead just fill kernel_config_modifying_hashes
declare kernel_config_modifying_hashes_hash="undetermined"
declare -a kernel_config_modifying_hashes=()
declare -ga kernel_config_modifying_hashes=()
call_extensions_kernel_config
# Reduce to last assignment per key to keep hashing stable and ignore overridden options.
# tac reverses order so last becomes first, then sort -uk keeps first occurrence of each key.
Expand Down
5 changes: 5 additions & 0 deletions lib/functions/compilation/armbian-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ function kernel_config_set_m() {
declare module="$1"
display_alert "Enabling kernel module" "${module}=m" "debug"
run_host_command_logged ./scripts/config --module "${module}"
kernel_config_modifying_hashes+=("${module}=m")
}

# Sets a kernel configuration option to be built-in (=y).
Expand All @@ -627,6 +628,7 @@ function kernel_config_set_y() {
declare config="$1"
display_alert "Enabling kernel config/built-in" "${config}=y" "debug"
run_host_command_logged ./scripts/config --enable "${config}"
kernel_config_modifying_hashes+=("${config}=y")
}

# Disables a kernel configuration option (=n).
Expand All @@ -637,6 +639,7 @@ function kernel_config_set_n() {
declare config="$1"
display_alert "Disabling kernel config/module" "${config}=n" "debug"
run_host_command_logged ./scripts/config --disable "${config}"
kernel_config_modifying_hashes+=("${config}=n")
}

# Sets a kernel configuration option to a string value.
Expand All @@ -649,6 +652,7 @@ function kernel_config_set_string() {
declare value="${2}"
display_alert "Setting kernel config/module string" "${config}=${value}" "debug"
run_host_command_logged ./scripts/config --set-str "${config}" "${value}"
kernel_config_modifying_hashes+=("${config}=\"${value}\"")
}

# Sets a kernel configuration option to a numeric or hexadecimal value.
Expand All @@ -661,6 +665,7 @@ function kernel_config_set_val() {
declare value="${2}"
display_alert "Setting kernel config/module value" "${config}=${value}" "debug"
run_host_command_logged ./scripts/config --set-val "${config}" "${value}"
kernel_config_modifying_hashes+=("${config}=${value}")
}

# Applies kernel configuration options from arrays to hashes and the .config file.
Expand Down
11 changes: 11 additions & 0 deletions lib/functions/compilation/kernel-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ function kernel_config_initialize() {
run_host_command_logged cp -pv "${kernel_config_source_filename}" "${kernel_work_dir}/.config"
fi

# Ensure .config ends with a newline; ./scripts/config appends via `echo >>` and
# silently concatenates the first added option with the last line otherwise.
sed -i -e '$a\' "${kernel_work_dir}/.config"

# Call the extensions. This is _also_ done during the kernel artifact's prepare_version, for consistent caching.
cd "${kernel_work_dir}" || exit_with_error "kernel_work_dir does not exist before call_extensions_kernel_config: ${kernel_work_dir}"
call_extensions_kernel_config
Expand All @@ -93,6 +97,13 @@ function call_extensions_kernel_config() {
# shellcheck disable=SC2034
declare -a opts_y=() opts_n=() opts_m=()

# kernel_config_set_* append to this array; ensure it exists globally so their
# changes survive for artifact versioning even when no caller pre-declared it.
if ! declare -p kernel_config_modifying_hashes >/dev/null 2>&1; then
# shellcheck disable=SC2034
declare -ga kernel_config_modifying_hashes=()
fi

# Run the core-armbian config modifications here, built-in extensions:
call_extension_method "armbian_kernel_config" <<- 'ARMBIAN_KERNEL_CONFIG'
*Armbian-core default hook point for pre-olddefconfig Kernel config modifications*
Expand Down
Loading