Signed-off-by: Chris Laplante <[email protected]>
---
 recipes-bsp/bootbin/xilinx-bootbin_1.0.bb | 35 +++++++++++------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb 
b/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
index 2401f5f..939136c 100644
--- a/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
+++ b/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb
@@ -114,24 +114,23 @@ python do_configure() {
     if fp == (d.getVar('B') + '/bootgen.bif'):
         arch = d.getVar("SOC_FAMILY")
         biffunc = {'versal':create_versal_bif, 'zynq':create_bif, 
'zynqmp':create_bif}
-        biffd = open(fp, 'w')
-        biffd.write("the_ROM_image:\n")
-        biffd.write("{\n")
-
-        bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split()
-        if bifattr:
-            attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {}
-            biffunc[arch](bifattr, attrflags,'','', 1, biffd, d)
-
-        bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split()
-        if bifpartition:
-            attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {}
-            attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {}
-            ids = d.getVarFlags("BIF_PARTITION_ID") or {}
-            biffunc[arch](bifpartition, attrflags, attrimage, ids, 0, biffd, d)
-
-        biffd.write("}")
-        biffd.close()
+        with open(fp, 'w') as biffd:
+            biffd.write("the_ROM_image:\n")
+            biffd.write("{\n")
+
+            bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split()
+            if bifattr:
+                attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {}
+                biffunc[arch](bifattr, attrflags,'','', 1, biffd, d)
+
+            bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split()
+            if bifpartition:
+                attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {}
+                attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {}
+                ids = d.getVarFlags("BIF_PARTITION_ID") or {}
+                biffunc[arch](bifpartition, attrflags, attrimage, ids, 0, 
biffd, d)
+
+            biffd.write("}")
     else:
         print("Using custom BIF file: " + d.getVar("BIF_FILE_PATH") )
 }
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#4917): 
https://lists.yoctoproject.org/g/meta-xilinx/message/4917
Mute This Topic: https://lists.yoctoproject.org/mt/85253273/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-xilinx/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to