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