Skip to content

Commit 792d9d9

Browse files
ColorfulRhinorpardini
authored andcommitted
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 04f619d
1 parent d29305a commit 792d9d9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/functions/compilation/uboot.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,19 @@ function compile_uboot_target() {
203203
return 0 # exit after this
204204
fi
205205

206+
##########################################
207+
# REAL COMPILATION SECTION STARTING HERE #
208+
##########################################
209+
210+
# Collect make environment variables, similar to 'kernel-make.sh'
211+
uboot_make_envs=(
212+
"CFLAGS='${uboot_cflags}'"
213+
"KCFLAGS='${uboot_cflags}'"
214+
"CCACHE_BASEDIR=$(pwd)"
215+
"PATH=${toolchain}:${toolchain2}:${PATH}"
216+
"PYTHONPATH=\"${PYTHON3_INFO[MODULES_PATH]}:${PYTHONPATH}\"" # Insert the pip modules downloaded by Armbian into PYTHONPATH (needed e.g. for pyelftools)
217+
)
218+
206219
# workaround when two compilers are needed
207220
cross_compile="CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
208221
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed
@@ -213,8 +226,7 @@ function compile_uboot_target() {
213226
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make} with gcc '${gcc_version_main}'" "info"
214227
declare -g if_error_detail_message="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
215228
do_with_ccache_statistics run_host_command_logged_long_running \
216-
"CFLAGS='${uboot_cflags}'" "KCFLAGS='${uboot_cflags}'" \
217-
CCACHE_BASEDIR="$(pwd)" PATH="${toolchain}:${toolchain2}:${PATH}" \
229+
"env" "-i" "${uboot_make_envs[@]}" \
218230
unbuffer make "$target_make" "$CTHREADS" "${cross_compile}"
219231

220232
display_alert "${uboot_prefix}built u-boot target" "${version} in $((SECONDS - ts)) seconds" "info"

0 commit comments

Comments
 (0)