aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-22 15:45:30 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-27 22:42:49 +0100
commit34766858cd900501af5b43d6fc626439f8708720 (patch)
treed0151027fb3181e2ea9ea2e1b1fd232fa59fb6db /scripts/lib/wic/imager
parent597cba650c444ec7dd28386dc54aea7b49e2b918 (diff)
downloadopenembedded-core-contrib-34766858cd900501af5b43d6fc626439f8708720.tar.gz
wic: Implement image compressing
Implemented compressing result image with specified compressor. Updated reporting code to show compressed image. [YOCTO #7593] (From OE-Core rev: 31791fa7a168e6b6fb030aeb338c8233b4735af1) 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.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index f3f20e0745..2ea7e4e04a 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -33,6 +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
disk_methods = {
"do_install_disk":None,
@@ -71,6 +72,7 @@ class DirectImageCreator(BaseImageCreator):
self.bootimg_dir = bootimg_dir
self.kernel_dir = kernel_dir
self.native_sysroot = native_sysroot
+ self.compressor = compressor
def __get_part_num(self, num, parts):
"""calculate the real partition number, accounting for partitions not
@@ -318,6 +320,13 @@ 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))
+ exec_cmd("%s %s" % (self.compressor, full_path))
def print_outimage_info(self):
"""
@@ -328,7 +337,11 @@ class DirectImageCreator(BaseImageCreator):
parts = self._get_parts()
for disk_name, disk in self.__image.disks.items():
- full_path = self._full_path(self.__imgdir, disk_name, "direct")
+ extension = "direct" + {"gzip": ".gz",
+ "bzip2": ".bz2",
+ "xz": ".xz",
+ "": ""}.get(self.compressor)
+ full_path = self._full_path(self.__imgdir, disk_name, extension)
msg += ' %s\n\n' % full_path
msg += 'The following build artifacts were used to create the image(s):\n'