summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/wic/creator.py1
-rw-r--r--scripts/lib/wic/engine.py11
-rw-r--r--scripts/lib/wic/imager/direct.py23
-rw-r--r--scripts/lib/wic/plugins/imager/direct_plugin.py3
-rwxr-xr-xscripts/wic3
5 files changed, 28 insertions, 13 deletions
diff --git a/scripts/lib/wic/creator.py b/scripts/lib/wic/creator.py
index d4972e889b..8f7d1503f5 100644
--- a/scripts/lib/wic/creator.py
+++ b/scripts/lib/wic/creator.py
@@ -69,6 +69,7 @@ class Creator():
69 optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs', 69 optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs',
70 help='Setup tmpdir as tmpfs to accelerate, experimental' 70 help='Setup tmpdir as tmpfs to accelerate, experimental'
71 ' feature, use it if you have more than 4G memory') 71 ' feature, use it if you have more than 4G memory')
72 optparser.add_option('', '--bmap', action='store_true', help='generate .bmap')
72 return optparser 73 return optparser
73 74
74 def postoptparse(self, options): 75 def postoptparse(self, options):
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 5d35c46b32..5b104631ca 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -145,7 +145,7 @@ def list_source_plugins():
145 145
146def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, 146def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
147 native_sysroot, scripts_path, image_output_dir, 147 native_sysroot, scripts_path, image_output_dir,
148 compressor, debug): 148 compressor, bmap, debug):
149 """Create image 149 """Create image
150 150
151 wks_file - user-defined OE kickstart file 151 wks_file - user-defined OE kickstart file
@@ -156,6 +156,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
156 scripts_path - absolute path to /scripts dir 156 scripts_path - absolute path to /scripts dir
157 image_output_dir - dirname to create for image 157 image_output_dir - dirname to create for image
158 compressor - compressor utility to compress the image 158 compressor - compressor utility to compress the image
159 bmap - enable generation of .bmap
159 160
160 Normally, the values for the build artifacts values are determined 161 Normally, the values for the build artifacts values are determined
161 by 'wic -e' from the output of the 'bitbake -e' command given an 162 by 'wic -e' from the output of the 'bitbake -e' command given an
@@ -186,8 +187,12 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
186 187
187 crobj = creator.Creator() 188 crobj = creator.Creator()
188 189
189 crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, 190 cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
190 wks_file, image_output_dir, oe_builddir, compressor or ""]) 191 wks_file, image_output_dir, oe_builddir, compressor or ""]
192 if bmap:
193 cmdline.append('--bmap')
194
195 crobj.main(cmdline)
191 196
192 print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file) 197 print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file)
193 198
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):
diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py
index 6d3f46cc61..8fe3930804 100644
--- a/scripts/lib/wic/plugins/imager/direct_plugin.py
+++ b/scripts/lib/wic/plugins/imager/direct_plugin.py
@@ -86,7 +86,8 @@ class DirectPlugin(ImagerPlugin):
86 kernel_dir, 86 kernel_dir,
87 native_sysroot, 87 native_sysroot,
88 compressor, 88 compressor,
89 creatoropts) 89 creatoropts,
90 opts.bmap)
90 91
91 try: 92 try:
92 creator.create() 93 creator.create()
diff --git a/scripts/wic b/scripts/wic
index 11c8316b97..3d33430f1b 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -115,6 +115,7 @@ def wic_create_subcommand(args, usage_str):
115 parser.add_option("-c", "--compress-with", choices=("gzip", "bzip2", "xz"), 115 parser.add_option("-c", "--compress-with", choices=("gzip", "bzip2", "xz"),
116 dest='compressor', 116 dest='compressor',
117 help="compress image with specified compressor") 117 help="compress image with specified compressor")
118 parser.add_option("-m", "--bmap", action="store_true", help="generate .bmap")
118 parser.add_option("-v", "--vars", dest='vars_dir', 119 parser.add_option("-v", "--vars", dest='vars_dir',
119 help="directory with <image>.env files that store " 120 help="directory with <image>.env files that store "
120 "bitbake variables") 121 "bitbake variables")
@@ -245,7 +246,7 @@ def wic_create_subcommand(args, usage_str):
245 print("Creating image(s)...\n") 246 print("Creating image(s)...\n")
246 engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, 247 engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
247 native_sysroot, scripts_path, image_output_dir, 248 native_sysroot, scripts_path, image_output_dir,
248 options.compressor, options.debug) 249 options.compressor, options.bmap, options.debug)
249 250
250 251
251def wic_list_subcommand(args, usage_str): 252def wic_list_subcommand(args, usage_str):