From 2fc5f0e2e0ab18e2d39f6a2a43378a87eb4d98db Mon Sep 17 00:00:00 2001 From: Jianyong Wu Date: Sun, 2 Apr 2023 09:09:13 +0000 Subject: [PATCH] kata-depoly: prepare env for cross build in lib.sh We leverage three env, TARGET_ARCH means the buid target tuple; ARCH nearly the same meaning with TARGET_ARCH but has been widely used in kata; CROSS_BUILD means if you want to do cross compile. Signed-off-by: Jianyong Wu --- tools/packaging/scripts/lib.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/packaging/scripts/lib.sh b/tools/packaging/scripts/lib.sh index 1f0173e47..e7a6fc987 100644 --- a/tools/packaging/scripts/lib.sh +++ b/tools/packaging/scripts/lib.sh @@ -19,6 +19,16 @@ short_commit_length=10 hub_bin="hub-bin" +#for cross build +CROSS_BUILD=${CROSS_BUILD-:} +BUILDX="" +PLATFORM="" +TARGET_ARCH=${TARGET_ARCH:-$(uname -m)} +ARCH=${ARCH:-$(uname -m)} +[ "${TARGET_ARCH}" == "aarch64" ] && TARGET_ARCH=arm64 +TARGET_OS=${TARGET_OS:-linux} +[ "${CROSS_BUILD}" == "true" ] && BUILDX=buildx && PLATFORM="--platform=${TARGET_OS}/${TARGET_ARCH}" + clone_tests_repo() { # KATA_CI_NO_NETWORK is (has to be) ignored if there is # no existing clone. @@ -189,7 +199,7 @@ get_ovmf_image_name() { } get_virtiofsd_image_name() { - ARCH=$(uname -m) + ARCH=${ARCH:-$(uname -m)} case ${ARCH} in "aarch64") libc="musl"