summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic20
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/wic b/scripts/wic
index 5bedd90f87..7d388c9768 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -36,19 +36,25 @@ import os
36import sys 36import sys
37import optparse 37import optparse
38import logging 38import logging
39from distutils import spawn
39 40
40# External modules 41# External modules
41scripts_path = os.path.abspath(os.path.dirname(__file__)) 42scripts_path = os.path.abspath(os.path.dirname(__file__))
42lib_path = scripts_path + '/lib' 43lib_path = scripts_path + '/lib'
43bitbake_path = os.path.join(scripts_path, '../bitbake/lib') 44sys.path.append(lib_path)
44sys.path = sys.path + [lib_path, bitbake_path] 45
46bitbake_exe = spawn.find_executable('bitbake')
47if bitbake_exe:
48 bitbake_path = os.path.join(os.path.dirname(bitbake_exe), '../lib')
49 sys.path.append(bitbake_path)
50 from bb import cookerdata
51 from bb.main import bitbake_main, BitBakeConfigParameters
52else:
53 bitbake_main = None
45 54
46from image.help import * 55from image.help import *
47from image.engine import * 56from image.engine import *
48 57
49from bb import cookerdata
50from bb.main import bitbake_main, BitBakeConfigParameters
51
52def rootfs_dir_to_args(krootfs_dir): 58def rootfs_dir_to_args(krootfs_dir):
53 """ 59 """
54 Get a rootfs_dir dict and serialize to string 60 Get a rootfs_dir dict and serialize to string
@@ -109,6 +115,10 @@ def wic_create_subcommand(args, usage_str):
109 parser.print_help() 115 parser.print_help()
110 sys.exit(1) 116 sys.exit(1)
111 117
118 if options.build_rootfs and not bitbake_main:
119 logging.error("Can't build roofs as bitbake is not in the $PATH")
120 sys.exit(1)
121
112 if not options.image_name and not (options.rootfs_dir and 122 if not options.image_name and not (options.rootfs_dir and
113 options.bootimg_dir and 123 options.bootimg_dir and
114 options.kernel_dir and 124 options.kernel_dir and