Skip to content

Commit 36698f3

Browse files
iavclaude
andcommitted
uboot: fix ccache environment and add extension hook
U-Boot build uses `env -i` which clears all environment variables. CCACHE_DIR and CCACHE_TEMPDIR were not explicitly passed to make, unlike kernel build (kernel-make.sh). This caused ccache to use default directory instead of configured Armbian one, breaking cache statistics and shared cache functionality. Changes: - Add CCACHE_DIR and CCACHE_TEMPDIR to uboot_make_envs - Add uboot_make_config hook for extensions (similar to kernel_make_config), allowing modification of environment variables before compilation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent ed556ee commit 36698f3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/functions/compilation/uboot.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,25 @@ function compile_uboot_target() {
240240
"PYTHONPATH=\"${PYTHON3_INFO[MODULES_PATH]}:${PYTHONPATH}\"" # Insert the pip modules downloaded by Armbian into PYTHONPATH (needed e.g. for pyelftools)
241241
)
242242

243+
# Pass the ccache directories explicitly, since we'll run under "env -i"
244+
if [[ -n "${CCACHE_DIR}" ]]; then
245+
uboot_make_envs+=("CCACHE_DIR='${CCACHE_DIR}'")
246+
fi
247+
if [[ -n "${CCACHE_TEMPDIR}" ]]; then
248+
uboot_make_envs+=("CCACHE_TEMPDIR='${CCACHE_TEMPDIR}'")
249+
fi
250+
243251
# workaround when two compilers are needed
244252
cross_compile="CROSS_COMPILE=\"$CCACHE $UBOOT_COMPILER\""
245253
[[ -n $UBOOT_TOOLCHAIN2 ]] && cross_compile="ARMBIAN=foe" # empty parameter is not allowed
246254

255+
call_extension_method "uboot_make_config" <<- 'UBOOT_MAKE_CONFIG'
256+
*Hook to customize u-boot make environment*
257+
Called right before invoking make for u-boot compilation.
258+
Available array to modify:
259+
- uboot_make_envs[@]: environment variables passed via "env -i" (e.g., CCACHE_REMOTE_STORAGE)
260+
UBOOT_MAKE_CONFIG
261+
247262
display_alert "${uboot_prefix}Compiling u-boot" "${version} ${target_make} with gcc '${gcc_version_main}'" "info"
248263
declare -g if_error_detail_message="${uboot_prefix}Failed to build u-boot ${version} ${target_make}"
249264
do_with_ccache_statistics run_host_command_logged_long_running \

0 commit comments

Comments
 (0)