From 47c058599a3980e3d4dd86b1282561f86646dc55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 16 Feb 2023 09:12:05 +0100 Subject: [PATCH 1/2] packaging/shim-v2: Install the target depending on the arch/libc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the `install_go_rust.sh` file we're adding a x86_64-unknown-linux-musl target unconditionally. That should be, instead, based in the ARCH of the host and the appropriate LIBC to be used with that host. Signed-off-by: Fabiano FidĂȘncio --- .../static-build/shim-v2/install_go_rust.sh | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/packaging/static-build/shim-v2/install_go_rust.sh b/tools/packaging/static-build/shim-v2/install_go_rust.sh index db192f673b..502d5f085c 100755 --- a/tools/packaging/static-build/shim-v2/install_go_rust.sh +++ b/tools/packaging/static-build/shim-v2/install_go_rust.sh @@ -50,12 +50,37 @@ EOF trap finish EXIT +go_version=${1:-} rust_version=${2:-} + ARCH=${ARCH:-$(uname -m)} -LIBC=${LIBC:-musl} +case "${ARCH}" in + aarch64) + goarch=arm64 + LIBC=musl + ;; + ppc64le) + goarch=${ARCH} + ARCH=powerpc64le + LIBC=gnu + ;; + s390x) + goarch=${ARCH} + LIBC=gnu + ;; + x86_64) + goarch=amd64 + LIBC=musl + ;; + *) + echo "unsupported architecture $(uname -m)" + exit 1 + ;; +esac + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC} source /root/.cargo/env -rustup target add x86_64-unknown-linux-musl +rustup target add ${ARCH}-unknown-linux-${LIBC} pushd "${tmp_dir}" @@ -70,9 +95,6 @@ done shift $(( $OPTIND - 1 )) - -go_version=${1:-} - if [ -z "$go_version" ];then echo "Missing go" usage 1 @@ -90,14 +112,6 @@ if command -v go; then fi fi -case "$(uname -m)" in - aarch64) goarch="arm64";; - ppc64le) goarch="ppc64le";; - x86_64) goarch="amd64";; - s390x) goarch="s390x";; - *) echo "unsupported architecture: $(uname -m)"; exit 1;; -esac - info "Download go version ${go_version}" kernel_name=$(uname -s) curl -OL "https://storage.googleapis.com/golang/go${go_version}.${kernel_name,,}-${goarch}.tar.gz" From be40683bc592f2373e3c282225e6605db8e202ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 16 Feb 2023 15:47:25 +0100 Subject: [PATCH 2/2] runtime-rs: Add a generic powerpc64le-options.mk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's a check in the runtime-rs Makefile that basically checks whether the `arch/$arch-options.mk` exists or not and, if it doesn't, the build is just aborted. With this in mind, let's create a generic powerpc64le-options.mk file and not bail when building for this architecture. Fixes: #6142 Signed-off-by: Fabiano FidĂȘncio --- src/runtime-rs/arch/powerpc64le-options.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/runtime-rs/arch/powerpc64le-options.mk diff --git a/src/runtime-rs/arch/powerpc64le-options.mk b/src/runtime-rs/arch/powerpc64le-options.mk new file mode 100644 index 0000000000..0a974680e0 --- /dev/null +++ b/src/runtime-rs/arch/powerpc64le-options.mk @@ -0,0 +1,15 @@ +# Copyright (c) 2019-2022 Alibaba Cloud +# Copyright (c) 2019-2022 Ant Group +# +# SPDX-License-Identifier: Apache-2.0 +# + +MACHINETYPE := pseries +KERNELPARAMS := +MACHINEACCELERATORS := "cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-large-decr=off,cap-ccf-assist=off" +CPUFEATURES := pmu=off + +QEMUCMD := qemu-system-ppc64 + +# dragonball binary name +DBCMD := dragonball