1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
DESCRIPTION = "Device Tree generation and packaging for BSP Device Trees using DTG from Xilinx"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://xadcps/data/xadcps.mdd;md5=d2baf2c4690cd90d3c2c2efabfde5fd4"
require recipes-bsp/device-tree/device-tree.inc
inherit xsctdt xsctyaml
BASE_DTS ?= "system-top"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
S = "${WORKDIR}/git"
B = "${WORKDIR}/${BPN}-build"
DT_VERSION_EXTENSION ?= "xilinx-${XILINX_RELEASE_VERSION}"
PV = "${DT_VERSION_EXTENSION}+git${SRCPV}"
XSCTH_BUILD_CONFIG = ""
YAML_COMPILER_FLAGS ?= ""
XSCTH_APP = "device-tree"
XSCTH_MISC = " -hdf_type ${HDF_EXT}"
EXTRA_DT_FILES ?= ""
EXTRA_DTFILE_PREFIX ?= "system-top"
EXTRA_DTFILES_BUNDLE ?= ""
UBOOT_DT_FILES ?= ""
UBOOT_DTFILE_PREFIX ?= "system-top"
UBOOT_DTFILES_BUNDLE ?= ""
EXTRA_OVERLAYS ?= ""
DT_FILES_PATH = "${XSCTH_WS}/${XSCTH_PROJ}"
DT_RELEASE_VERSION ?= "${XILINX_XSCT_VERSION}"
DT_INCLUDE:append = " ${WORKDIR} ${S}/device_tree/data/kernel_dtsi/${DT_RELEASE_VERSION}/BOARD/"
DT_PADDING_SIZE = "0x1000"
DTC_FLAGS:append = "${@['', ' -@'][d.getVar('YAML_ENABLE_DT_OVERLAY') == '1']}"
COMPATIBLE_MACHINE:zynq = ".*"
COMPATIBLE_MACHINE:zynqmp = ".*"
COMPATIBLE_MACHINE:microblaze = ".*"
COMPATIBLE_MACHINE:versal = ".*"
SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_DT_FILES') or "").split()])}"
SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_OVERLAYS') or "").split()])}"
do_configure[cleandirs] += "${DT_FILES_PATH} ${B}"
do_deploy[cleandirs] += "${DEPLOYDIR}"
do_configure:append () {
for f in ${EXTRA_DT_FILES}; do
cp ${WORKDIR}/${f} ${DT_FILES_PATH}/
done
for f in ${EXTRA_OVERLAYS}; do
cp ${WORKDIR}/${f} ${DT_FILES_PATH}/
echo "/include/ \"$f\"" >> ${DT_FILES_PATH}/${BASE_DTS}.dts
done
}
devicetree_do_compile:append() {
import subprocess
dtb_file = d.getVar('DTB_FILE_NAME') or ''
if not dtb_file or not os.path.isfile(dtb_file):
return
if d.getVar('EXTRA_DTFILES_BUNDLE'):
ccdtb_prefix = d.getVar('EXTRA_DTFILE_PREFIX')
extra_dt_files = d.getVar('EXTRA_DT_FILES').split() or []
for dtsfile in extra_dt_files:
dtname = os.path.splitext(os.path.basename(dtsfile))[0]
if os.path.isfile(f"{dtname}.dtbo"):
fdtargs = ["fdtoverlay", "-o", f"{ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"]
bb.note("Running {0}".format(" ".join(fdtargs)))
subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if d.getVar('UBOOT_DTFILES_BUNDLE'):
uboot_ccdtb_prefix = d.getVar('UBOOT_DTFILE_PREFIX')
uboot_dt_files = d.getVar('UBOOT_DT_FILES').split() or []
for dtsfile in uboot_dt_files:
dtname = os.path.splitext(os.path.basename(dtsfile))[0]
if os.path.isfile(f"{dtname}.dtbo"):
fdtargs = ["fdtoverlay", "-o", f"{uboot_ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"]
bb.note("Running {0}".format(" ".join(fdtargs)))
subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
}
do_compile:prepend() {
listpath = d.getVar("DT_FILES_PATH")
try:
os.remove(os.path.join(listpath, "system.dts"))
except OSError:
pass
}
do_install:append:microblaze () {
for DTB_FILE in `ls *.dtb`; do
dtc -I dtb -O dts -o ${D}/boot/devicetree/mb.dts ${B}/${DTB_FILE}
done
}
DTB_FILE_NAME = "${BASE_DTS}.dtb"
FILES:${PN}:append:microblaze = " /boot/devicetree/*.dts"
EXTERNALSRC_SYMLINKS = ""
# This will generate the DTB, no need to check
def check_devicetree_variables(d):
return
|