diff options
| author | Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> | 2023-04-20 21:14:07 -0600 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@amd.com> | 2023-05-13 10:20:48 -0500 |
| commit | 97c4f48bdf06c5a2e338c94a6d0e1de2171da79c (patch) | |
| tree | 1e2dfda437f72be4621fa14b13596c5ac76ad685 /meta-xilinx-core | |
| parent | 676a26e2d775306219ca95600721111fae6bb16f (diff) | |
| download | meta-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>
Diffstat (limited to 'meta-xilinx-core')
| -rw-r--r-- | meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb | 52 |
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 ??= "" | |||
| 19 | CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" | 19 | CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" |
| 20 | DT_FILES_PATH = "${@os.path.dirname(d.getVar('CONFIG_DTFILE')) if d.getVar('CONFIG_DTFILE') else d.getVar('S')}" | 20 | DT_FILES_PATH = "${@os.path.dirname(d.getVar('CONFIG_DTFILE')) if d.getVar('CONFIG_DTFILE') else d.getVar('S')}" |
| 21 | 21 | ||
| 22 | EXTRA_DT_FILES ?= "" | ||
| 23 | EXTRA_DTFILE_PREFIX ?= "system-top" | ||
| 24 | EXTRA_DTFILES_BUNDLE ?= "" | ||
| 25 | UBOOT_DT_FILES ?= "" | ||
| 26 | UBOOT_DTFILE_PREFIX ?= "system-top" | ||
| 27 | UBOOT_DTFILES_BUNDLE ?= "" | ||
| 28 | EXTRA_OVERLAYS ?= "" | ||
| 29 | |||
| 30 | SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_DT_FILES') or "").split()])}" | ||
| 31 | SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_OVERLAYS') or "").split()])}" | ||
| 32 | |||
| 22 | COMPATIBLE_MACHINE:zynq = ".*" | 33 | COMPATIBLE_MACHINE:zynq = ".*" |
| 23 | COMPATIBLE_MACHINE:zynqmp = ".*" | 34 | COMPATIBLE_MACHINE:zynqmp = ".*" |
| 24 | COMPATIBLE_MACHINE:versal = ".*" | 35 | COMPATIBLE_MACHINE:versal = ".*" |
| @@ -34,6 +45,47 @@ DTB_FILE_NAME = "${@os.path.basename(d.getVar('CONFIG_DTFILE')).replace('.dts', | |||
| 34 | 45 | ||
| 35 | DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}" | 46 | DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}" |
| 36 | 47 | ||
| 48 | do_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 | |||
| 59 | devicetree_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 | |||
| 37 | FILES:${PN} += "/boot/system.dtb" | 89 | FILES:${PN} += "/boot/system.dtb" |
| 38 | devicetree_do_install:append() { | 90 | devicetree_do_install:append() { |
| 39 | if [ -n "${DTB_FILE_NAME}" ]; then | 91 | if [ -n "${DTB_FILE_NAME}" ]; then |
