Skip to content

Commit 4bdefd7

Browse files
marc-hblgirdwood
authored andcommitted
zephyr/docker-build.sh: explain why we autodetect with FindZephyr-sdk
Pure comment change, no code change. Kudos to Stephanos Ioannidis for patiently explaining this to me on Discord. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent ac4cf61 commit 4bdefd7

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

zephyr/docker-build.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,27 @@ command -V sparse || true
2626
# TODO: move all code to a function
2727
# https://github.com/thesofproject/sof-test/issues/740
2828

29-
# As of container version 0.18.4,
30-
# https://github.com/zephyrproject-rtos/docker-image/blob/master/Dockerfile
31-
# installs two SDKs: ZSDK_VERSION=0.12.4 and ZSDK_ALT_VERSION=0.13.1
32-
# ZEPHYR_SDK_INSTALL_DIR points at ZSDK_VERSION but we want the latest.
33-
unset ZEPHYR_SDK_INSTALL_DIR
3429

35-
# Zephyr's CMake does not look in /opt but it searches $HOME
30+
# Zephyr's CI has complex use cases and considers FindZephyr-sdk.cmake
31+
# autodetection to be too unpredictable and risky. So in these docker images,
32+
# they install the SDK in /opt/toolchains/ to *avoid autodetection on
33+
# purpose*. By design, this forces Zephyr CI to hardcode ZEPHYR_SDK_INSTALL_DIR
34+
# everywhere (see for instance
35+
# https://github.com/zephyrproject-rtos/zephyr/commit/d6329386e9). But we
36+
# already hardcode the docker image version (currently in
37+
# zephyr/docker-run.sh). Our use case is simple, immutable and safe and we
38+
# don't need to version _twice_ what is for us the same thing. Creating these
39+
# symlinks restores the convenient autodetection so this script can be easily
40+
# re-used with any docker image version.
3641
ls -ld /opt/toolchains/zephyr-sdk-*
3742
ln -s /opt/toolchains/zephyr-sdk-* ~/ || true
3843

44+
# Make sure FindZephyr-sdk.cmake returns the highest version. For instance,
45+
# the old container version 0.18.4 had two SDKs installed: ZSDK_VERSION=0.12.4
46+
# and ZSDK_ALT_VERSION=0.13.1. Back then, ZEPHYR_SDK_INSTALL_DIR pointed at the
47+
# older one!
48+
unset ZEPHYR_SDK_INSTALL_DIR
49+
3950
# CMake v3.21 changed the order object files are passed to the linker.
4051
# This makes builds before that version not reproducible.
4152
# To save time don't install if recent enough.

0 commit comments

Comments
 (0)