This two-step recipe takes the board firmware repo and overwrites its contents with the outputs obtained from the firmware recipes. SD card image is then created using mtools.
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- conf/machine/morello-bsp.conf | 1 + .../board-firmware/board-firmware-image.bb | 82 +++++++++++++++++++ .../board-firmware/board-firmware_1.4.bb | 29 +++++++ 3 files changed, 112 insertions(+) create mode 100644 recipes-bsp/board-firmware/board-firmware-image.bb create mode 100644 recipes-bsp/board-firmware/board-firmware_1.4.bb
diff --git a/conf/machine/morello-bsp.conf b/conf/machine/morello-bsp.conf index 9998fff..a83698e 100644 --- a/conf/machine/morello-bsp.conf +++ b/conf/machine/morello-bsp.conf @@ -2,5 +2,6 @@ require conf/machine/include/morello-common.inc
PREFERRED_VERSION_scp-firmware ?= "2.10%" PREFERRED_VERSION_trusted-firmware-a ?= "2.7%" +PREFERRED_VERSION_board-firmware = "1.4"
TMPDIR = "${TOPDIR}/${TMPDIR_BSP}" \ No newline at end of file diff --git a/recipes-bsp/board-firmware/board-firmware-image.bb b/recipes-bsp/board-firmware/board-firmware-image.bb new file mode 100644 index 0000000..7fd6709 --- /dev/null +++ b/recipes-bsp/board-firmware/board-firmware-image.bb @@ -0,0 +1,82 @@ +inherit deploy nopackages + +COMPATIBLE_MACHINE = "morello" +SUMMARY = "SDK Card Firmware Image " +DESCRIPTION = "Image containing all the firmwares and motherboard configuration files" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +OUTPUTS_NAME = "board-firmware-sd-image" +SECTION = "firmware" + +BB_DONT_CACHE = "1" + +DEPENDS += "virtual/board-firmware virtual/scp-firmware virtual/trusted-firmware-a virtual/uefi virtual/grub-efi mtools-native" +PROVIDES = "virtual/board-firmware-image" + +MCP_BLOB_ID = "54464222-a4cf-4bf8-b1b6-cee7dade539e" + +FIP_OPTIONS = "\ + --tb-fw '${FIRMWARE_PATH}/tf-bl2.bin' \ + --soc-fw '${FIRMWARE_PATH}/tf-bl31.bin' \ + --nt-fw '${FIRMWARE_PATH}/uefi.bin' \ + --fw-config '${FIRMWARE_PATH}/morello_fw_config.dtb' \ + --tb-fw-config '${FIRMWARE_PATH}/morello_tb_fw_config.dtb' \ + --nt-fw-config '${FIRMWARE_PATH}/morello_nt_fw_config.dtb' \ + --trusted-key-cert '${FIRMWARE_PATH}/tfa_certs/trusted_key.crt' \ + --soc-fw-key-cert '${FIRMWARE_PATH}/tfa_certs/bl31_key.crt' \ + --nt-fw-key-cert '${FIRMWARE_PATH}/tfa_certs/bl33_key.crt' \ + --soc-fw-cert '${FIRMWARE_PATH}/tfa_certs/bl31.crt' \ + --nt-fw-cert '${FIRMWARE_PATH}/tfa_certs/bl33.crt' \ + --tb-fw-cert '${FIRMWARE_PATH}/tfa_certs/bl2.crt' \ + " + +FIRMWARE_PATH = "${RECIPE_SYSROOT}/firmware" +SYSROOT_SOFTWARE_PATH = "${RECIPE_SYSROOT}/board-firmware/SOFTWARE" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" +do_install[depends] += "virtual/board-firmware:do_populate_sysroot" +do_install[depends] += "virtual/scp-firmware:do_populate_sysroot" +do_install[depends] += "virtual/uefi:do_populate_sysroot" +do_install[depends] += "virtual/trusted-firmware-a:do_populate_sysroot" + +do_install:prepend() { + + ${FIRMWARE_PATH}/fiptool create \ + --scp-fw "${FIRMWARE_PATH}/scp_ramfw_soc.bin" \ + "${FIRMWARE_PATH}/scp_fw.bin" + + ${FIRMWARE_PATH}/fiptool create \ + --blob uuid="${MCP_BLOB_ID}",file="${FIRMWARE_PATH}/mcp_ramfw_soc.bin" \ + "${FIRMWARE_PATH}/mcp_fw.bin" + + mkdir -p "${FIRMWARE_PATH}/tfa_certs" + ${FIRMWARE_PATH}/cert_create ${FIP_OPTIONS} -n --tfw-nvctr 0 --ntfw-nvctr 0 \ + --rot-key ${FIRMWARE_PATH}/arm_rotprivk_rsa.pem + + ${FIRMWARE_PATH}/fiptool update ${FIP_OPTIONS} "${FIRMWARE_PATH}/fip.bin" +} + +do_install() { + + cp -rf ${FIRMWARE_PATH}/fip.bin ${SYSROOT_SOFTWARE_PATH}/fip.bin + cp -rf ${FIRMWARE_PATH}/scp_fw.bin ${SYSROOT_SOFTWARE_PATH}/scp_fw.bin + cp -rf ${FIRMWARE_PATH}/mcp_fw.bin ${SYSROOT_SOFTWARE_PATH}/mcp_fw.bin + + install -d ${D}/board-firmware/SOFTWARE + install -m 644 ${SYSROOT_SOFTWARE_PATH}/fip.bin ${D}/board-firmware/SOFTWARE/fip.bin + install -m 644 ${SYSROOT_SOFTWARE_PATH}/scp_fw.bin ${D}/board-firmware/SOFTWARE/scp_fw.bin + install -m 644 ${SYSROOT_SOFTWARE_PATH}/mcp_fw.bin ${D}/board-firmware/SOFTWARE/mcp_fw.bin + + dd if=/dev/zero of=${OUTPUTS_NAME}.img bs=512K count=100 + mformat -i ${OUTPUTS_NAME}.img :: + mcopy -i ${OUTPUTS_NAME}.img -s -Q -p -m ${RECIPE_SYSROOT}/board-firmware/* :: + + install -d ${D}/firmware/board-firmware-image + install -m 644 ${OUTPUTS_NAME}.img ${D}/firmware/board-firmware-image/${OUTPUTS_NAME}.img +} + +do_deploy() { + cp -rf ${D}/firmware/board-firmware-image/${OUTPUTS_NAME}.img ${DEPLOYDIR}/${OUTPUTS_NAME}.img +} +addtask deploy after do_install \ No newline at end of file diff --git a/recipes-bsp/board-firmware/board-firmware_1.4.bb b/recipes-bsp/board-firmware/board-firmware_1.4.bb new file mode 100644 index 0000000..80719a4 --- /dev/null +++ b/recipes-bsp/board-firmware/board-firmware_1.4.bb @@ -0,0 +1,29 @@ +inherit nopackages + +COMPATIBLE_MACHINE = "morello" +SUMMARY = "$DESCRIPTION" +DESCRIPTION = "The SD card image from ARM that contains non compile-able binaries." +HOMEPAGE = "https://git.morello-project.org/morello/board-firmware" +LICENSE = "STMicroelectronics&BSD-3 & BDS-2" +OUTPUTS_NAME = "board-firmware" +SECTION = "firmware" + +PROVIDES += "virtual/${OUTPUTS_NAME}" + +SRC_URI = "git://git.morello-project.org/morello/board-firmware;protocol=https;branch=${SRCBRANCH}" +SRCREV = "20e3e673f13e854109a069dd719f49e06336142d" + +SRCBRANCH = "morello/release-1.4" +LIC_FILES_CHKSUM = "file://LICENSES/MB/STM.TXT;md5=47185091e44d729bf62ed5c99d7eb9d9 \ + file://LICENSES/LIB/sensor.txt;md5=7ba201f1f1e4959d3505d9c59c6cfdfa \ + " + +S = "${WORKDIR}/git" +FILES:${PN} += "/${OUTPUTS_NAME}" +FILES:${PN}-staticdev += "/${OUTPUTS_NAME}/LIB/sensor.a" +SYSROOT_DIRS += "/${OUTPUTS_NAME}" + +do_install() { + install -d "${D}/${OUTPUTS_NAME}" + cp -rf ${S}/* "${D}/${OUTPUTS_NAME}/" +} \ No newline at end of file