From 60430557ed2a9bfe4df648af245e8cf195cac2f3 Mon Sep 17 00:00:00 2001 From: John Toomey Date: Mon, 29 May 2023 13:50:15 +0100 Subject: xilinx-bootbin: Refactor create_bif functions Remove the biffunc dict which was used to map arch to a specific bif creation function and replace with simple if/elif/else logic. The default bif file functions are defined for zynq/zynqmp and versal as well as and empty default function which could be redefined in a bbappend with new logic or mapped back to one of the existing functions. Signed-off-by: John Toomey Signed-off-by: Mark Hatle --- .../recipes-bsp/bootbin/xilinx-bootbin_1.0.bb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'meta-xilinx-core') 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 5133fbd8..4c8bfa0e 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 @@ -44,6 +44,10 @@ BOOTGEN_EXTRA_ARGS ?= "" do_patch[noexec] = "1" def create_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): + arch = d.getVar("SOC_FAMILY") + bb.error("create_bif function not defined for arch: %s" % (arch)) + +def create_zynq_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): import re, os for cfg in config: if cfg not in attrflags and common_attr: @@ -117,23 +121,32 @@ def create_versal_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): python do_configure() { fp = d.getVar("BIF_FILE_PATH") 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") + arch = d.getVar("SOC_FAMILY") bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split() if bifattr: attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {} - biffunc[arch](bifattr, attrflags,'','', 1, biffd, d) + if arch in ['zynq', 'zynqmp']: + create_zynq_bif(bifattr, attrflags,'','', 1, biffd, d) + elif arch in ['versal']: + create_versal_bif(bifattr, attrflags,'','', 1, biffd, d) + else: + create_bif(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) + if arch in ['zynq', 'zynqmp']: + create_zynq_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) + elif arch in ['versal']: + create_versal_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) + else: + create_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) biffd.write("}") biffd.close() -- cgit v1.2.3-54-g00ecf