diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-18 15:34:17 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-19 09:05:19 +0100 |
commit | b5804498d6010b75b41b49633948ee5babf48876 (patch) | |
tree | 092a57999b712d59eba098a23593c3f4b843872f /scripts/lib/wic/imager | |
parent | a49d279b509294c374e4e9ed7765a74735ae31d3 (diff) | |
download | poky-b5804498d6010b75b41b49633948ee5babf48876.tar.gz |
wic: implement --bmap option
This option enables generation of <image>.bmap file for the
result image using native bmaptool.
[YOCTO #9413]
(From OE-Core rev: d64c7b37c40b052510419b4d6629b83319c833e4)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/imager')
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 23 |
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 | |||
33 | from wic.utils.errors import CreatorError, ImageError | 33 | from wic.utils.errors import CreatorError, ImageError |
34 | from wic.imager.baseimager import BaseImageCreator | 34 | from wic.imager.baseimager import BaseImageCreator |
35 | from wic.plugin import pluginmgr | 35 | from wic.plugin import pluginmgr |
36 | from wic.utils.oe.misc import exec_cmd | 36 | from wic.utils.oe.misc import exec_cmd, exec_native_cmd |
37 | 37 | ||
38 | disk_methods = { | 38 | disk_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): |