summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/classes')
-rw-r--r--meta-xilinx-core/classes/dfx_user_dts.bbclass267
-rw-r--r--meta-xilinx-core/classes/fpgamanager_custom.bbclass197
2 files changed, 289 insertions, 175 deletions
diff --git a/meta-xilinx-core/classes/dfx_user_dts.bbclass b/meta-xilinx-core/classes/dfx_user_dts.bbclass
new file mode 100644
index 00000000..4404aa05
--- /dev/null
+++ b/meta-xilinx-core/classes/dfx_user_dts.bbclass
@@ -0,0 +1,267 @@
1# This bbclass is inherited by flat, DFx Static and DFx RP firmware recipes.
2# dfx_user_dts.bbclass expects user to generate pl dtsi for flat, DFx Static
3# and DFx RP xsa outside of yocto.
4
5inherit devicetree
6
7DEPENDS = "dtc-native bootgen-native"
8
9# recipes that inherit from this class need to use an appropriate machine
10# override for COMPATIBLE_MACHINE to build successfully; don't allow building
11# for microblaze MACHINE
12COMPATIBLE_MACHINE ?= "^$"
13COMPATIBLE_MACHINE:microblaze = "^$"
14
15PACKAGE_ARCH = "${MACHINE_ARCH}"
16
17PROVIDES = ""
18
19do_fetch[cleandirs] = "${B}"
20
21DT_PADDING_SIZE = "0x1000"
22BOOTGEN_FLAGS ?= " -arch ${SOC_FAMILY} -w ${@bb.utils.contains('SOC_FAMILY','zynqmp','','-process_bitstream bin',d)}"
23
24S ?= "${WORKDIR}"
25FW_DIR ?= ""
26DTSI_PATH ?= ""
27DTBO_PATH ?= ""
28DT_FILES_PATH = "${S}/${DTSI_PATH}"
29FIRMWARE_NAME_DT_FILE ?= ""
30USER_DTS_FILE ?= ""
31
32FIRMWARE_NAME_DT_FILE[doc] = "DT file which has firmware-name device-tree property"
33USER_DTS_FILE[doc] = "Final DTSI or DTS file which is used for packaging final DT overlay"
34
35python() {
36 import re
37 soc_family = d.getVar("SOC_FAMILY")
38 if "git://" in d.getVar("SRC_URI") or "https://" in d.getVar("SRC_URI"):
39 d.setVar("S",'${WORKDIR}/git/'+d.getVar("FW_DIR"))
40 else:
41 dtsi_found = False
42 dtbo_found = False
43 bit_found = False
44 bin_found = False
45 pdi_found = False
46
47 # Required Inputs
48 if '.dtsi' in d.getVar("SRC_URI") or '.dts' in d.getVar("SRC_URI"):
49 dtsi_found = True
50 d.setVar("DTSI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtsi' in a or '.dts' in a][0].lstrip('file://')))
51
52 if '.dtbo' in d.getVar("SRC_URI"):
53 dtbo_found = True
54 d.setVar("DTBO_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtbo' in a][0].lstrip('file://')))
55
56 if '.bit' in d.getVar("SRC_URI") and soc_family != "versal":
57 bit_found = True
58 d.setVar("BIT_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.bit' in a][0].lstrip('file://')))
59
60 if '.bin' in d.getVar("SRC_URI") and soc_family != "versal":
61 bin_found = True
62 d.setVar("BIT_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.bin' in a][0].lstrip('file://')))
63
64 if '.pdi' in d.getVar("SRC_URI") and soc_family == "versal":
65 pdi_found = True
66 d.setVar("PDI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.pdi' in a][0].lstrip('file://')))
67
68 # Check for valid combination of input files in SRC_URI
69 if dtsi_found or dtbo_found:
70 bb.debug(2, "dtsi or dtbo found in SRC_URI")
71 if bit_found or pdi_found or bin_found:
72 bb.debug(2, "bitstream or pdi found in SRC_URI")
73 elif bit_found and bin_found:
74 raise bb.parse.SkipRecipe("Both '.bit' and '.bin' file found in SRC_URI, either .bit or .bin file is supported but not both.")
75 else:
76 raise bb.parse.SkipRecipe("Need one '.bit' or one '.pdi' file added to SRC_URI ")
77 else:
78 raise bb.parse.SkipRecipe("Need one '.dtsi' or one '.dtbo' file added to SRC_URI ")
79
80 # Check for valid combination of dtsi and dts files in SRC_URI
81 # Following file combinations are not supported use case.
82 # 1. More than one '.dtsi' and zero '.dts' file.
83 # 2. More than one '.dts' and zero or more than one '.dtsi'file .
84 pattern_dts = re.compile(r'[.]+dts\b')
85 pattern_dtsi = re.compile(r'[.]+dtsi\b')
86 dts_count = len([*re.finditer(pattern_dts, d.getVar('SRC_URI'))])
87 dtsi_count = len([*re.finditer(pattern_dtsi, d.getVar("SRC_URI"))])
88
89 if dtsi_count > 1 and dts_count == 0:
90 raise bb.parse.SkipRecipe("Recipe has more than one '.dtsi' and zero '.dts' found, this is an unsupported use case")
91 elif dts_count > 1:
92 raise bb.parse.SkipRecipe("Recipe has more than one '.dts' and zero or more than one '.dtsi' found, this is an unsupported use case")
93
94 # Optional input
95 if '.json' in d.getVar("SRC_URI"):
96 d.setVar("JSON_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.json' in a][0].lstrip('file://')))
97
98 if '.xclbin' in d.getVar("SRC_URI"):
99 d.setVar("XCL_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.xclbin' in a][0].lstrip('file://')))
100}
101
102# Function to get dts or dtsi file count.
103def get_dt_count(d, dt_ext):
104 import glob
105 dt_count = sum(1 for f in glob.iglob((d.getVar('S') + (d.getVar('DTSI_PATH')) + '/*.' + dt_ext),recursive=True) if os.path.isfile(f))
106 return dt_count
107
108# Function to search for dt firmware-name property in dts or dtsi file.
109python find_firmware_file() {
110 import glob
111 pattern_fw = 'firmware-name'
112 search_count = 0
113 for dt_files in glob.iglob((d.getVar('S') + (d.getVar('DTSI_PATH')) + '/*.dts*'),recursive=True):
114 with open(dt_files, "r") as f:
115 current_fd = f.read()
116 if pattern_fw in current_fd:
117 search_count += 1
118 if search_count > 1:
119 bb.error("firmware-name dt property found in more than one dt files! Please fix the dts or dtsi file.")
120 break
121 else:
122 d.setVar('FIRMWARE_NAME_DT_FILE', os.path.basename(dt_files))
123}
124
125do_configure[prefuncs] += "find_firmware_file"
126
127python do_configure() {
128 import glob, re, shutil
129 soc_family = d.getVar("SOC_FAMILY")
130
131 if bb.utils.contains('MACHINE_FEATURES', 'fpga-overlay', False, True, d):
132 bb.warn("Using fpga-manager.bbclass requires fpga-overlay MACHINE_FEATURE to be enabled")
133
134 # Renaming firmware-name using $PN as bitstream/PDI will be renamed using
135 # $PN when generating the bin/pdi file.
136 if os.path.isfile(d.getVar('S') + (d.getVar('DTSI_PATH') or '') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE')):
137 orig_dtsi = glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE'))[0]
138 new_dtsi = d.getVar('S') + '/pl.dtsi_firmwarename'
139 with open(new_dtsi, 'w') as newdtsi:
140 with open(orig_dtsi) as olddtsi:
141 for line in olddtsi:
142 if soc_family == 'versal':
143 newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.pdi\"',line))
144 else:
145 newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.bit.bin\"',line))
146 shutil.move(new_dtsi,orig_dtsi)
147}
148
149do_compile[prefuncs] += "find_firmware_file"
150
151python devicetree_do_compile:append() {
152 import glob, subprocess, shutil
153 soc_family = d.getVar("SOC_FAMILY")
154
155 dtbo_count = sum(1 for f in glob.iglob((d.getVar('S') + '/*.dtbo'),recursive=True) if os.path.isfile(f))
156
157 # Skip devicetree do_compile task if input file is dtbo in SRC_URI
158 if not dtbo_count:
159 # Convert .bit to bit.bin format only if dtsi is input.
160 # In case of dtbo as input, bbclass doesn't know if firmware-name is .bit or
161 # .bit.bin format and corresponding file name. Hence we are not doing
162 # bit.bin conversion.
163 if soc_family != 'versal' and glob.glob(d.getVar('S') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE')):
164 pn = d.getVar('PN')
165 biffile = pn + '.bif'
166
167 with open(biffile, 'w') as f:
168 f.write('all:\n{\n\t' + glob.glob(d.getVar('S')+(d.getVar('BIT_PATH') or '') + '/*.bit')[0] + '\n}')
169
170 bootgenargs = ["bootgen"] + (d.getVar("BOOTGEN_FLAGS") or "").split()
171 bootgenargs += ["-image", biffile, "-o", pn + ".bit.bin"]
172 subprocess.run(bootgenargs, check = True)
173
174 # In Zynq7k using both "-process_bitstream bin" and "-o" in bootgen flag,
175 # to convert bit file to bin format, "-o" option will not be effective
176 # and generated output file name is ${S}+${BIT_PATH}/<bit_file_name>.bit.bin
177 # file, Hence we need to rename this file from <bit_file_name>.bit.bin to
178 # ${PN}.bit.bin which matches the firmware name in dtbo and move
179 # ${PN}.bit.bin to ${B} directory.
180 if soc_family == 'zynq':
181 src_bitbin_file = glob.glob(d.getVar('S') + (d.getVar('BIT_PATH') or '') + '/*.bit.bin')[0]
182 dst_bitbin_file = d.getVar('B') + '/' + pn + '.bit.bin'
183 shutil.move(src_bitbin_file, dst_bitbin_file)
184
185 if not os.path.isfile(pn + ".bit.bin"):
186 bb.fatal("Couldn't find %s file, Enable '-log trace' in BOOTGEN_FLAGS" \
187 "and check bootgen_log.txt" % (d.getVar('B') + '/' + pn + '.bit.bin'))
188}
189
190# If user inputs both dtsi and dts files then device-tree will generate dtbo
191# files for each dt file, Hence to package the firmware pick the right user dt
192# overlay file.
193python find_user_dts_overlay_file() {
194 import glob
195 dtbo_count = sum(1 for f in glob.iglob((d.getVar('S') + '/*.dtbo'),recursive=True) if os.path.isfile(f))
196 # Skip if input file is dtbo in SRC_URI
197 if not dtbo_count:
198 dts_count = get_dt_count(d, 'dts')
199 dtsi_count = get_dt_count(d, 'dtsi')
200 if dtsi_count == 1 and dts_count == 0:
201 dts_file =glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/*.dtsi')[0]
202 elif dtsi_count >=0 and dts_count == 1:
203 dts_file = glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/*.dts')[0]
204
205 d.setVar('USER_DTS_FILE', os.path.splitext(os.path.basename(dts_file))[0])
206}
207
208do_install[prefuncs] += "find_user_dts_overlay_file"
209
210do_install() {
211 install -d ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
212
213 # In case of dtbo as input, dtbo will be copied from directly from ${S}
214 # In case of dtsi as input, dtbo will be copied from directly from ${B}
215 if [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then
216 install -Dm 0644 ${S}/*.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
217 elif [ `ls ${S}/*.dtbo | wc -l` -gt 1 ]; then
218 bbfatal "Multiple DTBO found, use the right DTBO in SRC_URI from the following:\n$(basename -a ${S}/*.dtbo)"
219 elif [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then
220 install -Dm 0644 ${B}/${USER_DTS_FILE}.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.dtbo
221 else
222 bbfatal "A dtbo ending '.dtbo' expected but not found"
223 fi
224
225 if [ "${SOC_FAMILY}" == "versal" ]; then
226 # In case of dtbo as input, pdi will be copied from directly from ${S}
227 # without renaming the pdi name to ${PN}.pdi
228 if [ `ls ${S}/*.pdi | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then
229 install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
230 elif [ `ls ${S}/*.pdi | wc -l` -gt 1 ]; then
231 bbfatal "Multiple PDI found, use the right PDI in SRC_URI from the following:\n$(basename -a ${S}/*.pdi)"
232 elif [ `ls ${S}/*.pdi | wc -l` -eq 1 ] && [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then
233 install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.pdi
234 else
235 bbfatal "A PDI file with '.pdi' expected but not found"
236 fi
237 else
238 # In case of dtbo as input, .bit or .bin will be copied from directly
239 # from ${S} without renaming the .bit/.bin name to ${PN}.bit/${PN}.bin
240 # if more than one .bit/.bin file is found then fail the task.
241 if [ `ls ${S}/*.bit | wc -l` -gt 1 ]; then
242 bbfatal "Multiple .bit found, use the right .bit in SRC_URI from the following:\n$(basename -a ${S}/*.bit)"
243 elif [ `ls ${S}/*.bin | wc -l` -gt 1 ]; then
244 bbfatal "Multiple .bin found, use the right .bin in SRC_URI from the following:\n$(basename -a ${S}/*.bin)"
245 elif [ `ls ${S}/*.bit | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then
246 install -Dm 0644 ${S}/*.bit ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
247 elif [ `ls ${S}/*.bin | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then
248 install -Dm 0644 ${S}/*.bin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
249 elif [ -f ${B}/${PN}.bit.bin ] && [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then
250 install -Dm 0644 ${B}/${PN}.bit.bin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.bit.bin
251 else
252 bbfatal "A bitstream file with '.bit' or '.bin' expected but not found"
253 fi
254 fi
255
256 if ls ${S}/${XCL_PATH}/*.xclbin >/dev/null 2>&1; then
257 install -Dm 0644 ${S}/${XCL_PATH}/*.xclbin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.xclbin
258 fi
259
260 if [ -f ${S}/${JSON_PATH}/shell.json ] || [ -f ${S}/${JSON_PATH}/accel.json ]; then
261 install -Dm 0644 ${S}/${JSON_PATH}/*.json ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
262 fi
263}
264
265do_deploy[noexec] = "1"
266
267FILES:${PN} += "${nonarch_base_libdir}/firmware/xilinx/${PN}"
diff --git a/meta-xilinx-core/classes/fpgamanager_custom.bbclass b/meta-xilinx-core/classes/fpgamanager_custom.bbclass
index e5255783..8c8997a1 100644
--- a/meta-xilinx-core/classes/fpgamanager_custom.bbclass
+++ b/meta-xilinx-core/classes/fpgamanager_custom.bbclass
@@ -1,177 +1,24 @@
1# This bbclass is inherited by flat, DFx Static and DFx RP firmware recipes. 1# This class inherits dfx_user_dts.bbclass for below use cases.
2# fpgamanager_custom.bbclass expects user to generate pl dtsi for flat, DFx Static 2# Zynq-7000 and ZynqMP: Full bitstream loading.
3# and DFx RP xsa outside of yocto. 3# ZynqMP: DFx Static and Partial bitstream loading.
4 4# Versal: DFx Static and Parial pdi loading.
5inherit devicetree 5# Versal: Full PDI loading.
6 6
7DEPENDS = "dtc-native bootgen-native" 7inherit dfx_user_dts
8 8
9# recipes that inherit from this class need to use an appropriate machine 9python fpgamanager_warn_msg () {
10# override for COMPATIBLE_MACHINE to build successfully; don't allow building 10 if not d.getVar("FPGAMANAGER_NO_WARN"):
11# for microblaze MACHINE 11 arch = d.getVar('SOC_FAMILY')
12COMPATIBLE_MACHINE ?= "^$" 12 pn = d.getVar('PN')
13COMPATIBLE_MACHINE:microblaze = "^$" 13 warn_msg = 'Users should start using dfx_user_dts bbclass for '
14 14 if arch == 'zynq':
15PACKAGE_ARCH = "${MACHINE_ARCH}" 15 warn_msg += 'Zynq-7000 Full bitstream loading use case.'
16 16 elif arch == 'zynqmp':
17PROVIDES = "" 17 warn_msg += 'ZynqMP Full or DFx Static or DFx Partial bitstream loading use case.'
18 18 elif arch == 'versal':
19do_fetch[cleandirs] = "${B}" 19 warn_msg += 'Versal DFx Static or DFx Partial or Full PDI loading use case.'
20 20
21DT_PADDING_SIZE = "0x1000" 21 bb.warn("Recipe %s has inherited fpgamanager_custom bbclass which will be deprecated in 2024.1 release. \n%s" % (pn, warn_msg))
22BOOTGEN_FLAGS ?= " -arch ${SOC_FAMILY} -w ${@bb.utils.contains('SOC_FAMILY','zynqmp','','-process_bitstream bin',d)}"
23
24S ?= "${WORKDIR}"
25FW_DIR ?= ""
26DTSI_PATH ?= ""
27DTBO_PATH ?= ""
28DT_FILES_PATH = "${S}/${DTSI_PATH}"
29
30python() {
31 soc_family = d.getVar("SOC_FAMILY")
32 if "git://" in d.getVar("SRC_URI") or "https://" in d.getVar("SRC_URI"):
33 d.setVar("S",'${WORKDIR}/git/'+d.getVar("FW_DIR"))
34 else:
35 dtsi_found = False
36 dtbo_found = False
37 bit_found = False
38 pdi_found = False
39
40 # Required Inputs
41 if '.dtsi' in d.getVar("SRC_URI"):
42 dtsi_found = True
43 d.setVar("DTSI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtsi' in a][0].lstrip('file://')))
44
45 if '.dtbo' in d.getVar("SRC_URI"):
46 dtbo_found = True
47 d.setVar("DTBO_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtbo' in a][0].lstrip('file://')))
48
49 if '.bit' in d.getVar("SRC_URI") and soc_family != "versal":
50 bit_found = True
51 d.setVar("BIT_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.bit' in a][0].lstrip('file://')))
52
53 if '.pdi' in d.getVar("SRC_URI") and soc_family == "versal":
54 pdi_found = True
55 d.setVar("PDI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.pdi' in a][0].lstrip('file://')))
56
57 # Check for valid combination of input files in SRC_URI
58 if dtsi_found or dtbo_found:
59 bb.debug(2, "dtsi or dtbo found in SRC_URI")
60 if bit_found or pdi_found:
61 bb.debug(2, "bitstream or pdi found in SRC_URI")
62 else:
63 raise bb.parse.SkipRecipe("Need one '.bit' or one '.pdi' file added to SRC_URI ")
64 else:
65 raise bb.parse.SkipRecipe("Need one '.dtsi' or one '.dtbo' file added to SRC_URI ")
66
67 # Optional input
68 if '.json' in d.getVar("SRC_URI"):
69 d.setVar("JSON_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.json' in a][0].lstrip('file://')))
70
71 if '.xclbin' in d.getVar("SRC_URI"):
72 d.setVar("XCL_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.xclbin' in a][0].lstrip('file://')))
73} 22}
74python do_configure() {
75 import glob, re, shutil
76 soc_family = d.getVar("SOC_FAMILY")
77
78 if bb.utils.contains('MACHINE_FEATURES', 'fpga-overlay', False, True, d):
79 bb.warn("Using fpga-manager.bbclass requires fpga-overlay MACHINE_FEATURE to be enabled")
80
81 # Renaming firmware-name using $PN as bitstream/PDI will be renamed using
82 # $PN when generating the bin/pdi file.
83 if '.dtsi' in d.getVar("SRC_URI"):
84 orig_dtsi = glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/*.dtsi')[0]
85 new_dtsi = d.getVar('S') + '/pl.dtsi_firmwarename'
86 with open(new_dtsi, 'w') as newdtsi:
87 with open(orig_dtsi) as olddtsi:
88 for line in olddtsi:
89 if soc_family == 'versal':
90 newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.pdi\"',line))
91 else:
92 newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.bit.bin\"',line))
93 shutil.move(new_dtsi,orig_dtsi)
94}
95
96python devicetree_do_compile:append() {
97 import glob, subprocess, shutil
98 soc_family = d.getVar("SOC_FAMILY")
99
100 # Convert .bit to bit.bin format only if dtsi is input.
101 # In case of dtbo as input, bbclass doesn't know if firmware-name is .bit or
102 # .bit.bin format and corresponding file name. Hence we are not doing
103 # bit.bin conversion.
104 if soc_family != 'versal' and glob.glob(d.getVar('S') + '/*.dtsi'):
105 pn = d.getVar('PN')
106 biffile = pn + '.bif'
107
108 with open(biffile, 'w') as f:
109 f.write('all:\n{\n\t' + glob.glob(d.getVar('S')+(d.getVar('BIT_PATH') or '') + '/*.bit')[0] + '\n}')
110
111 bootgenargs = ["bootgen"] + (d.getVar("BOOTGEN_FLAGS") or "").split()
112 bootgenargs += ["-image", biffile, "-o", pn + ".bit.bin"]
113 subprocess.run(bootgenargs, check = True)
114
115 # In Zynq7k using both "-process_bitstream bin" and "-o" in bootgen flag,
116 # to convert bit file to bin format, "-o" option will not be effective
117 # and generated output file name is ${S}+${BIT_PATH}/<bit_file_name>.bit.bin
118 # file, Hence we need to rename this file from <bit_file_name>.bit.bin to
119 # ${PN}.bit.bin which matches the firmware name in dtbo and move
120 # ${PN}.bit.bin to ${B} directory.
121 if soc_family == 'zynq':
122 src_bitbin_file = glob.glob(d.getVar('S') + (d.getVar('BIT_PATH') or '') + '/*.bit.bin')[0]
123 dst_bitbin_file = d.getVar('B') + '/' + pn + '.bit.bin'
124 shutil.move(src_bitbin_file, dst_bitbin_file)
125
126 if not os.path.isfile(pn + ".bit.bin"):
127 bb.fatal("Couldn't find %s file, Enable '-log trace' in BOOTGEN_FLAGS" \
128 "and check bootgen_log.txt" % (d.getVar('B') + '/' + pn + '.bit.bin'))
129}
130
131do_install() {
132 install -d ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
133
134 # In case of dtbo as input, dtbo will be copied from directly from ${S}
135 # In case of dtsi as input, dtbo will be copied from directly from ${B}
136 if [ -f ${S}/*.dtbo ]; then
137 install -Dm 0644 ${S}/*.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
138 elif [ -f ${B}/*.dtbo ]; then
139 install -Dm 0644 ${B}/*.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.dtbo
140 else
141 bbfatal "A dtbo ending '.dtbo' expected but not found"
142 fi
143
144 if [ "${SOC_FAMILY}" == "versal" ]; then
145 # In case of dtbo as input, pdi will be copied from directly from ${S}
146 # without renaming the pdi name to ${PN}.pdi
147 if [ -f ${S}/*.pdi ] && [ -f ${S}/*.dtbo ]; then
148 install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
149 elif [ -f ${S}/*.pdi ] && [ -f ${B}/*.dtbo ]; then
150 install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.pdi
151 else
152 bbfatal "A PDI file with '.pdi' expected but not found"
153 fi
154 else
155 # In case of dtbo as input, .bit or .bit.in will be copied from directly
156 # from ${S} without renaming the .bit name to ${PN}.bit.bin
157 if [ -f ${S}/*.bit* ] && [ -f ${S}/*.dtbo ]; then
158 install -Dm 0644 ${S}/*.bit* ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
159 elif [ -f ${B}/${PN}.bit.bin ] && [ -f ${B}/*.dtbo ]; then
160 install -Dm 0644 ${B}/${PN}.bit.bin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.bit.bin
161 else
162 bbfatal "A bitstream file with '.bit' or '.bit.bin' expected but not found"
163 fi
164 fi
165
166 if ls ${S}/${XCL_PATH}/*.xclbin >/dev/null 2>&1; then
167 install -Dm 0644 ${S}/${XCL_PATH}/*.xclbin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.xclbin
168 fi
169
170 if [ -f ${S}/${JSON_PATH}/shell.json ] || [ -f ${S}/${JSON_PATH}/accel.json ]; then
171 install -Dm 0644 ${S}/${JSON_PATH}/*.json ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/
172 fi
173}
174
175do_deploy[noexec] = "1"
176 23
177FILES:${PN} += "${nonarch_base_libdir}/firmware/xilinx/${PN}" 24do_install[postfuncs] += "fpgamanager_warn_msg" \ No newline at end of file