summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-04-07 12:57:41 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-09 07:43:53 +0100
commit2dc30249babbeb2ac3d2bfdbb49cc5963dfff432 (patch)
tree93ba1bbf6d125e067b4e543e8c43b13de5637d9c /scripts/wic
parent939fca9de24e6750baa9ba066daafdda85b4a216 (diff)
downloadpoky-2dc30249babbeb2ac3d2bfdbb49cc5963dfff432.tar.gz
wic: Implement --build-rootfs command line option
-f/--build-rootfs option makes wic to run bitbake <image> to produce rootfs. This option requires image name to be specified with -e/--image-name. (From OE-Core rev: 75ae0b7cf3863eb2857a2b6a7073beea626f751d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic25
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/wic b/scripts/wic
index ce78254d67..524156ddc5 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -40,11 +40,15 @@ import logging
40# External modules 40# External modules
41scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) 41scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
42lib_path = scripts_path + '/lib' 42lib_path = scripts_path + '/lib'
43sys.path = sys.path + [lib_path] 43bitbake_path = os.path.join(scripts_path, '../bitbake/lib')
44sys.path = sys.path + [lib_path, bitbake_path]
44 45
45from image.help import * 46from image.help import *
46from image.engine import * 47from image.engine import *
47 48
49from bb import cookerdata
50from bb.main import bitbake_main, BitBakeConfigParameters
51
48def rootfs_dir_to_args(krootfs_dir): 52def rootfs_dir_to_args(krootfs_dir):
49 """ 53 """
50 Get a rootfs_dir dict and serialize to string 54 Get a rootfs_dir dict and serialize to string
@@ -94,6 +98,7 @@ def wic_create_subcommand(args, usage_str):
94 action = "store", help = "path to the native sysroot containing the tools to use to build the image") 98 action = "store", help = "path to the native sysroot containing the tools to use to build the image")
95 parser.add_option("-p", "--skip-build-check", dest = "build_check", 99 parser.add_option("-p", "--skip-build-check", dest = "build_check",
96 action = "store_false", default = True, help = "skip the build check") 100 action = "store_false", default = True, help = "skip the build check")
101 parser.add_option("-f", "--build-rootfs", action="store_true", help = "build rootfs")
97 parser.add_option("-D", "--debug", dest = "debug", action = "store_true", 102 parser.add_option("-D", "--debug", dest = "debug", action = "store_true",
98 default = False, help = "output debug information") 103 default = False, help = "output debug information")
99 104
@@ -123,8 +128,6 @@ def wic_create_subcommand(args, usage_str):
123 else: 128 else:
124 print "Done.\n" 129 print "Done.\n"
125 130
126 print "Creating image(s)...\n"
127
128 bitbake_env_lines = find_bitbake_env_lines(options.image_name) 131 bitbake_env_lines = find_bitbake_env_lines(options.image_name)
129 if not bitbake_env_lines: 132 if not bitbake_env_lines:
130 print "Couldn't get bitbake environment, exiting." 133 print "Couldn't get bitbake environment, exiting."
@@ -134,9 +137,24 @@ def wic_create_subcommand(args, usage_str):
134 bootimg_dir = "" 137 bootimg_dir = ""
135 138
136 if options.image_name: 139 if options.image_name:
140 if options.build_rootfs:
141 argv = ["bitbake", options.image_name]
142 if options.debug:
143 argv.append("--debug")
144
145 print "Building rootfs...\n"
146 if bitbake_main(BitBakeConfigParameters(argv),
147 cookerdata.CookerConfiguration()):
148 sys.exit(1)
149
137 (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \ 150 (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \
138 = find_artifacts(options.image_name) 151 = find_artifacts(options.image_name)
139 152
153 else:
154 if options.build_rootfs:
155 print "Image name is not specified, exiting. (Use -e/--image-name to specify it)\n"
156 sys.exit(1)
157
140 wks_file = args[0] 158 wks_file = args[0]
141 159
142 if not wks_file.endswith(".wks"): 160 if not wks_file.endswith(".wks"):
@@ -194,6 +212,7 @@ def wic_create_subcommand(args, usage_str):
194 212
195 rootfs_dir = rootfs_dir_to_args(krootfs_dir) 213 rootfs_dir = rootfs_dir_to_args(krootfs_dir)
196 214
215 print "Creating image(s)...\n"
197 wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, 216 wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
198 native_sysroot, scripts_path, image_output_dir, 217 native_sysroot, scripts_path, image_output_dir,
199 options.debug, options.properties_file) 218 options.debug, options.properties_file)