Skip to content

Aarch64 support

Hugo Lefeuvre edited this page Mar 8, 2021 · 17 revisions

We provide basic ARM64 support to run applications as unikernels. We support the LibreComputer Potato board. The entire build process is done on a regular x86-64 host. The only requirement for the board is that KVM should be enabled in the Linux kernel running on the host, i.e. you should have the vitual file /dev/kvm.

Here are the instructions to build and execute HermiTux for aarch64. This guide targets a host with a Debian 10 distribution.

Prerequisites

On the x86-64 host, in addition to the regular HermiTux requirements:

sudo apt install build-essential nasm texinfo libmpfr-dev libmpc-dev \
    libgmp-dev flex bison libisl-dev aarch64-linux-gnu-gcc

Compile the toolchain

Unlike the x86-64 ISA for which the HermitCore toolchain is available as precompiled binaries, for aarch64 we need to compile that toolchain that will be in turn used to compile the HermiTux kernel.

Clone the toolchain repo and launch the toolchain build process. It can take a bit of time:

cd hermitux
git clone https://github.com/ssrg-vt/hermitux-toolchain.git
cd hermitux-toolchain
./toolchain.sh aarch64-hermit $(pwd)/prefix

Once the toolchain is built you should have the cross compilation tools ready in hermitux/hermit-toolchain/prefix/bin

Compile the kernel

First, let's remove any existing installation of the x86-64 kernel:

cd hermitux/hermitux-kernel
rm -rf build prefix

Then checkout the arm64 branch of the kernel repo:

git checkout aarch64-devel
git submodule init && git submodule update

Configure and build the kernel:

mkdir build
cd build
cmake -DHERMIT_ARCH=aarch64 \
    -DTOOLCHAIN_BIN_DIR=$(pwd)/../../hermitux-toolchain/prefix/bin \
    -DCMAKE_INSTALL_PREFIX=$(pwd)/../prefix ..
make -j`nproc` && make install

At that point we have both the kernel and hypervisor ready:

  • kernel: hermitux-kernel/prefix/aarch64-hermit/extra/tests/hermitux
  • hypervisor: hermitux-kernel/prefix/bin/proxy

Compile the C library

For now the arm64 version of HermiTux is only compatible with Musl. Remove any existing x86-64 install and compile the arm64 version:

cd hermitux/musl
git clean -xdf
./configure CC=aarch64-linux-gnu-gcc LD=aarch64-linux-gnu-ld --prefix=$(pwd)/prefix --target=aarch64-linux-gnu
make -j`nproc` && make install

Compile and launch an application

Let us try NPB IS:

cd hermitux/apps/npb/is
../../../musl/prefix/bin/musl-gcc *.c -o is -static -lm

Next, transfer the following from the host to the host: the application binary we just compiled (is), as well as the kernel (hermitux) and the hypervisor (proxy). On the board, launch the application within HermiTux as follows:

HERMIT_TUX=1 ./proxy hermitux is