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:
|
2023-01-27 23:34:40 +08:00
|
|
|
# To build sof for tigerlake:
|
|
|
|
# ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh tgl
|
2018-04-26 00:48:41 +08:00
|
|
|
# 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-10-06 13:15:36 +08:00
|
|
|
# The --user option below can cause the command to run as a user who
|
|
|
|
# does not exist in the container. So far so good but in case something
|
|
|
|
# ever goes wrong try replacing --user with the newer
|
|
|
|
# scripts/sudo-cwd.sh script.
|
|
|
|
test "$(id -u)" = 1000 ||
|
|
|
|
>&2 printf "Warning: this script should be run as user ID 1000 to match the container's account\n"
|
2022-04-26 07:30:18 +08:00
|
|
|
|
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-01-19 08:45:20 +08:00
|
|
|
$SOF_DOCKER_RUN \
|
2024-05-22 04:56:10 +08:00
|
|
|
thesofproject/sof:latest ./scripts/sudo-cwd.sh "$@"
|