9 cfg_oespawn = data.init()
13 print "Usage: oeimage [options ...]"
14 print "Creates an image for a target device from a root filesystem,"
15 print "obeying configuration parameters from the OpenEmbedded"
16 print "configuration files, thereby easing handling of deviceisms."
18 print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
19 print " %s\t\t%s" % ("-t [arg], --type [arg]", "image type (jffs2[default], cramfs)")
20 print " %s\t\t%s" % ("-v, --version", "output version information and exit")
24 print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
25 print "OEImage version %s" % __version__
27 def emit_oe(d, base_d = {}):
40 (opts, args) = getopt.getopt(sys.argv[1:], 'vr:t:', [ 'version', 'root=', 'type=' ])
41 except getopt.GetoptError:
45 opthash = getopthash(opts)
47 if '--version' in opthash or '-v' in opthash:
52 cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
54 fatal("Unable to open oe.conf")
58 fatal("Unable to open/parse conf/oe.conf")
61 rootfs = data.getVar('IMAGE_ROOTFS', cfg_oe, 1)
63 if '--root' in opthash:
64 rootfs = opthash['--root']
66 rootfs = opthash['-r']
68 if '--type' in opthash:
69 type = opthash['--type']
74 oe.fatal("IMAGE_ROOTFS not defined")
76 data.setVar('IMAGE_ROOTFS', rootfs, cfg_oe)
78 from copy import copy, deepcopy
79 localdata = deepcopy(cfg_oe)
81 overrides = data.getVar('OVERRIDES', localdata)
83 oe.fatal("OVERRIDES not defined.")
84 data.setVar('OVERRIDES', '%s:%s' % (overrides, type), localdata)
85 data.update_data(localdata)
86 data.setVar('OVERRIDES', overrides, localdata)
88 topdir = data.getVar('TOPDIR', localdata, 1) or os.getcwd()
90 cmd = data.getVar('IMAGE_CMD', localdata, 1)
92 oe.fatal("IMAGE_CMD not defined")
94 outdir = data.getVar('DEPLOY_DIR_IMAGE', localdata, 1)
96 oe.fatal('DEPLOY_DIR_IMAGE not defined')
99 #depends = data.getVar('IMAGE_DEPENDS', localdata, 1) or ""
101 # oe.note("Spawning oemake to satisfy dependencies: %s" % depends)
102 # ret = os.system('oemake %s' % depends)
104 # oe.error("executing oemake to satisfy dependencies")
106 oe.note("Executing %s" % cmd)
107 data.setVar('T', '${TMPDIR}', localdata)
108 data.setVar('image_cmd', cmd, localdata)
109 data.setVarFlag('image_cmd', 'func', 1, localdata)
111 oe.build.exec_func('image_cmd', localdata)
112 except oe.build.FuncFailed:
114 #ret = os.system(cmd)