Skip to content

Commit

Permalink
make arm64 conditional
Browse files Browse the repository at this point in the history
Should now build for both, amd64 and arm64.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
  • Loading branch information
lsf37 committed May 12, 2024
1 parent 17ca547 commit 8319736
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 30 additions & 11 deletions scripts/sel4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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}
Expand Down

0 comments on commit 8319736

Please sign in to comment.