1 From 12f147bd9367649d3704a7abd6c520ce3124d340 Mon Sep 17 00:00:00 2001
2 From: Jackie Huang <jackie.huang@windriver.com>
3 Date: Tue, 1 Aug 2023 17:49:30 +0800
4 Subject: [PATCH 2/9] stx-init-env: add support arch specific dockerfile
6 Check the host arch by uname and if there arch specific
7 dockerfiles (suffix with _arm64) exist, use it to do
11 PASS: add stx-lat-tool_arm64.Dockerfile and made adjustment
12 PASS: run ./stx-init-env --rebuild on x86-64 host
13 PASS: run ./stx-init-env --rebuild on arm64 host
14 PASS: build-pkgs on x86-64 host
15 PASS: build-image on x86-64 host
16 PASS: build-pkgs on arm64 host
17 PASS: build-image on arm64 host
18 PASS: Deploy AIO-SX on x86-64 target
19 PASS: Deploy AIO-SX on arm64 target
20 PASS: Deploy AIO-DX on x86-64 target
21 PASS: Deploy AIO-DX on arm64 target
26 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
27 Change-Id: I3912eda4033ad0a6a2c0c4d3d29098215362343c
29 stx-init-env | 15 +++++++++++++--
30 1 file changed, 13 insertions(+), 2 deletions(-)
32 diff --git a/stx-init-env b/stx-init-env
33 index b9fa668..6f1a989 100755
36 @@ -86,6 +86,12 @@ ASSUME_YES=0
38 COREUTILS_DOCKER_IMAGE="debian:bookworm-20240130-slim"
41 +uname_arch=$(uname -m)
42 +if [ "${uname_arch}" = "aarch64" ]; then
49 @@ -718,14 +724,19 @@ if [[ -n "${BUILD_DOCKER_IMAGES}" ]] ; then
50 docker_build_args+=("--no-cache")
52 for img in $BUILD_DOCKER_IMAGES; do
53 + img_dockerfile=${img}.Dockerfile
54 + if [[ -f $STX_TOOLS_DIR/stx/dockerfiles/${img}_${ARCH}.Dockerfile ]]; then
55 + img_dockerfile=${img}_${ARCH}.Dockerfile
59 - if grep -q -E '^\s*ARG\s+STX_MIRROR_URL\s*=' "$STX_TOOLS_DIR/"stx/dockerfiles/$img.Dockerfile ; then
60 + if grep -q -E '^\s*ARG\s+STX_MIRROR_URL\s*=' "$STX_TOOLS_DIR/"stx/dockerfiles/${img_dockerfile} ; then
62 if [[ -n "$STX_MIRROR_URL" ]] ; then
63 extra_build_args+=("--build-arg" "STX_MIRROR_URL=$STX_MIRROR_URL")
66 - docker build "${docker_build_args[@]}" "${extra_build_args[@]}" -t $img:$DOCKER_TAG_LOCAL -f "$STX_TOOLS_DIR/"stx/dockerfiles/$img.Dockerfile "$STX_TOOLS_DIR" || exit 1
67 + docker build "${docker_build_args[@]}" "${extra_build_args[@]}" -t $img:$DOCKER_TAG_LOCAL -f "$STX_TOOLS_DIR/"stx/dockerfiles/${img_dockerfile} "$STX_TOOLS_DIR" || exit 1
68 info "built image $img:$DOCKER_TAG_LOCAL"