cli: uboot: Include PYTHONPATH in env for compiling U-Boot

- Also group all u-boot make environment variables together for easier maintainability
- Fixes u-boot requiring `pyelftools`
- Fixes commit 04f619dc06
This commit is contained in:
ColorfulRhino 2024-06-28 15:14:55 +02:00 committed by Ricardo Pardini
parent d29305a05b
commit 792d9d9dc3

View File

@ -203,6 +203,19 @@ function compile_uboot_target() {
return 0 # exit after this
fi
##########################################
# REAL COMPILATION SECTION STARTING HERE #
##########################################
# Collect make environment variables, similar to 'kernel-make.sh'
uboot_make_envs=(
"CFLAGS='${uboot_cflags}'"
"KCFLAGS='${uboot_cflags}'"
"CCACHE_BASEDIR=$(pwd)"
"PATH=${toolchain}:${toolchain2}:${PATH}"
"PYTHONPATH=\"${PYTHON3_INFO[MODULES_PATH]}:${PYTHONPATH}\"" # Insert the pip modules downloaded by Armbian into PYTHONPATH (needed e.g. for pyelftools)
)
# workaround when two compilers are needed
cross_compile="CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed
@ -213,8 +226,7 @@ function compile_uboot_target() {
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make} with gcc '${gcc_version_main}'" "info"
declare -g if_error_detail_message="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
do_with_ccache_statistics run_host_command_logged_long_running \
"CFLAGS='${uboot_cflags}'" "KCFLAGS='${uboot_cflags}'" \
CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
"env" "-i" "${uboot_make_envs[@]}" \
unbuffer make "$target_make" "$CTHREADS" "${cross_compile}"
display_alert "${uboot_prefix}built u-boot target" "${version} in $((SECONDS - ts)) seconds" "info"