summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/imager/direct.py')
-rw-r--r--scripts/lib/wic/imager/direct.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 5a3b655a0c..ffde232c2b 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -33,7 +33,7 @@ from wic.utils.partitionedfs import Image
33from wic.utils.errors import CreatorError, ImageError 33from wic.utils.errors import CreatorError, ImageError
34from wic.imager.baseimager import BaseImageCreator 34from wic.imager.baseimager import BaseImageCreator
35from wic.plugin import pluginmgr 35from wic.plugin import pluginmgr
36from wic.utils.oe.misc import exec_cmd 36from wic.utils.oe.misc import exec_cmd, exec_native_cmd
37 37
38disk_methods = { 38disk_methods = {
39 "do_install_disk":None, 39 "do_install_disk":None,
@@ -71,7 +71,8 @@ class DirectImageCreator(BaseImageCreator):
71 """ 71 """
72 72
73 def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir, 73 def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir,
74 kernel_dir, native_sysroot, compressor, creatoropts=None): 74 kernel_dir, native_sysroot, compressor, creatoropts=None,
75 bmap=False):
75 """ 76 """
76 Initialize a DirectImageCreator instance. 77 Initialize a DirectImageCreator instance.
77 78
@@ -93,6 +94,7 @@ class DirectImageCreator(BaseImageCreator):
93 self.kernel_dir = kernel_dir 94 self.kernel_dir = kernel_dir
94 self.native_sysroot = native_sysroot 95 self.native_sysroot = native_sysroot
95 self.compressor = compressor 96 self.compressor = compressor
97 self.bmap = bmap
96 98
97 def __get_part_num(self, num, parts): 99 def __get_part_num(self, num, parts):
98 """calculate the real partition number, accounting for partitions not 100 """calculate the real partition number, accounting for partitions not
@@ -333,12 +335,17 @@ class DirectImageCreator(BaseImageCreator):
333 self.bootimg_dir, 335 self.bootimg_dir,
334 self.kernel_dir, 336 self.kernel_dir,
335 self.native_sysroot) 337 self.native_sysroot)
336 # Compress the image 338
337 if self.compressor: 339 for disk_name, disk in self.__image.disks.items():
338 for disk_name, disk in self.__image.disks.items(): 340 full_path = self._full_path(self.__imgdir, disk_name, "direct")
339 full_path = self._full_path(self.__imgdir, disk_name, "direct") 341 # Generate .bmap
340 msger.debug("Compressing disk %s with %s" % \ 342 if self.bmap:
341 (disk_name, self.compressor)) 343 msger.debug("Generating bmap file for %s" % disk_name)
344 exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path),
345 self.native_sysroot)
346 # Compress the image
347 if self.compressor:
348 msger.debug("Compressing disk %s with %s" % (disk_name, self.compressor))
342 exec_cmd("%s %s" % (self.compressor, full_path)) 349 exec_cmd("%s %s" % (self.compressor, full_path))
343 350
344 def print_outimage_info(self): 351 def print_outimage_info(self):