Write set of bitbake variables associated with the image into build/tmp/sysroots/<machine>/imagedata/<image>.env
This is needed for wic to be able to get bitbake variables without running 'bitbake -e'. Signed-off-by: Ed Bartosh <[email protected]> --- meta/lib/oe/image.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py index 699c30f..a7fdefa 100644 --- a/meta/lib/oe/image.py +++ b/meta/lib/oe/image.py @@ -321,6 +321,27 @@ class Image(ImageDepGraph): return image_cmd_groups + def _write_env(self): + """ + Write environment variables + to tmp/sysroots/<machine>/imgdata/<image>.env + """ + stdir = self.d.getVar('STAGING_DIR_TARGET', True) + outdir = os.path.join(stdir, 'imgdata') + if not os.path.exists(outdir): + os.makedirs(outdir) + basename = self.d.getVar('IMAGE_BASENAME', True) + with open(os.path.join(outdir, basename) + '.env', 'w') as envf: + for var in sorted(self.d.keys()): + # filter out as much as we can to reduce file size + if var.startswith('_') or var.startswith('BB_') \ + or not var.isupper() or self.d.getVarFlag(var, "func") \ + or var in ('BBINCLUDED', 'SRCPV', 'MIRRORS'): + continue + value = self.d.getVar(var, True) + if value: + envf.write('%s="%s"\n' % (var, value.strip())) + def create(self): bb.note("###### Generate images #######") pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True) @@ -332,6 +353,8 @@ class Image(ImageDepGraph): image_cmd_groups = self._get_imagecmds() + self._write_env() + for image_cmds in image_cmd_groups: # create the images in parallel nproc = multiprocessing.cpu_count() -- 2.1.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
