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"