Skip to content

Commit 7c8f2a6

Browse files
committed
framework extensions deep magic - add extension_optout for boards/families
The goal here is that some boards may want to opt out entirely [at their own risk of course] of an extension or hook. Here I pick on the rockchip-rv1106 as an example.
1 parent 0bd81c9 commit 7c8f2a6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

config/sources/families/rockchip-rv1106.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ BOOTSOURCE="https://github.com/radxa/u-boot.git"
3131
BOOTBRANCH="branch:next-dev-buildroot"
3232
BOOTPATCHDIR="legacy/u-boot-rockchip-buildroot"
3333
BOOTDIR="u-boot-rockchip"
34+
declare -ga extension_optout=( armbian_kernel_config__enable_docker_support )
3435

3536
# Set defaults based on BOOT_SOC (overridable in board config)
3637
if [[ "$BOOT_SOC" == "rv1103" ]]; then

lib/functions/general/extensions.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function dump_extension_method_sources_body() {
128128
# to avoid hard coding the list of hook-points (eg: user_config, image_tweaks_pre_customize, etc) we use
129129
# a marker in the function names, namely "__" (two underscores) to determine the hook point.
130130
function initialize_extension_manager() {
131+
declare -ga extension_optout # do not init here!
131132
# before starting, auto-add extensions specified (eg, on the command-line) via the ENABLE_EXTENSIONS or EXT env var. Do it only once.
132133
[[ ${initialize_extension_manager_counter} -lt 1 ]] && [[ "${ENABLE_EXTENSIONS:-"${EXT}"}" != "" ]] && {
133134
local auto_extension
@@ -232,7 +233,21 @@ function initialize_extension_manager() {
232233
hook_point_functions=""
233234
declare hook_point_function_sortname
234235
for hook_point_function_sortname in ${hook_point_functions_sorted_by_sort_id}; do
235-
hook_point_functions="${hook_point_functions} ${hook_point_functions_sortname_to_realname[${hook_point_function_sortname}]}"
236+
realname="${hook_point_functions_sortname_to_realname[${hook_point_function_sortname}]}"
237+
# If a board/family has defined the global extension_optout array,
238+
# skip any hook implementations matching those names exactly.
239+
# Format: extension_optout=( "hook_point__impl_name1" "hook_point__impl_name2" )
240+
# Example: extension_optout=( "user_config__early_config" ) would skip that hook.
241+
if [[ ${#extension_optout[@]} -ne 0 ]]; then
242+
# most common case this array is empty/non-existent, so bail out soonest
243+
for func in "${extension_optout[@]}"; do
244+
if [[ "$func" == "${hook_point}__${realname}" ]]; then
245+
continue 2
246+
fi
247+
done
248+
fi
249+
250+
hook_point_functions="${hook_point_functions} ${realname}"
236251
done
237252
# shellcheck disable=SC2086
238253
hook_point_functions="$(echo -n ${hook_point_functions})"

0 commit comments

Comments
 (0)