2018-04-26 00:48:41 +08:00
|
|
|
#!/bin/sh
|
2019-06-02 04:58:16 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2018 Intel Corporation. All rights reserved.
|
2018-04-26 00:48:41 +08:00
|
|
|
|
|
|
|
# Runs a given script in the docker container you can generate from the
|
|
|
|
# docker_build directory.
|
|
|
|
# Example:
|
|
|
|
# To build sof for baytrail:
|
|
|
|
# ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh byt
|
|
|
|
# To build topology:
|
2019-01-03 17:09:12 +08:00
|
|
|
# ./scripts/docker-run.sh ./scripts/build-tools.sh
|
2018-04-26 00:48:41 +08:00
|
|
|
|
2021-01-19 08:45:20 +08:00
|
|
|
# set -x
|
|
|
|
|
2021-09-30 12:10:19 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
SOF_TOP="$(cd "$(dirname "$0")"/.. && /bin/pwd)"
|
|
|
|
|
2022-01-07 06:49:09 +08:00
|
|
|
# Log container versions
|
|
|
|
for rep in sof thesofproject/sof; do
|
|
|
|
docker images --digests "$rep"
|
|
|
|
done
|
2021-09-30 09:16:20 +08:00
|
|
|
|
2021-01-19 08:45:20 +08:00
|
|
|
if tty --quiet; then
|
|
|
|
SOF_DOCKER_RUN="$SOF_DOCKER_RUN --tty"
|
|
|
|
fi
|
|
|
|
|
2022-04-26 07:30:18 +08:00
|
|
|
# Not fatal, just a warning to allow other "creative" solutions.
|
|
|
|
# TODO: fix this with 'adduser' like in zephyr/docker-build.sh
|
|
|
|
test "$(id -n)" = 1001 ||
|
|
|
|
>&2 printf "Warning: this script should be run as user ID 1001 to match the container\n"
|
|
|
|
|
2022-01-07 06:49:09 +08:00
|
|
|
set -x
|
2021-09-30 12:10:19 +08:00
|
|
|
docker run -i -v "${SOF_TOP}":/home/sof/work/sof.git \
|
2021-09-30 07:11:23 +08:00
|
|
|
-v "${SOF_TOP}":/home/sof/work/sof-bind-mount-DO-NOT-DELETE \
|
2020-09-15 12:59:17 +08:00
|
|
|
--env CMAKE_BUILD_TYPE \
|
2020-09-25 13:07:07 +08:00
|
|
|
--env PRIVATE_KEY_OPTION \
|
2022-04-02 05:23:42 +08:00
|
|
|
--env USE_XARGS \
|
|
|
|
--env NO_PROCESSORS \
|
|
|
|
--env VERBOSE \
|
2021-05-12 01:55:44 +08:00
|
|
|
--env http_proxy="$http_proxy" \
|
|
|
|
--env https_proxy="$https_proxy" \
|
2021-05-12 02:11:14 +08:00
|
|
|
--user "$(id -u)" \
|
2021-01-19 08:45:20 +08:00
|
|
|
$SOF_DOCKER_RUN \
|
2022-01-07 06:50:54 +08:00
|
|
|
thesofproject/sof "$@"
|