From 792d9d9dc31b41dac3b15878ec6724e0698816b1 Mon Sep 17 00:00:00 2001 From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:14:55 +0200 Subject: [PATCH] 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 https://github.com/armbian/build/commit/04f619dc06d12449b1315f01bb8fe70003316761 --- lib/functions/compilation/uboot.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/functions/compilation/uboot.sh b/lib/functions/compilation/uboot.sh index 7fdd27e832ac..8ae5e95e8f94 100644 --- a/lib/functions/compilation/uboot.sh +++ b/lib/functions/compilation/uboot.sh @@ -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"