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 08:39:26 +0100 |
commit | d64c7b37c40b052510419b4d6629b83319c833e4 (patch) | |
tree | c9c53bfbc5537e2b98fe1cfea5fc7d1161fe4b6f /scripts/lib/wic/imager | |
parent | 4684ac5f4d823a6afedc57aad0aa417bb17ba950 (diff) | |
download | openembedded-core-d64c7b37c40b052510419b4d6629b83319c833e4.tar.gz openembedded-core-d64c7b37c40b052510419b4d6629b83319c833e4.tar.bz2 openembedded-core-d64c7b37c40b052510419b4d6629b83319c833e4.zip |
wic: implement --bmap option
This option enables generation of <image>.bmap file for the
result image using native bmaptool.
[YOCTO #9413]
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 from wic.utils.errors import CreatorError, ImageError from wic.imager.baseimager import BaseImageCreator from wic.plugin import pluginmgr -from wic.utils.oe.misc import exec_cmd +from wic.utils.oe.misc import exec_cmd, exec_native_cmd disk_methods = { "do_install_disk":None, @@ -71,7 +71,8 @@ class DirectImageCreator(BaseImageCreator): """ def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir, - kernel_dir, native_sysroot, compressor, creatoropts=None): + kernel_dir, native_sysroot, compressor, creatoropts=None, + bmap=False): """ Initialize a DirectImageCreator instance. @@ -93,6 +94,7 @@ class DirectImageCreator(BaseImageCreator): self.kernel_dir = kernel_dir self.native_sysroot = native_sysroot self.compressor = compressor + self.bmap = bmap def __get_part_num(self, num, parts): """calculate the real partition number, accounting for partitions not @@ -333,12 +335,17 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) - # Compress the image - if self.compressor: - for disk_name, disk in self.__image.disks.items(): - full_path = self._full_path(self.__imgdir, disk_name, "direct") - msger.debug("Compressing disk %s with %s" % \ - (disk_name, self.compressor)) + + for disk_name, disk in self.__image.disks.items(): + full_path = self._full_path(self.__imgdir, disk_name, "direct") + # Generate .bmap + if self.bmap: + msger.debug("Generating bmap file for %s" % disk_name) + exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path), + self.native_sysroot) + # Compress the image + if self.compressor: + msger.debug("Compressing disk %s with %s" % (disk_name, self.compressor)) exec_cmd("%s %s" % (self.compressor, full_path)) def print_outimage_info(self): |