From fff0756d6e86bebaa57878a2c6ff0f505c4fc950 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Tue, 16 Dec 2025 16:23:07 +0000 Subject: [PATCH] arm/classes-recipe: Introduce firmware.bbclass There are now a handful of firmware component recipes in meta-arm, each of which does its own (slightly different) deployment handling. Introduce a bbclass to standardize this, with the aim of cleaning up the DEPLOY_DIR_IMAGE. Crucially, each firmware component deploys into a ${PN} subdirectory of DEPLOY_DIR_IMAGE. This has a few advantages: * Many Arm components have the same or similar binary names (BL1, BL2 etc). This ensures unique naming and avoids confusion. * Recipes can afford to be less picky about which binaries are deployed. This simplifies component recipes. * It is easier to deploy debug symbols in a common way to an expected location. * It keeps the DEPLOY_DIR_IMAGE clean in the face of ever-increasing firmware complexity. The bbclass also provides a FIRMWARE_DEBUG_BUILD variable to control the build type of the firmware in one place, defaulting to the global DEBUG_BUILD. This should allow BSPs in meta-arm-bsp to more easily provide a release build by default (by providing an easy switch for development purposes when needed). Signed-off-by: Peter Hoyes Signed-off-by: Jon Mason --- meta-arm/classes-recipe/firmware.bbclass | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 meta-arm/classes-recipe/firmware.bbclass diff --git a/meta-arm/classes-recipe/firmware.bbclass b/meta-arm/classes-recipe/firmware.bbclass new file mode 100644 index 00000000..575f2cf0 --- /dev/null +++ b/meta-arm/classes-recipe/firmware.bbclass @@ -0,0 +1,27 @@ +# Common configuration for Arm firmware components + +# Firmware packages are always machine-specific +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Allow all firmware to be debugged together +FIRMWARE_DEBUG_BUILD ?= "${@oe.utils.vartrue('DEBUG_BUILD', '1', '0', d)}" + +# Use ${MACHINE} as the default platform name for firmware +FIRMWARE_PLATFORM ?= "${MACHINE}" + +# Provide a standard folder layout for firmware packages +FIRMWARE_BASE_DIR ?= "/firmware" +FIRMWARE_DIR ?= "${FIRMWARE_BASE_DIR}/${PN}" +FILES:${PN} = "${FIRMWARE_DIR}/*.bin" +FILES:${PN}-dbg = "${FIRMWARE_DIR}/*.elf" +SYSROOT_DIRS += "${FIRMWARE_DIR}" + +# Provide a default deploy implementation, which deploys to a subdirectory +# of ${DEPLOY_DIR_IMAGE} +inherit deploy + +do_deploy() { + install -d ${DEPLOYDIR}/${PN} + cp -rf ${D}${FIRMWARE_DIR}/* ${DEPLOYDIR}/${PN} +} +addtask deploy after do_install