summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic54
1 files changed, 53 insertions, 1 deletions
diff --git a/scripts/wic b/scripts/wic
index 4bcff8f79c..9137208f5e 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -159,6 +159,9 @@ def wic_create_subcommand(options, usage_str):
159 "(Use -e/--image-name to specify it)") 159 "(Use -e/--image-name to specify it)")
160 native_sysroot = options.native_sysroot 160 native_sysroot = options.native_sysroot
161 161
162 if options.kernel_dir:
163 kernel_dir = options.kernel_dir
164
162 if not options.vars_dir and (not native_sysroot or not os.path.isdir(native_sysroot)): 165 if not options.vars_dir and (not native_sysroot or not os.path.isdir(native_sysroot)):
163 logger.info("Building wic-tools...\n") 166 logger.info("Building wic-tools...\n")
164 subprocess.check_call(["bitbake", "wic-tools"]) 167 subprocess.check_call(["bitbake", "wic-tools"])
@@ -206,7 +209,7 @@ def wic_create_subcommand(options, usage_str):
206 logger.info(" (Please check that the build artifacts for the machine") 209 logger.info(" (Please check that the build artifacts for the machine")
207 logger.info(" selected in local.conf actually exist and that they") 210 logger.info(" selected in local.conf actually exist and that they")
208 logger.info(" are the correct artifacts for the image (.wks file)).\n") 211 logger.info(" are the correct artifacts for the image (.wks file)).\n")
209 raise WicError("The artifact that couldn't be found was %s:\n %s", not_found, not_found_dir) 212 raise WicError("The artifact that couldn't be found was %s:\n %s" % (not_found, not_found_dir))
210 213
211 krootfs_dir = options.rootfs_dir 214 krootfs_dir = options.rootfs_dir
212 if krootfs_dir is None: 215 if krootfs_dir is None:
@@ -234,6 +237,13 @@ def wic_ls_subcommand(args, usage_str):
234 Command-line handling for list content of images. 237 Command-line handling for list content of images.
235 The real work is done by engine.wic_ls() 238 The real work is done by engine.wic_ls()
236 """ 239 """
240
241 if args.image_name:
242 BB_VARS.default_image = args.image_name
243
244 if args.vars_dir:
245 BB_VARS.vars_dir = args.vars_dir
246
237 engine.wic_ls(args, args.native_sysroot) 247 engine.wic_ls(args, args.native_sysroot)
238 248
239def wic_cp_subcommand(args, usage_str): 249def wic_cp_subcommand(args, usage_str):
@@ -241,6 +251,12 @@ def wic_cp_subcommand(args, usage_str):
241 Command-line handling for copying files/dirs to images. 251 Command-line handling for copying files/dirs to images.
242 The real work is done by engine.wic_cp() 252 The real work is done by engine.wic_cp()
243 """ 253 """
254 if args.image_name:
255 BB_VARS.default_image = args.image_name
256
257 if args.vars_dir:
258 BB_VARS.vars_dir = args.vars_dir
259
244 engine.wic_cp(args, args.native_sysroot) 260 engine.wic_cp(args, args.native_sysroot)
245 261
246def wic_rm_subcommand(args, usage_str): 262def wic_rm_subcommand(args, usage_str):
@@ -248,6 +264,12 @@ def wic_rm_subcommand(args, usage_str):
248 Command-line handling for removing files/dirs from images. 264 Command-line handling for removing files/dirs from images.
249 The real work is done by engine.wic_rm() 265 The real work is done by engine.wic_rm()
250 """ 266 """
267 if args.image_name:
268 BB_VARS.default_image = args.image_name
269
270 if args.vars_dir:
271 BB_VARS.vars_dir = args.vars_dir
272
251 engine.wic_rm(args, args.native_sysroot) 273 engine.wic_rm(args, args.native_sysroot)
252 274
253def wic_write_subcommand(args, usage_str): 275def wic_write_subcommand(args, usage_str):
@@ -255,6 +277,12 @@ def wic_write_subcommand(args, usage_str):
255 Command-line handling for writing images. 277 Command-line handling for writing images.
256 The real work is done by engine.wic_write() 278 The real work is done by engine.wic_write()
257 """ 279 """
280 if args.image_name:
281 BB_VARS.default_image = args.image_name
282
283 if args.vars_dir:
284 BB_VARS.vars_dir = args.vars_dir
285
258 engine.wic_write(args, args.native_sysroot) 286 engine.wic_write(args, args.native_sysroot)
259 287
260def wic_help_subcommand(args, usage_str): 288def wic_help_subcommand(args, usage_str):
@@ -387,6 +415,12 @@ def wic_init_parser_ls(subparser):
387 help="image spec: <image>[:<vfat partition>[<path>]]") 415 help="image spec: <image>[:<vfat partition>[<path>]]")
388 subparser.add_argument("-n", "--native-sysroot", 416 subparser.add_argument("-n", "--native-sysroot",
389 help="path to the native sysroot containing the tools") 417 help="path to the native sysroot containing the tools")
418 subparser.add_argument("-e", "--image-name", dest="image_name",
419 help="name of the image to use the artifacts from "
420 "e.g. core-image-sato")
421 subparser.add_argument("-v", "--vars", dest='vars_dir',
422 help="directory with <image>.env files that store "
423 "bitbake variables")
390 424
391def imgpathtype(arg): 425def imgpathtype(arg):
392 img = imgtype(arg) 426 img = imgtype(arg)
@@ -401,6 +435,12 @@ def wic_init_parser_cp(subparser):
401 help="image spec: <image>:<vfat partition>[<path>] or <file>") 435 help="image spec: <image>:<vfat partition>[<path>] or <file>")
402 subparser.add_argument("-n", "--native-sysroot", 436 subparser.add_argument("-n", "--native-sysroot",
403 help="path to the native sysroot containing the tools") 437 help="path to the native sysroot containing the tools")
438 subparser.add_argument("-e", "--image-name", dest="image_name",
439 help="name of the image to use the artifacts from "
440 "e.g. core-image-sato")
441 subparser.add_argument("-v", "--vars", dest='vars_dir',
442 help="directory with <image>.env files that store "
443 "bitbake variables")
404 444
405def wic_init_parser_rm(subparser): 445def wic_init_parser_rm(subparser):
406 subparser.add_argument("path", type=imgpathtype, 446 subparser.add_argument("path", type=imgpathtype,
@@ -410,6 +450,12 @@ def wic_init_parser_rm(subparser):
410 subparser.add_argument("-r", dest="recursive_delete", action="store_true", default=False, 450 subparser.add_argument("-r", dest="recursive_delete", action="store_true", default=False,
411 help="remove directories and their contents recursively, " 451 help="remove directories and their contents recursively, "
412 " this only applies to ext* partition") 452 " this only applies to ext* partition")
453 subparser.add_argument("-e", "--image-name", dest="image_name",
454 help="name of the image to use the artifacts from "
455 "e.g. core-image-sato")
456 subparser.add_argument("-v", "--vars", dest='vars_dir',
457 help="directory with <image>.env files that store "
458 "bitbake variables")
413 459
414def expandtype(rules): 460def expandtype(rules):
415 """ 461 """
@@ -451,6 +497,12 @@ def wic_init_parser_write(subparser):
451 help="expand rules: auto or <partition>:<size>[,<partition>:<size>]") 497 help="expand rules: auto or <partition>:<size>[,<partition>:<size>]")
452 subparser.add_argument("-n", "--native-sysroot", 498 subparser.add_argument("-n", "--native-sysroot",
453 help="path to the native sysroot containing the tools") 499 help="path to the native sysroot containing the tools")
500 subparser.add_argument("--image-name", dest="image_name",
501 help="name of the image to use the artifacts from "
502 "e.g. core-image-sato")
503 subparser.add_argument("-v", "--vars", dest='vars_dir',
504 help="directory with <image>.env files that store "
505 "bitbake variables")
454 506
455def wic_init_parser_help(subparser): 507def wic_init_parser_help(subparser):
456 helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage) 508 helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage)