From 2c4e691200c816037a5760fe9749b28cca06c023 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Fri, 21 Jan 2022 12:41:42 -0800 Subject: device-tree: Merge experimental and standard flows We need a method for regular building to specify a device tree. Since the experimental flow already contained this, merge it in and connect to the existing SYSTEM_DTFILE as a fall back. Also enable addition 'early package failure' messages to alert the user as soon as possible they need to pass in additional information. Signed-off-by: Mark Hatle --- .../recipes-bsp/device-tree/device-tree.bb | 44 ++++++++++++++++++++-- .../recipes-bsp/device-tree/device-tree.bbappend | 15 -------- 2 files changed, 40 insertions(+), 19 deletions(-) delete mode 100644 meta-xilinx-standalone-experimental/recipes-bsp/device-tree/device-tree.bbappend diff --git a/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb b/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb index 626a9cb1..9bc81c41 100644 --- a/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb +++ b/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb @@ -12,11 +12,18 @@ LIC_FILES_CHKSUM = " \ inherit devicetree image-artifact-names #this way of going through SRC_URI is better but if dts is including other dtsis, need to add all of them to SRC_URI.. -#SRC_URI += "file://${SYSTEM_DTFILE}" -#DT_FILES_PATH = "${@d.getVar('WORKDIR')+'/'+os.path.dirname(d.getVar('SYSTEM_DTFILE'))}" +#SRC_URI += "file://${CONFIG_DTFILE}" +#DT_FILES_PATH = "${@d.getVar('WORKDIR')+'/'+os.path.dirname(d.getVar('CONFIG_DTFILE'))}" -DT_FILES_PATH = "${@os.path.dirname(d.getVar('SYSTEM_DTFILE')) if d.getVar('SYSTEM_DTFILE') else d.getVar('S')}" +# Fall back to SYSTEM_DTFILE if specified... +# CONFIG_DTFILE is intended to hold a specific configuration's (multiconfig) +# device tree, while SYSTEM_DTFILE is used for the full heterogenous +# system. +SYSTEM_DTFILE ??= "" +CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" +DT_FILES_PATH = "${@os.path.dirname(d.getVar('CONFIG_DTFILE')) if d.getVar('CONFIG_DTFILE') else d.getVar('S')}" +COMPATIBLE_MACHINE:zynq = ".*" COMPATIBLE_MACHINE:zynqmp = ".*" COMPATIBLE_MACHINE:versal = ".*" @@ -27,10 +34,21 @@ PROVIDES = "virtual/dtb" # common zynq include SRC_URI:append:zynq = " file://zynq-7000-qspi-dummy.dtsi" -DTB_FILE_NAME = "${@os.path.basename(d.getVar('SYSTEM_DTFILE')).replace('.dts', '.dtb') if d.getVar('SYSTEM_DTFILE') else ''}" +DTB_FILE_NAME = "${@os.path.basename(d.getVar('CONFIG_DTFILE')).replace('.dts', '.dtb') if d.getVar('CONFIG_DTFILE') else ''}" + DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}" +do_install:prepend() { + for DTB_FILE in ${CONFIG_DTFILE}; do + install -Dm 0644 ${DTB_FILE} ${D}/boot/devicetree/$(basename ${DTB_FILE}) + done +} + devicetree_do_deploy:append() { + for DTB_FILE in ${CONFIG_DTFILE}; do + install -Dm 0644 ${DTB_FILE} ${DEPLOYDIR}/devicetree/$(basename ${DTB_FILE}) + done + if [ -n "${DTB_FILE_NAME}" ]; then if [ -e "${DEPLOYDIR}/devicetree/${DTB_FILE_NAME}" ]; then # We need the output to be system.dtb for WIC setup to match XSCT flow @@ -42,3 +60,21 @@ devicetree_do_deploy:append() { fi fi } + +def check_devicetree_variables(d): + if not d.getVar('CONFIG_DTFILE'): + d.setVar('BB_DONT_CACHE', '1') + raise bb.parse.SkipRecipe("CONFIG_DTFILE or SYSTEM_DTFILE is not defined.") + else: + if not os.path.exists(d.getVar('CONFIG_DTFILE')): + d.setVar('BB_DONT_CACHE', '1') + raise bb.parse.SkipRecipe("The device tree %s is not available." % d.getVar('CONFIG_DTFILE')) + else: + d.appendVar('SRC_URI', ' file://${CONFIG_DTFILE}') + d.setVarFlag('do_install', 'file-checksums', '${CONFIG_DTFILE}:True') + d.setVarFlag('do_deploy', 'file-checksums', '${CONFIG_DTFILE}:True') + +python() { + # Need to allow bbappends to change the check + check_devicetree_variables(d) +} diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/device-tree/device-tree.bbappend deleted file mode 100644 index c36ba70b..00000000 --- a/meta-xilinx-standalone-experimental/recipes-bsp/device-tree/device-tree.bbappend +++ /dev/null @@ -1,15 +0,0 @@ -CONFIG_DTFILE ?= "" - -do_install:prepend() { - for DTB_FILE in ${CONFIG_DTFILE}; do - install -Dm 0644 ${DTB_FILE} ${D}/boot/devicetree/$(basename ${DTB_FILE}) - done -} - -# This needs to run BEFORE the device tree version, otherwise it can error with -# Expected filename ${DTB_FILE_NAME} doesn't exist in ${DEPLOYDIR}/devicetree -devicetree_do_deploy:prepend() { - for DTB_FILE in ${CONFIG_DTFILE}; do - install -Dm 0644 ${DTB_FILE} ${DEPLOYDIR}/devicetree/$(basename ${DTB_FILE}) - done -} -- cgit v1.2.3-54-g00ecf