2021-04-29 09:20:31 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2021 Intel Corporation. All rights reserved.
|
|
|
|
|
|
|
|
# "All problems can be solved by another level of indirection"
|
|
|
|
# Ideally, this script would not be needed.
|
2021-07-12 14:28:35 +08:00
|
|
|
#
|
|
|
|
# Minor adjustments to the docker image provided by the Zephyr project.
|
2021-04-29 09:20:31 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
unset ZEPHYR_BASE
|
|
|
|
|
2022-04-26 07:30:18 +08:00
|
|
|
# Make sure we're in the right place
|
2022-07-13 11:08:31 +08:00
|
|
|
test -e ./sof/scripts/xtensa-build-zephyr.py
|
2021-07-12 14:28:35 +08:00
|
|
|
|
2022-09-17 07:48:55 +08:00
|
|
|
# See .github/workflows/zephyr.yml
|
2022-11-22 04:46:12 +08:00
|
|
|
# /opt/sparse is the current location in the zephyr-build image.
|
|
|
|
# Give any sparse in the workspace precedence.
|
|
|
|
PATH="$(pwd)"/sparse:/opt/sparse/bin:"$PATH"
|
|
|
|
command -V sparse || true
|
2022-09-17 07:48:55 +08:00
|
|
|
: REAL_CC="$REAL_CC"
|
2022-04-26 07:30:18 +08:00
|
|
|
|
|
|
|
|
2022-10-06 13:09:31 +08:00
|
|
|
# TODO: move all code to a function
|
2022-04-26 07:30:18 +08:00
|
|
|
# https://github.com/thesofproject/sof-test/issues/740
|
|
|
|
|
2021-09-29 01:56:16 +08:00
|
|
|
# As of container version 0.18.4,
|
|
|
|
# https://github.com/zephyrproject-rtos/docker-image/blob/master/Dockerfile
|
|
|
|
# installs two SDKs: ZSDK_VERSION=0.12.4 and ZSDK_ALT_VERSION=0.13.1
|
|
|
|
# ZEPHYR_SDK_INSTALL_DIR points at ZSDK_VERSION but we want the latest.
|
2021-09-28 10:19:43 +08:00
|
|
|
unset ZEPHYR_SDK_INSTALL_DIR
|
|
|
|
|
|
|
|
# Zephyr's CMake does not look in /opt but it searches $HOME
|
|
|
|
ls -ld /opt/toolchains/zephyr-sdk-*
|
2022-05-07 14:13:28 +08:00
|
|
|
ln -s /opt/toolchains/zephyr-sdk-* ~/ || true
|
2021-09-28 10:19:43 +08:00
|
|
|
|
2022-12-15 10:35:04 +08:00
|
|
|
# CMake v3.21 changed the order object files are passed to the linker.
|
|
|
|
# This makes builds before that version not reproducible.
|
|
|
|
# To save time don't install if recent enough.
|
|
|
|
pip install 'cmake>=3.21'
|
|
|
|
PATH="$HOME"/.local/bin:"$PATH"
|
|
|
|
|
2022-08-04 01:54:45 +08:00
|
|
|
if test -e .west || test -e zephyr; then
|
|
|
|
init_update=''
|
|
|
|
else
|
|
|
|
init_update='-u'
|
|
|
|
fi
|
2022-09-17 07:48:55 +08:00
|
|
|
|
|
|
|
# To investigate what went wrong enable the trailing comment.
|
|
|
|
# This cannot be enabled by default for automation reasons.
|
|
|
|
./sof/scripts/xtensa-build-zephyr.py $init_update --no-interactive "$@" # || /bin/bash
|