Hey guys, No one sent any feedback on this one. This is one of the highest priority patches in the series.
> On Jul 6, 2017, at 13:16, Jean-Francois Dagenais <[email protected]> > wrote: > > The BOOT.bin product cannot be made by a task attached to every image > recipe like it is now because it means that each image recipe built, > wheather sequencially or in parallel, will compete to overwrite the > same BOOT.bin file in the DEPLOY_DIR_IMAGE directory. > > Plus, doing the boot.bin while making an initramfs makes no sense. > > Instead, the BOOT.bin product as a recipe on it's own, will behave > better in the yocto build system. > > The recipe can be triggered through normal depencency at machine level, > or as part of image_types dependencies, etc. > > For a wic made sdcard image, something like this works well at the: > machine scope: > > do_image_wic[depends] += "\ > xilinx-bootbin:do_deploy \ > " > IMAGE_BOOT_FILES = "\ > BOOT.bin \ > ... > " > > Signed-off-by: Jean-Francois Dagenais <[email protected]> > --- > classes/xilinx-bootbin.bbclass | 83 ------------------- > conf/machine/include/machine-xilinx-zynqmp.inc | 2 - > recipes-bsp/bootbin/xilinx-bootbin_1.0.bb | 105 +++++++++++++++++++++++++ > 3 files changed, 105 insertions(+), 85 deletions(-) > delete mode 100644 classes/xilinx-bootbin.bbclass > create mode 100644 recipes-bsp/bootbin/xilinx-bootbin_1.0.bb > > diff --git a/classes/xilinx-bootbin.bbclass b/classes/xilinx-bootbin.bbclass > deleted file mode 100644 > index db2235b..0000000 > --- a/classes/xilinx-bootbin.bbclass > +++ /dev/null > @@ -1,83 +0,0 @@ > -inherit xsct-tc > - > -BIF_COMMON_ATTR ?= '' > -BIF_PARTITION_ATTR ?= '' > -BIF_PARTITION_IMAGE ?= '' > -BIF_PARTITION_DEPENDS ?= '' > -BIF_FILE_PATH = "${WORKDIR}/bootgen.bif" > - > -def create_bif(config, attrflags, attrimage, common_attr, biffd, d): > - import re, os > - for cfg in config: > - if cfg not in attrflags and common_attr: > - error_msg = "%s: invalid ATTRIBUTE" % (cfg) > - bb.error("BIF attribute Error: %s " % (error_msg)) > - else: > - if common_attr: > - cfgval = attrflags[cfg].split(',') > - cfgstr = "\t [%s] %s\n" % (cfg,', '.join(cfgval)) > - else: > - if cfg not in attrimage: > - error_msg = "%s: invalid or missing elf or image" % (cfg) > - bb.error("BIF atrribute Error: %s " % (error_msg)) > - imagestr = d.expand(attrimage[cfg]) > - if os.stat(imagestr).st_size == 0: > - bb.warn("Empty file %s, excluding from bif file" > %(imagestr)) > - continue > - if cfg in attrflags: > - cfgval = attrflags[cfg].split(',') > - cfgstr = "\t [%s] %s\n" % (', '.join(cfgval), imagestr) > - else: > - cfgstr = "\t %s\n" % (imagestr) > - biffd.write(cfgstr) > - > - return > - > -python do_create_bif() { > - > - fp = d.getVar("BIF_FILE_PATH", True) > - biffd = open(fp, 'w') > - biffd.write("the_ROM_image:\n") > - biffd.write("{\n") > - > - bifattr = (d.getVar("BIF_COMMON_ATTR", True) or "").split() > - if bifattr: > - attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {} > - create_bif(bifattr, attrflags,'', 1, biffd, d) > - > - bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split() > - if bifpartition: > - attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {} > - attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {} > - create_bif(bifpartition, attrflags, attrimage, 0, biffd, d) > - > - biffd.write("}") > - biffd.close() > -} > -addtask do_create_bif after do_image_complete before do_xilinx_bootbin > - > -do_create_bif[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE > BIF_COMMON_ATTR" > -do_create_bif[depends] += "${@get_bootbin_depends(d)}" > - > -def get_bootbin_depends(d): > - bootbindeps = "" > - bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split() > - attrdepends = d.getVarFlags("BIF_PARTITION_DEPENDS") or {} > - for cfg in bifpartition: > - if cfg in attrdepends: > - bootbindeps = bootbindeps + " " + attrdepends[cfg] + ":do_deploy" > - > - return bootbindeps > - > -do_xilinx_bootbin[depends] += "${@get_bootbin_depends(d)}" > - > -do_xilinx_bootbin () { > - cd ${WORKDIR} > - rm -f BOOT.bin > - bootgen -image ${BIF_FILE_PATH} -arch ${KMACHINE} -w -o BOOT.bin > - if [ ! -e BOOT.bin ]; then > - bbfatal "bootgen failed. See log" > - fi > - install -m 0644 BOOT.bin ${DEPLOY_DIR_IMAGE}/BOOT.bin > -} > -addtask do_xilinx_bootbin after do_image_complete before do_build > diff --git a/conf/machine/include/machine-xilinx-zynqmp.inc > b/conf/machine/include/machine-xilinx-zynqmp.inc > index c620813..5357741 100644 > --- a/conf/machine/include/machine-xilinx-zynqmp.inc > +++ b/conf/machine/include/machine-xilinx-zynqmp.inc > @@ -1,5 +1,3 @@ > -# add Boot.bin dependency > -IMAGE_CLASSES_append ?= " xilinx-bootbin" > > # specify BIF common attribute for FSBL > BIF_COMMON_ATTR ?= "fsbl_config" > diff --git a/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb > b/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb > new file mode 100644 > index 0000000..2aca94e > --- /dev/null > +++ b/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb > @@ -0,0 +1,105 @@ > +SUMMARY = "Generates boot.bin using bootgen tool" > +DESCRIPTION = "Manages task dependencies and creation of boot.bin. Use the \ > +BIF_PARTITION_xyz global variables and flags to determine what makes it into > \ > +the image." > + > +LICENSE = "BSD" > + > +inherit xsct-tc > +inherit nopackages base deploy > + > +PACKAGE_ARCH = "${MACHINE_ARCH}" > + > +BIF_COMMON_ATTR ?= '' > +BIF_PARTITION_ATTR ?= '' > +BIF_PARTITION_IMAGE ?= '' > +BIF_PARTITION_DEPENDS ?= '' > +BIF_FILE_PATH = "${B}/bootgen.bif" > + > +# this recipe is almost like an image recipe, taken from image.bbclass: > +deltask do_fetch > +deltask do_unpack > +deltask do_patch > +#do_configure[noexec] = "1" > +#do_compile[noexec] = "1" > +do_install[noexec] = "1" > +#deltask do_populate_sysroot > + > +def create_bif(config, attrflags, attrimage, common_attr, biffd, d): > + import re, os > + for cfg in config: > + if cfg not in attrflags and common_attr: > + error_msg = "%s: invalid ATTRIBUTE" % (cfg) > + bb.error("BIF attribute Error: %s " % (error_msg)) > + else: > + if common_attr: > + cfgval = attrflags[cfg].split(',') > + cfgstr = "\t [%s] %s\n" % (cfg,', '.join(cfgval)) > + else: > + if cfg not in attrimage: > + error_msg = "%s: invalid or missing elf or image" % (cfg) > + bb.error("BIF atrribute Error: %s " % (error_msg)) > + imagestr = d.expand(attrimage[cfg]) > + if os.stat(imagestr).st_size == 0: > + bb.warn("Empty file %s, excluding from bif file" > %(imagestr)) > + continue > + if cfg in attrflags: > + cfgval = attrflags[cfg].split(',') > + cfgstr = "\t [%s] %s\n" % (', '.join(cfgval), imagestr) > + else: > + cfgstr = "\t %s\n" % (imagestr) > + biffd.write(cfgstr) > + > + return > + > +python do_configure() { > + > + fp = d.getVar("BIF_FILE_PATH", True) > + biffd = open(fp, 'w') > + biffd.write("the_ROM_image:\n") > + biffd.write("{\n") > + > + bifattr = (d.getVar("BIF_COMMON_ATTR", True) or "").split() > + if bifattr: > + attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {} > + create_bif(bifattr, attrflags,'', 1, biffd, d) > + > + bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split() > + if bifpartition: > + attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {} > + attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {} > + create_bif(bifpartition, attrflags, attrimage, 0, biffd, d) > + > + biffd.write("}") > + biffd.close() > +} > + > +do_configure[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE > BIF_COMMON_ATTR" > +do_configure[depends] += "${@get_bootbin_depends(d)}" > + > +def get_bootbin_depends(d): > + bootbindeps = "" > + bifpartition = (d.getVar("BIF_PARTITION_ATTR", True) or "").split() > + attrdepends = d.getVarFlags("BIF_PARTITION_DEPENDS") or {} > + for cfg in bifpartition: > + if cfg in attrdepends: > + bootbindeps = bootbindeps + " " + attrdepends[cfg] + ":do_deploy" > + > + return bootbindeps > + > + > +do_compile() { > + cd ${WORKDIR} > + rm -f ${B}/BOOT.bin > + bootgen -image ${BIF_FILE_PATH} -arch ${KMACHINE} -w -o ${B}/BOOT.bin > + if [ ! -e ${B}/BOOT.bin ]; then > + bbfatal "bootgen failed. See log" > + fi > +} > + > +do_deploy() { > + install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/BOOT.bin > +} > +addtask do_deploy before do_build after do_compile > + > +#do_build[depends] += "${PN}:do_deploy" > -- > 2.1.4 > -- _______________________________________________ meta-xilinx mailing list [email protected] https://lists.yoctoproject.org/listinfo/meta-xilinx
