Add recipe for the Morello busybox which is statically linked with musl libc. Packaging is disabled due to Morello LLVM not being a fully implemented toolchain.
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- recipes-core/busybox/busybox-morello-1.5.bb | 7 +++ recipes-core/busybox/busybox-morello.inc | 56 +++++++++++++++++++ ...-relative-path-to-the-LLVM-toolchain.patch | 49 ++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 recipes-core/busybox/busybox-morello-1.5.bb create mode 100644 recipes-core/busybox/busybox-morello.inc create mode 100644 recipes-core/busybox/files/0001-Adding-relative-path-to-the-LLVM-toolchain.patch
diff --git a/recipes-core/busybox/busybox-morello-1.5.bb b/recipes-core/busybox/busybox-morello-1.5.bb new file mode 100644 index 0000000..46411b6 --- /dev/null +++ b/recipes-core/busybox/busybox-morello-1.5.bb @@ -0,0 +1,7 @@ +require busybox-morello.inc + +LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb \ + file://archival/libarchive/bz/LICENSE;md5=28e3301eae987e8cfe19988e98383dae" + +SRCBRANCH = "morello/master" +SRCTAG = "morello-release-1.5.0" \ No newline at end of file diff --git a/recipes-core/busybox/busybox-morello.inc b/recipes-core/busybox/busybox-morello.inc new file mode 100644 index 0000000..6e5a2a1 --- /dev/null +++ b/recipes-core/busybox/busybox-morello.inc @@ -0,0 +1,56 @@ +inherit llvm-morello-native + +COMPATIBLE_MACHINE = "morello-linux" +SUMMARY = "CHERI enabled busybox" +LICENSE = "GPL-2.0-only" +SECTION = "base" + +FILESEXTRAPATHS:prepend := "${THISDIR}:${THISDIR}/${PN}:" + +DEPENDS += "virtual/kernel virtual/musl-morello" +PROVIDES += "virtual/morello-busybox" + +SRC_URI = " \ + git://git.morello-project.org/morello/morello-busybox;protocol=https;tag=${SRCTAG};branch=${SRCBRANCH} \ + file://files/0001-Adding-relative-path-to-the-LLVM-toolchain.patch \ + " + +PV = "git${SRCPV}" +S = "${WORKDIR}/git" + +do_package[noexec] = "1" +do_package_write_rpm[noexec] = "1" +do_packagedata[noexec] = "1" + +do_compile[depends] = "virtual/kernel:do_install" + +EXTRA_OEMAKE = "\ + ELF_PATCH='${ELF_PATCHER}' \ + MUSL_HOME='${STAGING_DIR_TARGET}${MUSL_INSTALL_DIR}${prefix}' \ + KHEADERS='${STAGING_KERNEL_BUILDDIR}/kernel-headers/include/' \ + " + +# lack of packaging hacks +FILES:${PN} += "${bindir}/busybox" +SYSROOT_DIRS += "/busybox" + +INHIBIT_SYSROOT_STRIP = "1" +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +do_configure() { + export CFLAGS="" + oe_runmake ${EXTRA_OEMAKE} LLVM_PATH=${LLVM_PATH} morello_busybox_defconfig +} + +do_compile() { + export CFLAGS="" + local resourcedir=$(${CC} -print-resource-dir) + EXTRA_OEMAKE="${EXTRA_OEMAKE} CLANG_RESOURCE_DIR='${resourcedir}'" + oe_runmake ${EXTRA_OEMAKE} LLVM_PATH=${LLVM_PATH} +} + +do_install() { + install -d ${D}/busybox + install -m 0755 ${S}/busybox ${D}/busybox/busybox +} \ No newline at end of file diff --git a/recipes-core/busybox/files/0001-Adding-relative-path-to-the-LLVM-toolchain.patch b/recipes-core/busybox/files/0001-Adding-relative-path-to-the-LLVM-toolchain.patch new file mode 100644 index 0000000..168efd3 --- /dev/null +++ b/recipes-core/busybox/files/0001-Adding-relative-path-to-the-LLVM-toolchain.patch @@ -0,0 +1,49 @@ +From 42b18c5a3d0f2ed93c9fe4ae3d2b3821d97d72f0 Mon Sep 17 00:00:00 2001 +From: Pawel Zalewski pzalewski@thegoodpenguin.co.uk +Date: Thu, 1 Dec 2022 11:04:12 +0000 +Subject: [PATCH] Add relative path to the LLVM toolchain + +--- + Makefile | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index f9d916f98..5e433677e 100644 +--- a/Makefile ++++ b/Makefile +@@ -145,7 +145,7 @@ MORELLO_FLAGS := -Wno-cheri-inefficient -march=morello+c64 + ELF_PATCH := morello_elf + MUSL_HOME := ../../musl-bin + KHEADERS := ../morello-linux-headers/usr/include/ +-CLANG_RESOURCE_DIR := $(shell clang -print-resource-dir) ++CLANG_RESOURCE_DIR := $(shell ${LLVM_PATH}/clang -print-resource-dir) + + export srctree objtree VPATH TOPDIR + +@@ -296,16 +296,16 @@ MAKEFLAGS += -rR + + # Make variables (CC, etc...) + +-AS = llvm-as +-CC_ = clang ++AS = ${LLVM_PATH}/llvm-as ++CC_ = ${LLVM_PATH}/clang + CC = $(CC_) --target=${MORELLO_TARGET} --sysroot ${MUSL_HOME} ${MORELLO_FLAGS} + LD = $(CC) -fuse-ld=lld -rtlib=compiler-rt + CPP = $(CC) -E +-AR = llvm-ar +-NM = llvm-nm +-STRIP = llvm-strip +-OBJCOPY = llvm-objcopy +-OBJDUMP = llvm-objdump ++AR = ${LLVM_PATH}/llvm-ar ++NM = ${LLVM_PATH}/llvm-nm ++STRIP = ${LLVM_PATH}/llvm-strip ++OBJCOPY = ${LLVM_PATH}/llvm-objcopy ++OBJDUMP = ${LLVM_PATH}/llvm-objdump + PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config + AWK = awk + GENKSYMS = scripts/genksyms/genksyms +-- +2.34.1 +