Add libaio submodule and scripts to build the Purecap libaio library and its testsuite.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com --- .gitignore | 1 + .gitmodules | 3 +++ morello/projects/libs/libaio | 1 + morello/scripts/build-all.sh | 1 + morello/scripts/build-libaio.sh | 39 +++++++++++++++++++++++++++++++ morello/scripts/configure-libs.sh | 2 +- 6 files changed, 46 insertions(+), 1 deletion(-) create mode 160000 morello/projects/libs/libaio create mode 100755 morello/scripts/build-libaio.sh
diff --git a/.gitignore b/.gitignore index fb74567..45f16f1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /morello/.linux-env /morello/.busybox-env /morello/.morello-linux-headers-env +/morello/.libaio-env /morello/morello-docker/ /morello/linux-out/ /morello/bsp/ diff --git a/.gitmodules b/.gitmodules index 65381de..4ce2789 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "morello/projects/morello-busybox"] path = morello/projects/morello-busybox url = https://git.morello-project.org/morello/morello-busybox.git +[submodule "libaio"] + path = morello/projects/libs/libaio + url = /home/tudcre01/morello-next/libaio/purecap/ diff --git a/morello/projects/libs/libaio b/morello/projects/libs/libaio new file mode 160000 index 0000000..f570643 --- /dev/null +++ b/morello/projects/libs/libaio @@ -0,0 +1 @@ +Subproject commit f5706435e94a32236e03d296923ae18891a0bad7 diff --git a/morello/scripts/build-all.sh b/morello/scripts/build-all.sh index 487e77f..4d623c7 100755 --- a/morello/scripts/build-all.sh +++ b/morello/scripts/build-all.sh @@ -178,6 +178,7 @@ main () { if [ "$OPTIONS_LIBS" = "on" ]; then # Build Libraries ${MORELLO_AARCH64_HOME}/scripts/configure-libs.sh + ${MORELLO_AARCH64_HOME}/scripts/build-libaio.sh fi
if [ "$OPTIONS_TOOLCHAIN_LIB" = "on" ]; then diff --git a/morello/scripts/build-libaio.sh b/morello/scripts/build-libaio.sh new file mode 100755 index 0000000..22b8619 --- /dev/null +++ b/morello/scripts/build-libaio.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# SPDX-License-Identifier: BSD-3-Clause + +libaio_clean() { + make clean +} + +libaio_build() { + local _NCORES=$(nproc --all) + local CC=clang + local LIBAIO_HOME="${LIBS_HOME}/libaio" + local LIBAIO_OUTPUT="${LIBS_OUTPUT}/libaio" + local LIBAIO_TEST_OUTPUT="${LIBAIO_OUTPUT}/usr/share/libaio-test" + local KHDR_DIR="${MORELLO_PROJECTS}/morello-linux-headers/usr/include" + local CFLAGS="--target=aarch64-linux-musl_purecap -march=morello+c64 \ + --sysroot=$MUSL_BIN -isystem ${KHDR_DIR} -g" + local LDFLAGS="--target=aarch64-linux-musl_purecap -rtlib=compiler-rt \ + --sysroot=$MUSL_BIN -fuse-ld=lld -static" + + # Build libaio for Morello, including testsuite + cd $LIBAIO_HOME + + if [ "$OPTIONS_CLEAN" = "on" ]; then + libaio_clean + fi + + CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ENABLE_SHARED=0 make -j$_NCORES + CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" make -C harness -j$_NCORES + CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ENABLE_SHARED=0 DESTDIR=$LIBAIO_OUTPUT make install -j$_NCORES + + # Install test binaries + mkdir -p ${LIBAIO_TEST_OUTPUT} + cp "${LIBAIO_HOME}/harness/runtests.sh" ${LIBAIO_TEST_OUTPUT} + cp "${LIBAIO_HOME}/harness/ext2-enospc.img" ${LIBAIO_TEST_OUTPUT} + cp "${LIBAIO_HOME}/harness/cases/"*p ${LIBAIO_TEST_OUTPUT} +} + +libaio_build $@ diff --git a/morello/scripts/configure-libs.sh b/morello/scripts/configure-libs.sh index 063fbe7..b164415 100755 --- a/morello/scripts/configure-libs.sh +++ b/morello/scripts/configure-libs.sh @@ -21,7 +21,7 @@ submodule_update_projects() { cd ${CURR_DIR} }
-PROJECTS_LIST=( morello-linux-headers ) +PROJECTS_LIST=( morello-linux-headers libaio )
for proj in "${PROJECTS_LIST[@]}"; do if [ ! -f "${CURR_DIR}/.${proj}-env" ]; then