Hi all,
As the tag suggests, this series targets the morello-pcuabi-env project [1]. It aims to enable support to build Morello ports of various libraries. The submodules paths are local to my workspace at the moment, but will point to the public Gitlab libraries sub-group [2], once it's populated.
This series also exemplifies how two such Morello library ports are making use of the new build support: libaio and liburing.
Review branch: https://git.morello-project.org/tudcre01/morello-pcuabi-env/-/commits/morell...
[1] https://git.morello-project.org/morello/morello-pcuabi-env [2] https://git.morello-project.org/morello/libraries/
Tudor Cretu (4): Rename build-lib to toolchain-lib Add support to build software libraries Integrate Morello libaio Integrate Morello liburing
.gitignore | 4 ++ .gitmodules | 6 +++ morello/projects/libs/libaio | 1 + morello/projects/libs/liburing | 1 + morello/scripts/build-all.sh | 29 ++++++++++---- morello/scripts/build-busybox-docker.sh | 7 ++++ morello/scripts/build-libaio.sh | 39 +++++++++++++++++++ morello/scripts/build-liburing.sh | 33 ++++++++++++++++ ...raries.sh => build-toolchain-libraries.sh} | 0 morello/scripts/configure-libs.sh | 31 +++++++++++++++ 10 files changed, 144 insertions(+), 7 deletions(-) create mode 160000 morello/projects/libs/libaio create mode 160000 morello/projects/libs/liburing create mode 100755 morello/scripts/build-libaio.sh create mode 100755 morello/scripts/build-liburing.sh rename morello/scripts/{build-libraries.sh => build-toolchain-libraries.sh} (100%) create mode 100755 morello/scripts/configure-libs.sh
Various user application software libraries will be ported and integrated into the SDK. Rename the toolchain libs build options and scripts to better differentiate between them.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com --- morello/scripts/build-all.sh | 14 +++++++------- ...d-libraries.sh => build-toolchain-libraries.sh} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename morello/scripts/{build-libraries.sh => build-toolchain-libraries.sh} (100%)
diff --git a/morello/scripts/build-all.sh b/morello/scripts/build-all.sh index d57a69c..043ffce 100755 --- a/morello/scripts/build-all.sh +++ b/morello/scripts/build-all.sh @@ -48,7 +48,7 @@ OPTIONS_KSELFTEST="off" OPTIONS_C_APPS="off" OPTIONS_ROOTFS="off" OPTIONS_DOCKER="off" -OPTIONS_BUILD_LIB="off" +OPTIONS_TOOLCHAIN_LIB="off" OPTIONS_DEV_MODE="off" OPTIONS_ENV_INSTALL="off" OPTIONS_CLEAN="off" @@ -60,7 +60,7 @@ export OPTIONS_KSELFTEST export OPTIONS_C_APPS export OPTIONS_ROOTFS export OPTIONS_DOCKER -export OPTIONS_BUILD_LIB +export OPTIONS_TOOLCHAIN_LIB export OPTIONS_DEV_MODE export OPTIONS_ENV_INSTALL export OPTIONS_CLEAN @@ -85,7 +85,7 @@ OPTIONS: --c-apps builds example c applications for Morello --rootfs builds the rootfs for Morello --docker generate a busybox based docker image - --build-lib build libraries from source (e.g. compiler_rt, crtobjects...) + --toolchain-lib builds toolchain libraries from source (e.g. compiler_rt, crtobjects...)
--clean cleans all the selected projects
@@ -110,7 +110,7 @@ main () { --c-apps) OPTIONS_C_APPS="on" ;; --rootfs) OPTIONS_ROOTFS="on" ;; --docker) OPTIONS_DOCKER="on";; - --build-lib) OPTIONS_BUILD_LIB="on";; + --toolchain-lib) OPTIONS_TOOLCHAIN_LIB="on";; --clean) OPTIONS_CLEAN="on";; --install) OPTIONS_INSTALL="on" ;; --help|-h) help ;; @@ -167,9 +167,9 @@ main () { ${MORELLO_AARCH64_HOME}/scripts/build-kselftest.sh fi
- if [ "$OPTIONS_BUILD_LIB" = "on" ]; then - # Build Libraries - ${MORELLO_AARCH64_HOME}/scripts/build-libraries.sh + if [ "$OPTIONS_TOOLCHAIN_LIB" = "on" ]; then + # Build Toolchain Libraries + ${MORELLO_AARCH64_HOME}/scripts/build-toolchain-libraries.sh fi
if [ "$OPTIONS_C_APPS" = "on" ]; then diff --git a/morello/scripts/build-libraries.sh b/morello/scripts/build-toolchain-libraries.sh similarity index 100% rename from morello/scripts/build-libraries.sh rename to morello/scripts/build-toolchain-libraries.sh
This change enables basic support to build Morello ports of software libraries and to integrate them into the Morello rootfs.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com --- .gitignore | 2 ++ morello/scripts/build-all.sh | 15 +++++++++++- morello/scripts/build-busybox-docker.sh | 7 ++++++ morello/scripts/configure-libs.sh | 31 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100755 morello/scripts/configure-libs.sh
diff --git a/.gitignore b/.gitignore index ca3d77a..fb74567 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,10 @@ /morello/.gcc-toolchain /morello/.linux-env /morello/.busybox-env +/morello/.morello-linux-headers-env /morello/morello-docker/ /morello/linux-out/ /morello/bsp/ +/morello/libs-out/ /morello/projects/buildroot/ /morello/projects/musl-utils/ diff --git a/morello/scripts/build-all.sh b/morello/scripts/build-all.sh index 043ffce..487e77f 100755 --- a/morello/scripts/build-all.sh +++ b/morello/scripts/build-all.sh @@ -11,6 +11,8 @@ PRJ_BIN="${MORELLO_AARCH64_HOME}/bin" EXAMPLES_BIN="${MORELLO_AARCH64_HOME}/examples/bin" MUSL_BIN="${MORELLO_AARCH64_HOME}/musl-bin" GCC_HOME="${MORELLO_AARCH64_HOME}/gcc" +LIBS_HOME="${MORELLO_AARCH64_HOME}/projects/libs" +LIBS_OUTPUT="${MORELLO_AARCH64_HOME}/libs-out" COMPILER_RT_BIN="${MORELLO_AARCH64_HOME}/compiler_rt-bin" MORELLO_ROOTFS="${MORELLO_AARCH64_HOME}/morello-rootfs" MORELLO_TESTING="${MORELLO_ROOTFS}/testing" @@ -33,6 +35,8 @@ export PRJ_BIN export EXAMPLES_BIN export MUSL_BIN export GCC_HOME +export LIBS_HOME +export LIBS_OUTPUT export COMPILER_RT_BIN export MORELLO_ROOTFS export MORELLO_TESTING @@ -48,6 +52,7 @@ OPTIONS_KSELFTEST="off" OPTIONS_C_APPS="off" OPTIONS_ROOTFS="off" OPTIONS_DOCKER="off" +OPTIONS_LIBS="off" OPTIONS_TOOLCHAIN_LIB="off" OPTIONS_DEV_MODE="off" OPTIONS_ENV_INSTALL="off" @@ -60,6 +65,7 @@ export OPTIONS_KSELFTEST export OPTIONS_C_APPS export OPTIONS_ROOTFS export OPTIONS_DOCKER +export OPTIONS_LIBS export OPTIONS_TOOLCHAIN_LIB export OPTIONS_DEV_MODE export OPTIONS_ENV_INSTALL @@ -85,6 +91,7 @@ OPTIONS: --c-apps builds example c applications for Morello --rootfs builds the rootfs for Morello --docker generate a busybox based docker image + --libs builds software libraries for Morello --toolchain-lib builds toolchain libraries from source (e.g. compiler_rt, crtobjects...)
--clean cleans all the selected projects @@ -110,6 +117,7 @@ main () { --c-apps) OPTIONS_C_APPS="on" ;; --rootfs) OPTIONS_ROOTFS="on" ;; --docker) OPTIONS_DOCKER="on";; + --libs) OPTIONS_LIBS="on";; --toolchain-lib) OPTIONS_TOOLCHAIN_LIB="on";; --clean) OPTIONS_CLEAN="on";; --install) OPTIONS_INSTALL="on" ;; @@ -124,7 +132,7 @@ main () {
if [ "$OPTIONS_CLEAN" = "on" ]; then # Cleanup old files - rm -fr ${PRJ_BIN} ${BSP_HOME} + rm -fr ${PRJ_BIN} ${BSP_HOME} ${LIBS_OUTPUT} fi
echo "RootFS: ${MORELLO_ROOTFS}" @@ -167,6 +175,11 @@ main () { ${MORELLO_AARCH64_HOME}/scripts/build-kselftest.sh fi
+ if [ "$OPTIONS_LIBS" = "on" ]; then + # Build Libraries + ${MORELLO_AARCH64_HOME}/scripts/configure-libs.sh + fi + if [ "$OPTIONS_TOOLCHAIN_LIB" = "on" ]; then # Build Toolchain Libraries ${MORELLO_AARCH64_HOME}/scripts/build-toolchain-libraries.sh diff --git a/morello/scripts/build-busybox-docker.sh b/morello/scripts/build-busybox-docker.sh index 6c911a5..7ffa2c5 100755 --- a/morello/scripts/build-busybox-docker.sh +++ b/morello/scripts/build-busybox-docker.sh @@ -9,6 +9,7 @@ MORELLO_HEARTBEAT_PROCESS=${MORELLO_PROJECTS}/heartbeat MORELLO_EXAMPLES=${EXAMPLES_BIN} MORELLO_ROOTFS_BIN=${MORELLO_ROOTFS} MORELLO_ROOTFS_EXAMPLES=$MORELLO_ROOTFS_BIN/morello +MORELLO_ROOTFS_LIBS=${MORELLO_ROOTFS}/libs
MORELLO_BUILDROOT_URL="https://raw.githubusercontent.com/buildroot/buildroot/master"
@@ -198,6 +199,12 @@ if [ "$OPTIONS_KSELFTEST" = "on" ]; then cd ${MORELLO_PROJECTS} fi
+# Copy morello libs +if [ "$OPTIONS_LIBS" = "on" ]; then + mkdir -p ${MORELLO_ROOTFS_LIBS} + cp -Rf ${LIBS_OUTPUT}/* ${MORELLO_ROOTFS_LIBS} +fi + # Create Docker File mkdir -p $MORELLO_DOCKER cat > $MORELLO_DOCKER/Dockerfile << EOF diff --git a/morello/scripts/configure-libs.sh b/morello/scripts/configure-libs.sh new file mode 100755 index 0000000..063fbe7 --- /dev/null +++ b/morello/scripts/configure-libs.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# SPDX-License-Identifier: BSD-3-Clause + +source ./env/morello-pcuabi-env-versions + +CURR_DIR=$(pwd) + +submodule_update() { + echo "$1 updating progress..." + # Populate repositories + git submodule update --init --recursive --progress $1 + git submodule update --remote --checkout $1 +} + +submodule_update_projects() { + submodule_update projects/$1 + + cd projects/$1 + git checkout -b morello/master + cd ${CURR_DIR} +} + +PROJECTS_LIST=( morello-linux-headers ) + +for proj in "${PROJECTS_LIST[@]}"; do + if [ ! -f "${CURR_DIR}/.${proj}-env" ]; then + submodule_update_projects $i + touch "${CURR_DIR}/.${proj}-env" + fi +done
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
Add liburing submodule and scripts to build the Purecap liburing library and its testsuite.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com --- .gitignore | 1 + .gitmodules | 3 +++ morello/projects/libs/liburing | 1 + morello/scripts/build-all.sh | 1 + morello/scripts/build-liburing.sh | 33 +++++++++++++++++++++++++++++++ morello/scripts/configure-libs.sh | 2 +- 6 files changed, 40 insertions(+), 1 deletion(-) create mode 160000 morello/projects/libs/liburing create mode 100755 morello/scripts/build-liburing.sh
diff --git a/.gitignore b/.gitignore index 45f16f1..5e6d521 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /morello/.busybox-env /morello/.morello-linux-headers-env /morello/.libaio-env +/morello/.liburing-env /morello/morello-docker/ /morello/linux-out/ /morello/bsp/ diff --git a/.gitmodules b/.gitmodules index 4ce2789..22749bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "libaio"] path = morello/projects/libs/libaio url = /home/tudcre01/morello-next/libaio/purecap/ +[submodule "liburing"] + path = morello/projects/libs/liburing + url = /home/tudcre01/morello-next/liburing/purecap/ diff --git a/morello/projects/libs/liburing b/morello/projects/libs/liburing new file mode 160000 index 0000000..972f0fc --- /dev/null +++ b/morello/projects/libs/liburing @@ -0,0 +1 @@ +Subproject commit 972f0fcb35d1cf7dd14c02607ad5ac8378f92616 diff --git a/morello/scripts/build-all.sh b/morello/scripts/build-all.sh index 4d623c7..adc00ac 100755 --- a/morello/scripts/build-all.sh +++ b/morello/scripts/build-all.sh @@ -179,6 +179,7 @@ main () { # Build Libraries ${MORELLO_AARCH64_HOME}/scripts/configure-libs.sh ${MORELLO_AARCH64_HOME}/scripts/build-libaio.sh + ${MORELLO_AARCH64_HOME}/scripts/build-liburing.sh fi
if [ "$OPTIONS_TOOLCHAIN_LIB" = "on" ]; then diff --git a/morello/scripts/build-liburing.sh b/morello/scripts/build-liburing.sh new file mode 100755 index 0000000..0288fcd --- /dev/null +++ b/morello/scripts/build-liburing.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# SPDX-License-Identifier: BSD-3-Clause + +liburing_clean() { + make clean +} + +liburing_build() { + local _NCORES=$(nproc --all) + local CC=clang + local LIBURING_HOME="${LIBS_HOME}/liburing" + local LIBURING_OUTPUT="${LIBS_OUTPUT}/liburing" + 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 liburing for Morello, including testsuite + cd $LIBURING_HOME + + if [ "$OPTIONS_CLEAN" = "on" ]; then + liburing_clean + fi + + ./configure --cc="$CC $CFLAGS" --cxx=$CC + CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ENABLE_SHARED=0 make -j$_NCORES + CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ENABLE_SHARED=0 DESTDIR=$LIBURING_OUTPUT make install -j$_NCORES + CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" DESTDIR=$LIBURING_OUTPUT make install-tests -j$_NCORES +} + +liburing_build $@ diff --git a/morello/scripts/configure-libs.sh b/morello/scripts/configure-libs.sh index b164415..3d56cbd 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 libaio ) +PROJECTS_LIST=( morello-linux-headers libaio liburing )
for proj in "${PROJECTS_LIST[@]}"; do if [ ! -f "${CURR_DIR}/.${proj}-env" ]; then
linux-morello-distros@op-lists.linaro.org