summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>2023-04-20 21:14:07 -0600
committerMark Hatle <mark.hatle@amd.com>2023-05-13 10:20:48 -0500
commit97c4f48bdf06c5a2e338c94a6d0e1de2171da79c (patch)
tree1e2dfda437f72be4621fa14b13596c5ac76ad685
parent676a26e2d775306219ca95600721111fae6bb16f (diff)
downloadmeta-xilinx-97c4f48bdf06c5a2e338c94a6d0e1de2171da79c.tar.gz
device-tree: Move dt implementation from meta-xilinx-tools
Move common dt implementation from meta-xilinx-tools to meta-xilinx-core layer. With this using extra dtsi and overlays feature can be used in both SDT and XSCT builds. Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb52
1 files changed, 52 insertions, 0 deletions
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 91a13fa1..fbc1797d 100644
--- a/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb
+++ b/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb
@@ -19,6 +19,17 @@ SYSTEM_DTFILE ??= ""
19CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" 19CONFIG_DTFILE ??= "${SYSTEM_DTFILE}"
20DT_FILES_PATH = "${@os.path.dirname(d.getVar('CONFIG_DTFILE')) if d.getVar('CONFIG_DTFILE') else d.getVar('S')}" 20DT_FILES_PATH = "${@os.path.dirname(d.getVar('CONFIG_DTFILE')) if d.getVar('CONFIG_DTFILE') else d.getVar('S')}"
21 21
22EXTRA_DT_FILES ?= ""
23EXTRA_DTFILE_PREFIX ?= "system-top"
24EXTRA_DTFILES_BUNDLE ?= ""
25UBOOT_DT_FILES ?= ""
26UBOOT_DTFILE_PREFIX ?= "system-top"
27UBOOT_DTFILES_BUNDLE ?= ""
28EXTRA_OVERLAYS ?= ""
29
30SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_DT_FILES') or "").split()])}"
31SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_OVERLAYS') or "").split()])}"
32
22COMPATIBLE_MACHINE:zynq = ".*" 33COMPATIBLE_MACHINE:zynq = ".*"
23COMPATIBLE_MACHINE:zynqmp = ".*" 34COMPATIBLE_MACHINE:zynqmp = ".*"
24COMPATIBLE_MACHINE:versal = ".*" 35COMPATIBLE_MACHINE:versal = ".*"
@@ -34,6 +45,47 @@ DTB_FILE_NAME = "${@os.path.basename(d.getVar('CONFIG_DTFILE')).replace('.dts',
34 45
35DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}" 46DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}"
36 47
48do_configure:append () {
49 for f in ${EXTRA_DT_FILES}; do
50 cp ${WORKDIR}/${f} ${DT_FILES_PATH}/
51 done
52
53 for f in ${EXTRA_OVERLAYS}; do
54 cp ${WORKDIR}/${f} ${DT_FILES_PATH}/
55 echo "/include/ \"$f\"" >> ${DT_FILES_PATH}/${BASE_DTS}.dts
56 done
57}
58
59devicetree_do_compile:append() {
60 import subprocess
61
62 dtb_file = d.getVar('DTB_FILE_NAME') or ''
63 if not dtb_file or not os.path.isfile(dtb_file):
64 return
65
66 if d.getVar('EXTRA_DTFILES_BUNDLE'):
67 ccdtb_prefix = d.getVar('EXTRA_DTFILE_PREFIX')
68 extra_dt_files = d.getVar('EXTRA_DT_FILES').split() or []
69
70 for dtsfile in extra_dt_files:
71 dtname = os.path.splitext(os.path.basename(dtsfile))[0]
72 if os.path.isfile(f"{dtname}.dtbo"):
73 fdtargs = ["fdtoverlay", "-o", f"{ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"]
74 bb.note("Running {0}".format(" ".join(fdtargs)))
75 subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
76
77 if d.getVar('UBOOT_DTFILES_BUNDLE'):
78 uboot_ccdtb_prefix = d.getVar('UBOOT_DTFILE_PREFIX')
79 uboot_dt_files = d.getVar('UBOOT_DT_FILES').split() or []
80
81 for dtsfile in uboot_dt_files:
82 dtname = os.path.splitext(os.path.basename(dtsfile))[0]
83 if os.path.isfile(f"{dtname}.dtbo"):
84 fdtargs = ["fdtoverlay", "-o", f"{uboot_ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"]
85 bb.note("Running {0}".format(" ".join(fdtargs)))
86 subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
87}
88
37FILES:${PN} += "/boot/system.dtb" 89FILES:${PN} += "/boot/system.dtb"
38devicetree_do_install:append() { 90devicetree_do_install:append() {
39 if [ -n "${DTB_FILE_NAME}" ]; then 91 if [ -n "${DTB_FILE_NAME}" ]; then