summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2025-02-07 16:30:16 -0700
committerMark Hatle <mark.hatle@amd.com>2025-03-30 14:16:15 -0600
commit11c5a5e811a5a9898de88e187a1973ef6d185a97 (patch)
treeaef48daec8aca92e4ca4a31109fd4c08e29efe55
parentd3511b5be3126ddd2604775be8fede071e255f8c (diff)
downloadmeta-xilinx-11c5a5e811a5a9898de88e187a1973ef6d185a97.tar.gz
meta-xilinx-core: xilinx-bootbin: copy bif and dependent items
Copy all dependent files into ${B} Construct the bif with relative paths in the ${B} (build) directory Deploy the resulting build to: boot.bin-extracted This is similar behavior to the SDT workflow's 'extracted' directory and will enable people to re-run bootgen, as necessary, outside of the build environmet. Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb49
1 files changed, 42 insertions, 7 deletions
diff --git a/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
index 50e43c32..36e5fa4e 100644
--- a/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
+++ b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
@@ -141,6 +141,8 @@ def create_versal_bif(config, attrflags, attrimage, ids, common_attr, biffd, d):
141 return 141 return
142 142
143python do_configure() { 143python do_configure() {
144 import shutil
145
144 fp = d.getVar("BIF_FILE_PATH") 146 fp = d.getVar("BIF_FILE_PATH")
145 if fp == (d.getVar('B') + '/bootgen.bif'): 147 if fp == (d.getVar('B') + '/bootgen.bif'):
146 biffd = open(fp, 'w') 148 biffd = open(fp, 'w')
@@ -149,8 +151,21 @@ python do_configure() {
149 151
150 for opt_data in (d.getVar("BIF_OPTIONAL_DATA") or "").split(';'): 152 for opt_data in (d.getVar("BIF_OPTIONAL_DATA") or "").split(';'):
151 if opt_data: 153 if opt_data:
152 biffd.write("\toptionaldata { %s }\n" % opt_data) 154 # Format per UG1283:
155 # optionaldata {<filename>, id=<id>}
156 try:
157 (fname, id) = opt_data.split(',')
158 fname = d.expand(fname)
159 except:
160 bb.error('BIF_OPTIONAL_DATA value "%s" not specified properly, expected: <filename>, id=<id>' % opt_data)
161
162 dest = os.path.join(d.getVar('B'), os.path.basename(fname))
163 print('Copy BIF_OPTIONALDATA element %s -> %s' % (fname, dest))
164 shutil.copyfile(fname, os.path.join(d.getVar('B'), os.path.basename(fname)))
165
166 biffd.write("\toptionaldata { %s, %s }\n" % (os.path.basename(fname), id))
153 167
168 # Common attributes are not allowed to point to files, the Partition attributes are used for that
154 arch = d.getVar("SOC_FAMILY") 169 arch = d.getVar("SOC_FAMILY")
155 bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split() 170 bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split()
156 if bifattr: 171 if bifattr:
@@ -162,17 +177,33 @@ python do_configure() {
162 else: 177 else:
163 create_bif(bifattr, attrflags,'','', 1, biffd, d) 178 create_bif(bifattr, attrflags,'','', 1, biffd, d)
164 179
180 # Partition Attributes are made up of Attribute and Image
181 # Image needs to be copied and filename sanitized
165 bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split() 182 bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split()
166 if bifpartition: 183 if bifpartition:
167 attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {} 184 attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {}
168 attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {} 185 attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {}
169 ids = d.getVarFlags("BIF_PARTITION_ID") or {} 186 ids = d.getVarFlags("BIF_PARTITION_ID") or {}
187
188 local_attrimage = {}
189 for part in bifpartition:
190 try:
191 fname = d.expand(attrimage[part])
192 except:
193 bb.error('BIF_PARTITION_ATTR[%s] not defined, but referenced in BIF_PARTITION_ATTR', part)
194
195 dest = os.path.join(d.getVar('B'), os.path.basename(fname))
196 print('Copy BIF_PARTITION_IMAGE[%s] %s -> %s' % (part, fname, dest))
197 shutil.copyfile(fname, os.path.join(d.getVar('B'), os.path.basename(fname)))
198
199 local_attrimage[part] = os.path.basename(fname)
200
170 if arch in ['zynq', 'zynqmp']: 201 if arch in ['zynq', 'zynqmp']:
171 create_zynq_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) 202 create_zynq_bif(bifpartition, attrflags, local_attrimage, ids, 0, biffd, d)
172 elif arch in ['versal', 'versal-net']: 203 elif arch in ['versal', 'versal-net']:
173 create_versal_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) 204 create_versal_bif(bifpartition, attrflags, local_attrimage, ids, 0, biffd, d)
174 else: 205 else:
175 create_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) 206 create_bif(bifpartition, attrflags, local_attrimage, ids, 0, biffd, d)
176 207
177 biffd.write("}") 208 biffd.write("}")
178 biffd.close() 209 biffd.close()
@@ -184,7 +215,6 @@ do_configure[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE BIF_COMMON_ATTR
184do_configure[vardeps] += "BIF_FSBL_ATTR BIF_BITSTREAM_ATTR BIF_ATF_ATTR BIF_DEVICETREE_ATTR BIF_SSBL_ATTR" 215do_configure[vardeps] += "BIF_FSBL_ATTR BIF_BITSTREAM_ATTR BIF_ATF_ATTR BIF_DEVICETREE_ATTR BIF_SSBL_ATTR"
185 216
186do_compile() { 217do_compile() {
187 cd ${WORKDIR}
188 rm -f ${B}/BOOT.bin 218 rm -f ${B}/BOOT.bin
189 if [ "${BIF_FILE_PATH}" != "${B}/bootgen.bif" ];then 219 if [ "${BIF_FILE_PATH}" != "${B}/bootgen.bif" ];then
190 BIF_FILE_PATH="${WORKDIR}${BIF_FILE_PATH}" 220 BIF_FILE_PATH="${WORKDIR}${BIF_FILE_PATH}"
@@ -216,13 +246,18 @@ inherit image-artifact-names
216 246
217QEMU_FLASH_IMAGE_NAME ?= "qemu-${QEMU_FLASH_TYPE}-${MACHINE}${IMAGE_VERSION_SUFFIX}" 247QEMU_FLASH_IMAGE_NAME ?= "qemu-${QEMU_FLASH_TYPE}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
218 248
249BOOTBIN_LINK_NAME ?= "BOOT-${MACHINE}"
219BOOTBIN_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}" 250BOOTBIN_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}"
220 251
221do_deploy() { 252do_deploy() {
222 install -d ${DEPLOYDIR} 253 install -d ${DEPLOYDIR}
223 install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}.bin 254 install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}.bin
224 ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/BOOT-${MACHINE}.bin 255 ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/${BOOTBIN_LINK_NAME}.bin
225 ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/boot.bin 256 ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/boot.bin
257
258 install -d ${DEPLOYDIR}/boot.bin-extracted
259 install -m 0644 ${B}/* ${DEPLOYDIR}/boot.bin-extracted/.
260 rm -f ${DEPLOYDIR}/boot.bin-extracted/BOOT.bin
226} 261}
227 262
228do_deploy:append:versal () { 263do_deploy:append:versal () {
@@ -235,12 +270,12 @@ do_deploy:append:versal () {
235} 270}
236 271
237do_deploy:append:versal-net () { 272do_deploy:append:versal-net () {
238
239 install -m 0644 ${B}/BOOT_bh.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}_bh.bin 273 install -m 0644 ${B}/BOOT_bh.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}_bh.bin
240 ln -sf ${BOOTBIN_BASE_NAME}_bh.bin ${DEPLOYDIR}/BOOT-${MACHINE}_bh.bin 274 ln -sf ${BOOTBIN_BASE_NAME}_bh.bin ${DEPLOYDIR}/BOOT-${MACHINE}_bh.bin
241 275
242 install -m 0644 ${B}/qemu-${QEMU_FLASH_TYPE}.bin ${DEPLOYDIR}/${QEMU_FLASH_IMAGE_NAME}.bin 276 install -m 0644 ${B}/qemu-${QEMU_FLASH_TYPE}.bin ${DEPLOYDIR}/${QEMU_FLASH_IMAGE_NAME}.bin
243 ln -sf ${QEMU_FLASH_IMAGE_NAME}.bin ${DEPLOYDIR}/qemu-${QEMU_FLASH_TYPE}-${MACHINE}.bin 277 ln -sf ${QEMU_FLASH_IMAGE_NAME}.bin ${DEPLOYDIR}/qemu-${QEMU_FLASH_TYPE}-${MACHINE}.bin
278
244} 279}
245 280
246FILES:${PN} += "/boot/BOOT.bin" 281FILES:${PN} += "/boot/BOOT.bin"