diff --git a/meta-arm/recipes-bsp/rmm/files/0001-CMakeLists-Add-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/rmm/files/0001-CMakeLists-Add-repositories-for-system-includes.patch new file mode 100644 index 00000000..a2f21370 --- /dev/null +++ b/meta-arm/recipes-bsp/rmm/files/0001-CMakeLists-Add-repositories-for-system-includes.patch @@ -0,0 +1,45 @@ +From e9e6d5ded4c3e53254438a73a79f04209035603e Mon Sep 17 00:00:00 2001 +From: Mathieu Poirier +Date: Mon, 4 Mar 2024 13:38:03 -0700 +Subject: [PATCH] CMakeLists: Add repositories for system includes + +Yocto's default aarch64 toolchain, i.e aarch64-poky-linux-, doesn't +include assert.h and stderr.h by default, leading to a compilation error +for files that need them. As such add the path of the base sysroot +directory to the list of directories to be included when compiling. + +Signed-off-by: Mathieu Poirier +--- + lib/arch/CMakeLists.txt | 1 + + lib/libc/CMakeLists.txt | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt +index 93c0ae76bb65..628f4c981051 100644 +--- a/lib/arch/CMakeLists.txt ++++ b/lib/arch/CMakeLists.txt +@@ -12,6 +12,7 @@ target_link_libraries(rmm-lib-arch + target_include_directories(rmm-lib-arch + PUBLIC "include" + "include/${RMM_ARCH}" ++ "../../../recipe-sysroot/usr/include/" + PRIVATE "src/${RMM_ARCH}" + "src/include") + +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt +index 1631332dbc72..94d559b7aae0 100644 +--- a/lib/libc/CMakeLists.txt ++++ b/lib/libc/CMakeLists.txt +@@ -12,7 +12,8 @@ if(NOT RMM_ARCH STREQUAL fake_host) + rmm-lib-debug) + + target_include_directories(rmm-lib-libc SYSTEM +- PUBLIC "include") ++ PUBLIC "include" ++ "../../../recipe-sysroot/usr/include/") + + target_sources(rmm-lib-libc + PRIVATE "src/abort.c" +-- +2.43.0 + diff --git a/meta-arm/recipes-bsp/rmm/rmm.inc b/meta-arm/recipes-bsp/rmm/rmm.inc new file mode 100644 index 00000000..0cdf62b4 --- /dev/null +++ b/meta-arm/recipes-bsp/rmm/rmm.inc @@ -0,0 +1,54 @@ +SUMMARY = "RMM Firmware" +DESCRIPTION = "RMM Firmware for Arm reference platforms" +LICENSE = "BSD-3-Clause & MIT" + +SRC_URI = "${SRC_URI_RMM};name=rmm;branch=${SRCBRANCH_rmm} \ + file://0001-CMakeLists-Add-repositories-for-system-includes.patch \ + " + +LIC_FILES_CHKSUM += "file://${WORKDIR}/git/docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b" + +inherit deploy + +DEPENDS += "cmake-native" + +RMM_CONFIG ?= "qemu_virt_defcfg" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" + +# Build for debug (set RMM_DEBUG to 1 to activate) +RMM_DEBUG ?= "0" +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}" + +# Handle RMM_DEBUG parameter +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}" +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}" + +export CROSS_COMPILE="${TARGET_PREFIX}" +export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}" + +do_configure[cleandirs] = "${B}" +do_configure() { + cmake -S ${S} -B ${B} ${EXTRA_OECMAKE} +} + +do_compile() { + cmake --build ${B} +} + +do_install() { + install -d -m 755 ${D}/firmware + install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/ +} + +FILES:${PN} = "/firmware" +SYSROOT_DIRS += "/firmware" + +do_deploy() { + cp -rf ${D}/firmware/* ${DEPLOYDIR}/ +} + +addtask deploy after do_install diff --git a/meta-arm/recipes-bsp/rmm/rmm_1.0.bb b/meta-arm/recipes-bsp/rmm/rmm_1.0.bb new file mode 100644 index 00000000..95a4f4a4 --- /dev/null +++ b/meta-arm/recipes-bsp/rmm/rmm_1.0.bb @@ -0,0 +1,5 @@ +SRC_URI_RMM ?= "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https" +SRCREV_rmm ?= "01a3cb75c6e6c50851d5d939d237966d110ed91d" +SRCBRANCH_rmm ?= "main" + +require recipes-bsp/rmm/rmm.inc