From 8319736235da71a65780937fb3e551f0a4e66fb0 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Sun, 12 May 2024 19:03:47 +1000 Subject: [PATCH] make arm64 conditional Should now build for both, amd64 and arm64. Signed-off-by: Gerwin Klein --- Makefile | 2 +- build.sh | 2 +- scripts/sel4.sh | 41 ++++++++++++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 64e2003..f1f4ee9 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ ifeq ($(HOST_ARCH),x86_64) DOCKER_PLATFORM := "linux/amd64" else ifeq ($(HOST_ARCH),arm64) # We assume ARMv8 as the platform - DOCKER_PLATFORM := "linux/arm64/v8" + DOCKER_PLATFORM := "linux/arm64" else @echo "Unsupported host architecture: $HOST_ARCH" @exit 1 diff --git a/build.sh b/build.sh index 9c606bd..0ec3ddf 100755 --- a/build.sh +++ b/build.sh @@ -232,7 +232,7 @@ if [[ $HOST_ARCH == "x86_64" ]]; then elif [[ $HOST_ARCH == "amd64" ]]; then DOCKER_PLATFORM="linux/amd64" elif [[ $HOST_ARCH == "arm64" ]]; then - DOCKER_PLATFORM="linux/arm64/v8" + DOCKER_PLATFORM="linux/arm64" else echo "Unsupported host architecture: $HOST_ARCH" exit 1 diff --git a/scripts/sel4.sh b/scripts/sel4.sh index aaf8e63..6410084 100644 --- a/scripts/sel4.sh +++ b/scripts/sel4.sh @@ -25,6 +25,19 @@ test -d "$DIR" || DIR=$PWD # tmp space for building : "${TEMP_DIR:=/tmp}" +X64_CROSS="g++-10-aarch64-linux-gnu gcc-10-aarch64-linux-gnu gcc-10-multilib" +ARM64_CROSS="gcc-10-x86-64-linux-gnu:arm64 g++-10-x86-64-linux-gnu:arm64 \ + gcc-10-i686-linux-gnu:arm64 g++-10-i686-linux-gnu:arm64" + +if [[ $DOCKER_PLATFORM=="linux/amd64" ]]; then + CROSS="$X64_CROSS" +elif [[ $DOCKER_PLATFORM=="linux/arm64" ]]; then + CROSS="$ARM64_CROSS" +else + echo "Unkown docker platform $DOCKER_PLATFORM" + exit 1 +fi + # Add additional architectures for cross-compiled libraries. # Install the tools required to compile seL4. as_root apt-get update -q @@ -65,13 +78,10 @@ as_root apt-get install -y --no-install-recommends \ gcc-10-arm-linux-gnueabihf \ gcc-10-base \ gcc-riscv64-unknown-elf \ - gcc-10-x86-64-linux-gnu:arm64 \ - g++-10-x86-64-linux-gnu:arm64 \ - gcc-10-i686-linux-gnu:arm64 \ - g++-10-i686-linux-gnu:arm64 \ libclang-11-dev \ qemu-system-arm \ - qemu-system-misc + qemu-system-misc \ + $CROSS # end of list if [ "$DESKTOP_MACHINE" = "no" ] ; then @@ -91,6 +101,20 @@ if [ "$DESKTOP_MACHINE" = "no" ] ; then as_root update-alternatives --auto "$name" || : done done + if [[ $DOCKER_PLATFORM=="linux/amd64" ]]; then + MORE_COMP="" + elif [[ $DOCKER_PLATFORM=="linux/arm64" ]]; then + MORE_COMP="gcc-${compiler_version}-x86-64-linux-gnu \ + cpp-${compiler_version}-x86-64-linux-gnu \ + g++-${compiler_version}-x86-64-linux-gnu \ + gcc-${compiler_version}-i686-linux-gnu \ + cpp-${compiler_version}-i686-linux-gnu \ + g++-${compiler_version}-i686-linux-gnu \ + " + else + echo "Unkown docker platform $DOCKER_PLATFORM" + exit 1 + fi for compiler in gcc-${compiler_version}-arm-linux-gnueabi \ cpp-${compiler_version}-arm-linux-gnueabi \ @@ -101,12 +125,7 @@ if [ "$DESKTOP_MACHINE" = "no" ] ; then gcc-${compiler_version}-arm-linux-gnueabihf \ cpp-${compiler_version}-arm-linux-gnueabihf \ g++-${compiler_version}-arm-linux-gnueabihf \ - gcc-${compiler_version}-x86-64-linux-gnu \ - cpp-${compiler_version}-x86-64-linux-gnu \ - g++-${compiler_version}-x86-64-linux-gnu \ - gcc-${compiler_version}-i686-linux-gnu \ - cpp-${compiler_version}-i686-linux-gnu \ - g++-${compiler_version}-i686-linux-gnu \ + $MORE_COMP # end of list do echo ${compiler}