From 7a2d6ff06fa18d561522b14a937d20b2265067c1 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 23 Aug 2023 16:34:03 +0200 Subject: u-boot-toradex: split into a release/pinned and latest head recipe This reduces confusion about the current solution on what version gets built with use-head-next. This drops using the `use-head-next` override in favour of having two recipes. Which recipe is to be built will then be set in the various files. To reduce code duplication split out common code into a inc file and further split out i.MX and TI specific stuff into two specific inc files. Related-to: ELB-5357 Signed-off-by: Max Krummenacher --- recipes-bsp/u-boot/binman-ti.inc | 43 ---------------- recipes-bsp/u-boot/u-boot-toradex-common.inc | 18 +++++++ recipes-bsp/u-boot/u-boot-toradex-imx.inc | 47 ++++++++++++++++++ recipes-bsp/u-boot/u-boot-toradex-ti.inc | 43 ++++++++++++++++ recipes-bsp/u-boot/u-boot-toradex_2022.07.bb | 70 +-------------------------- recipes-bsp/u-boot/u-boot-toradex_mainline.bb | 13 +++++ 6 files changed, 123 insertions(+), 111 deletions(-) delete mode 100644 recipes-bsp/u-boot/binman-ti.inc create mode 100644 recipes-bsp/u-boot/u-boot-toradex-common.inc create mode 100644 recipes-bsp/u-boot/u-boot-toradex-imx.inc create mode 100644 recipes-bsp/u-boot/u-boot-toradex-ti.inc create mode 100644 recipes-bsp/u-boot/u-boot-toradex_mainline.bb diff --git a/recipes-bsp/u-boot/binman-ti.inc b/recipes-bsp/u-boot/binman-ti.inc deleted file mode 100644 index 1d9b110..0000000 --- a/recipes-bsp/u-boot/binman-ti.inc +++ /dev/null @@ -1,43 +0,0 @@ -# SYSFW/TIFS Firmware -DEPENDS:append:k3 = " python3-jsonschema-native python3-pyelftools-native python3-pyyaml-native optee-os ti-sci-fw ti-dm-fw trusted-firmware-a" -DEPENDS:append:k3r5 = " python3-jsonschema-native python3-pyelftools-native python3-pyyaml-native ti-sci-fw ti-dm-fw" -BL31 = "${STAGING_DIR_HOST}/firmware/bl31.bin" -TEE = "${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/bl32.bin" -BINMAN_INDIRS = "${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware" -EXTRA_OEMAKE:append:k3 = " BL31=${BL31} TEE=${TEE} BINMAN_INDIRS=${BINMAN_INDIRS}" -EXTRA_OEMAKE:append:k3r5 = " BINMAN_INDIRS=${BINMAN_INDIRS}" - -do_deploy:append:k3r5 () { - if [ -n "${UBOOT_CONFIG}" ] - then - for config in ${UBOOT_MACHINE}; do - if [ x${config} = "xverdin-am62_r5_usbdfu_defconfig" ] - then - TARGETSUFFIX="-dfu" - else - TARGETSUFFIX="" - fi - i=$(expr $i + 1); - for type in ${UBOOT_CONFIG}; do - j=$(expr $j + 1); - if [ $j -eq $i ] - then - for f in ${B}/${config}/tiboot3-*.bin; do - if [ -f "$f" ]; then - TARGET=$(basename $f)${TARGETSUFFIX} - install -m 644 $f ${DEPLOYDIR}/${TARGET} - fi - done - - for f in ${B}/${config}/sysfw*.itb; do - if [ -f "$f" ]; then - install -m 644 $f ${DEPLOYDIR}/ - fi - done - fi - done - unset j - done - unset i - fi -} diff --git a/recipes-bsp/u-boot/u-boot-toradex-common.inc b/recipes-bsp/u-boot/u-boot-toradex-common.inc new file mode 100644 index 0000000..a98d679 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex-common.inc @@ -0,0 +1,18 @@ +require recipes-bsp/u-boot/u-boot-common.inc +require recipes-bsp/u-boot/u-boot.inc +SOC_HANDLING = "" +SOC_HANDLING:imx = "recipes-bsp/u-boot/u-boot-toradex-imx.inc" +SOC_HANDLING:ti-soc = "recipes-bsp/u-boot/u-boot-toradex-ti.inc" +require ${SOC_HANDLING} + +LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1" +DEPENDS += "bc-native dtc-native" + +SRC_URI = " \ + git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master \ + ${TDX_PATCHES} \ +" + +inherit toradex-u-boot-localversion + +UBOOT_INITIAL_ENV = "u-boot-initial-env" diff --git a/recipes-bsp/u-boot/u-boot-toradex-imx.inc b/recipes-bsp/u-boot/u-boot-toradex-imx.inc new file mode 100644 index 0000000..1c01bcf --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex-imx.inc @@ -0,0 +1,47 @@ +PADDING_DIR = "${B}" +nand_padding () { + # pad the end of U-Boot with 0x00 up to the end of the CSF area + #PAD_END=$(echo -n "0x"; od -X -j 0x24 -N 4 u-boot.imx | sed -e '/................/!d' -e 's/........\(.*\)/\1/') + #PAD_END=$(( $PAD_END - 0x400 )) + #objcopy -I binary -O binary --pad-to $PAD_END u-boot.imx u-boot.imx.zero-padded + # assume that the above never needs more than 10k of padding and skip the + # shell magic to get a correct size. + dd bs=10k count=1 if=/dev/zero | cat ${PADDING_DIR}/u-boot.imx - > ${PADDING_DIR}/u-boot.imx.zero-padded + + # U-Boot is flashed 1k into a NAND block, create a binary which prepends + # U-boot with 1k of zeros to ease flashing + dd bs=1024 count=1 if=/dev/zero | cat - ${PADDING_DIR}/u-boot.imx.zero-padded > ${PADDING_DIR}/u-boot-nand.imx +} + +# build imx-boot from within U-Boot +inherit ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '1', 'imx-boot-container', '')} + +do_compile:append:colibri-imx6ull () { + nand_padding +} + +do_compile:append:colibri-imx7 () { + nand_padding +} + +BOOT_TOOLS = "imx-boot-tools" +do_deploy:append:mx8m-generic-bsp() { + # Deploy u-boot-nodtb.bin and fsl-imx8m*-XX.dtb for mkimage to generate boot binary + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -d ${DEPLOYDIR}/${BOOT_TOOLS} + install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS} + install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${type} + fi + done + unset j + done + unset i + fi +} diff --git a/recipes-bsp/u-boot/u-boot-toradex-ti.inc b/recipes-bsp/u-boot/u-boot-toradex-ti.inc new file mode 100644 index 0000000..1d9b110 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex-ti.inc @@ -0,0 +1,43 @@ +# SYSFW/TIFS Firmware +DEPENDS:append:k3 = " python3-jsonschema-native python3-pyelftools-native python3-pyyaml-native optee-os ti-sci-fw ti-dm-fw trusted-firmware-a" +DEPENDS:append:k3r5 = " python3-jsonschema-native python3-pyelftools-native python3-pyyaml-native ti-sci-fw ti-dm-fw" +BL31 = "${STAGING_DIR_HOST}/firmware/bl31.bin" +TEE = "${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware/bl32.bin" +BINMAN_INDIRS = "${STAGING_DIR_HOST}${nonarch_base_libdir}/firmware" +EXTRA_OEMAKE:append:k3 = " BL31=${BL31} TEE=${TEE} BINMAN_INDIRS=${BINMAN_INDIRS}" +EXTRA_OEMAKE:append:k3r5 = " BINMAN_INDIRS=${BINMAN_INDIRS}" + +do_deploy:append:k3r5 () { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + if [ x${config} = "xverdin-am62_r5_usbdfu_defconfig" ] + then + TARGETSUFFIX="-dfu" + else + TARGETSUFFIX="" + fi + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + for f in ${B}/${config}/tiboot3-*.bin; do + if [ -f "$f" ]; then + TARGET=$(basename $f)${TARGETSUFFIX} + install -m 644 $f ${DEPLOYDIR}/${TARGET} + fi + done + + for f in ${B}/${config}/sysfw*.itb; do + if [ -f "$f" ]; then + install -m 644 $f ${DEPLOYDIR}/ + fi + done + fi + done + unset j + done + unset i + fi +} diff --git a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb index ffbd838..82eda2d 100644 --- a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb +++ b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb @@ -1,17 +1,8 @@ -require recipes-bsp/u-boot/u-boot-common.inc -require recipes-bsp/u-boot/u-boot.inc -BINMAN_HANDLING = "" -BINMAN_HANDLING:ti-soc = "recipes-bsp/u-boot/binman-ti.inc" -require ${BINMAN_HANDLING} - -LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1" -DEPENDS += "bc-native dtc-native" +require u-boot-toradex-common.inc # hash of release v2022.07" -PV = "2022.07" SRCREV = "e092e3250270a1016c877da7bdd9384f14b1321e" -SRCREV:use-head-next = "${AUTOREV}" -# patches which are not (yet) in the used stable version +# patches which are not in the used stable version TDX_PATCHES = " \ file://0001-toradex-tdx-cfg-block-use-only-snprintf.patch \ file://0002-toradex-tdx-cfg-block-use-defines-for-string-length.patch \ @@ -31,60 +22,3 @@ TDX_PATCHES = " \ file://0001-configs-colibri-imx7-Fix-bad-block-table-in-flash-co.patch \ file://0001-colibri_imx6-fix-RALAT-and-WALAT-values.patch \ " -# patches which are not (yet) in the latest master -TDX_PATCHES:use-head-next = " \ -" -SRC_URI = "git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master" -SRC_URI:append = " ${TDX_PATCHES}" - -inherit toradex-u-boot-localversion - -UBOOT_INITIAL_ENV = "u-boot-initial-env" - -PADDING_DIR = "${B}" -nand_padding () { - # pad the end of U-Boot with 0x00 up to the the end of the CSF area - #PAD_END=$(echo -n "0x"; od -X -j 0x24 -N 4 u-boot.imx | sed -e '/................/!d' -e 's/........\(.*\)/\1/') - #PAD_END=$(( $PAD_END - 0x400 )) - #objcopy -I binary -O binary --pad-to $PAD_END u-boot.imx u-boot.imx.zero-padded - # assume that the above never need more than 10k of padding and skip the - # shell magic to get a correct size. - dd bs=10k count=1 if=/dev/zero | cat ${PADDING_DIR}/u-boot.imx - > ${PADDING_DIR}/u-boot.imx.zero-padded - - # U-Boot is flashed 1k into a NAND block, create a binary which prepends - # U-boot with 1k of zeros to ease flashing - dd bs=1024 count=1 if=/dev/zero | cat - ${PADDING_DIR}/u-boot.imx.zero-padded > ${PADDING_DIR}/u-boot-nand.imx -} - -# build imx-boot from within U-Boot -inherit ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '1', 'imx-boot-container', '')} - -do_compile:append:colibri-imx6ull () { - nand_padding -} - -do_compile:append:colibri-imx7 () { - nand_padding -} - -BOOT_TOOLS = "imx-boot-tools" -do_deploy:append:mx8m-generic-bsp() { - # Deploy u-boot-nodtb.bin and fsl-imx8m*-XX.dtb for mkimage to generate boot binary - if [ -n "${UBOOT_CONFIG}" ] - then - for config in ${UBOOT_MACHINE}; do - i=$(expr $i + 1); - for type in ${UBOOT_CONFIG}; do - j=$(expr $j + 1); - if [ $j -eq $i ] - then - install -d ${DEPLOYDIR}/${BOOT_TOOLS} - install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS} - install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${type} - fi - done - unset j - done - unset i - fi -} diff --git a/recipes-bsp/u-boot/u-boot-toradex_mainline.bb b/recipes-bsp/u-boot/u-boot-toradex_mainline.bb new file mode 100644 index 0000000..1624697 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex_mainline.bb @@ -0,0 +1,13 @@ +# This builds latest head of U-Boot denx master +# Do not use this recipe for production, it is not reproducible +# and you don't know what git hash is built from just looking +# at the metadata + +require u-boot-toradex-common.inc + +SRCREV = "${AUTOREV}" +# patches which are not (yet) in the latest master +TDX_PATCHES = " \ +" + +DEFAULT_PREFERENCE = "-1" -- cgit v1.2.3