summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/image_types.bbclass4
-rw-r--r--meta/lib/oe/image.py18
2 files changed, 22 insertions, 0 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 05c45f8a6a..ecb066bf99 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -248,3 +248,7 @@ IMAGE_EXTENSION_live = "hddimg iso"
248# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES, 248# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
249# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc. 249# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc.
250IMAGE_TYPES_MASKED ?= "" 250IMAGE_TYPES_MASKED ?= ""
251
252# The WICVARS variable is used to define list of bitbake variables used in wic code
253# variables from this list is written to <image>.env file
254WICVARS ?= "BBLAYERS DEPLOY_DIR_IMAGE HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS"
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index a2f94a1cd4..95c62dca44 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -326,6 +326,22 @@ class Image(ImageDepGraph):
326 326
327 return image_cmd_groups 327 return image_cmd_groups
328 328
329 def _write_env(self):
330 """
331 Write environment variables used by wic
332 to tmp/sysroots/<machine>/imgdata/<image>.env
333 """
334 stdir = self.d.getVar('STAGING_DIR_TARGET', True)
335 outdir = os.path.join(stdir, 'imgdata')
336 if not os.path.exists(outdir):
337 os.makedirs(outdir)
338 basename = self.d.getVar('IMAGE_BASENAME', True)
339 with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
340 for var in self.d.getVar('WICVARS', True).split():
341 value = self.d.getVar(var, True)
342 if value:
343 envf.write('%s="%s"\n' % (var, value.strip()))
344
329 def create(self): 345 def create(self):
330 bb.note("###### Generate images #######") 346 bb.note("###### Generate images #######")
331 pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True) 347 pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True)
@@ -337,6 +353,8 @@ class Image(ImageDepGraph):
337 353
338 image_cmd_groups = self._get_imagecmds() 354 image_cmd_groups = self._get_imagecmds()
339 355
356 self._write_env()
357
340 for image_cmds in image_cmd_groups: 358 for image_cmds in image_cmd_groups:
341 # create the images in parallel 359 # create the images in parallel
342 nproc = multiprocessing.cpu_count() 360 nproc = multiprocessing.cpu_count()