summaryrefslogtreecommitdiffstats
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r--meta/classes/image.bbclass96
1 files changed, 48 insertions, 48 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index e63f6a3bfe..28bff9e75a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -2,7 +2,7 @@ inherit rootfs_${IMAGE_PKGTYPE}
2 2
3# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk 3# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk
4# in the non-Linux SDK_OS case, such as mingw32 4# in the non-Linux SDK_OS case, such as mingw32
5SDKEXTCLASS ?= "${@['populate_sdk', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS", True)]}" 5SDKEXTCLASS ?= "${@['populate_sdk', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
6inherit ${SDKEXTCLASS} 6inherit ${SDKEXTCLASS}
7 7
8TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}" 8TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
@@ -133,7 +133,7 @@ def build_live(d):
133 if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg 133 if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg
134 d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d)) 134 d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d))
135 d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d)) 135 d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
136 if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True) == "0": 136 if d.getVar('NOISO') == "0" or d.getVar('NOHDD') == "0":
137 return "image-live" 137 return "image-live"
138 return "" 138 return ""
139 return "image-live" 139 return "image-live"
@@ -145,7 +145,7 @@ IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow
145inherit ${IMAGE_TYPE_vm} 145inherit ${IMAGE_TYPE_vm}
146 146
147def build_uboot(d): 147def build_uboot(d):
148 if 'u-boot' in (d.getVar('IMAGE_FSTYPES', True) or ''): 148 if 'u-boot' in (d.getVar('IMAGE_FSTYPES') or ''):
149 return "image_types_uboot" 149 return "image_types_uboot"
150 else: 150 else:
151 return "" 151 return ""
@@ -158,7 +158,7 @@ python () {
158 d.appendVarFlag('do_rootfs', 'depends', deps) 158 d.appendVarFlag('do_rootfs', 'depends', deps)
159 159
160 deps = "" 160 deps = ""
161 for dep in (d.getVar('EXTRA_IMAGEDEPENDS', True) or "").split(): 161 for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
162 deps += " %s:do_populate_sysroot" % dep 162 deps += " %s:do_populate_sysroot" % dep
163 d.appendVarFlag('do_build', 'depends', deps) 163 d.appendVarFlag('do_build', 'depends', deps)
164 164
@@ -167,22 +167,22 @@ python () {
167 features = set(oe.data.typed_value('IMAGE_FEATURES', d)) 167 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
168 remain_features = features.copy() 168 remain_features = features.copy()
169 for feature in features: 169 for feature in features:
170 replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) 170 replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
171 remain_features -= replaces 171 remain_features -= replaces
172 172
173 #Check for conflict image features 173 #Check for conflict image features
174 for feature in remain_features: 174 for feature in remain_features:
175 conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) 175 conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
176 temp = conflicts & remain_features 176 temp = conflicts & remain_features
177 if temp: 177 if temp:
178 bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp)))) 178 bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
179 179
180 d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features)))) 180 d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
181 181
182 check_image_features(d) 182 check_image_features(d)
183 initramfs_image = d.getVar('INITRAMFS_IMAGE', True) or "" 183 initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
184 if initramfs_image != "": 184 if initramfs_image != "":
185 d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN', True)) 185 d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN'))
186 d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image) 186 d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image)
187} 187}
188 188
@@ -194,7 +194,7 @@ IMAGE_POSTPROCESS_COMMAND ?= ""
194# some default locales 194# some default locales
195IMAGE_LINGUAS ?= "de-de fr-fr en-gb" 195IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
196 196
197LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS', True).split()))}" 197LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
198 198
199# Prefer image, but use the fallback files for lookups if the image ones 199# Prefer image, but use the fallback files for lookups if the image ones
200# aren't yet available. 200# aren't yet available.
@@ -229,20 +229,20 @@ fakeroot python do_rootfs () {
229 progress_reporter.next_stage() 229 progress_reporter.next_stage()
230 230
231 # Handle package exclusions 231 # Handle package exclusions
232 excl_pkgs = d.getVar("PACKAGE_EXCLUDE", True).split() 232 excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
233 inst_pkgs = d.getVar("PACKAGE_INSTALL", True).split() 233 inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
234 inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY", True).split() 234 inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
235 235
236 d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) 236 d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
237 d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) 237 d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
238 238
239 for pkg in excl_pkgs: 239 for pkg in excl_pkgs:
240 if pkg in inst_pkgs: 240 if pkg in inst_pkgs:
241 bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN', True), inst_pkgs)) 241 bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
242 inst_pkgs.remove(pkg) 242 inst_pkgs.remove(pkg)
243 243
244 if pkg in inst_attempt_pkgs: 244 if pkg in inst_attempt_pkgs:
245 bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN', True), inst_pkgs)) 245 bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
246 inst_attempt_pkgs.remove(pkg) 246 inst_attempt_pkgs.remove(pkg)
247 247
248 d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) 248 d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
@@ -252,7 +252,7 @@ fakeroot python do_rootfs () {
252 # We have to delay the runtime_mapping_rename until just before rootfs runs 252 # We have to delay the runtime_mapping_rename until just before rootfs runs
253 # otherwise, the multilib renaming could step in and squash any fixups that 253 # otherwise, the multilib renaming could step in and squash any fixups that
254 # may have occurred. 254 # may have occurred.
255 pn = d.getVar('PN', True) 255 pn = d.getVar('PN')
256 runtime_mapping_rename("PACKAGE_INSTALL", pn, d) 256 runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
257 runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) 257 runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
258 runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) 258 runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
@@ -275,7 +275,7 @@ addtask rootfs before do_build
275fakeroot python do_image () { 275fakeroot python do_image () {
276 from oe.utils import execute_pre_post_process 276 from oe.utils import execute_pre_post_process
277 277
278 pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND", True) 278 pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
279 279
280 execute_pre_post_process(d, pre_process_cmds) 280 execute_pre_post_process(d, pre_process_cmds)
281} 281}
@@ -286,7 +286,7 @@ addtask do_image after do_rootfs before do_build
286fakeroot python do_image_complete () { 286fakeroot python do_image_complete () {
287 from oe.utils import execute_pre_post_process 287 from oe.utils import execute_pre_post_process
288 288
289 post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND", True) 289 post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
290 290
291 execute_pre_post_process(d, post_process_cmds) 291 execute_pre_post_process(d, post_process_cmds)
292} 292}
@@ -309,7 +309,7 @@ addtask do_image_complete after do_image before do_build
309fakeroot python do_image_qa () { 309fakeroot python do_image_qa () {
310 from oe.utils import ImageQAFailed 310 from oe.utils import ImageQAFailed
311 311
312 qa_cmds = (d.getVar('IMAGE_QA_COMMANDS', True) or '').split() 312 qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
313 qamsg = "" 313 qamsg = ""
314 314
315 for cmd in qa_cmds: 315 for cmd in qa_cmds:
@@ -324,7 +324,7 @@ fakeroot python do_image_qa () {
324 qamsg = qamsg + '\n' 324 qamsg = qamsg + '\n'
325 325
326 if qamsg: 326 if qamsg:
327 imgname = d.getVar('IMAGE_NAME', True) 327 imgname = d.getVar('IMAGE_NAME')
328 bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg)) 328 bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
329} 329}
330addtask do_image_qa after do_image_complete before do_build 330addtask do_image_qa after do_image_complete before do_build
@@ -334,17 +334,17 @@ addtask do_image_qa after do_image_complete before do_build
334# to tmp/sysroots/<machine>/imgdata/<image>.env 334# to tmp/sysroots/<machine>/imgdata/<image>.env
335# 335#
336python do_rootfs_wicenv () { 336python do_rootfs_wicenv () {
337 wicvars = d.getVar('WICVARS', True) 337 wicvars = d.getVar('WICVARS')
338 if not wicvars: 338 if not wicvars:
339 return 339 return
340 340
341 stdir = d.getVar('STAGING_DIR_TARGET', True) 341 stdir = d.getVar('STAGING_DIR_TARGET')
342 outdir = os.path.join(stdir, 'imgdata') 342 outdir = os.path.join(stdir, 'imgdata')
343 bb.utils.mkdirhier(outdir) 343 bb.utils.mkdirhier(outdir)
344 basename = d.getVar('IMAGE_BASENAME', True) 344 basename = d.getVar('IMAGE_BASENAME')
345 with open(os.path.join(outdir, basename) + '.env', 'w') as envf: 345 with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
346 for var in wicvars.split(): 346 for var in wicvars.split():
347 value = d.getVar(var, True) 347 value = d.getVar(var)
348 if value: 348 if value:
349 envf.write('%s="%s"\n' % (var, value.strip())) 349 envf.write('%s="%s"\n' % (var, value.strip()))
350} 350}
@@ -357,7 +357,7 @@ def setup_debugfs_variables(d):
357 d.appendVar('IMAGE_LINK_NAME', '-dbg') 357 d.appendVar('IMAGE_LINK_NAME', '-dbg')
358 d.appendVar('IMAGE_NAME','-dbg') 358 d.appendVar('IMAGE_NAME','-dbg')
359 d.setVar('IMAGE_BUILDING_DEBUGFS', 'true') 359 d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
360 debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS', True) 360 debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
361 if debugfs_image_fstypes: 361 if debugfs_image_fstypes:
362 d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes) 362 d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
363 363
@@ -375,7 +375,7 @@ python () {
375 # 375 #
376 # Without de-duplication, gen_conversion_cmds() below 376 # Without de-duplication, gen_conversion_cmds() below
377 # would create the same compression command multiple times. 377 # would create the same compression command multiple times.
378 ctypes = set(d.getVar('CONVERSIONTYPES', True).split()) 378 ctypes = set(d.getVar('CONVERSIONTYPES').split())
379 old_overrides = d.getVar('OVERRIDES', False) 379 old_overrides = d.getVar('OVERRIDES', False)
380 380
381 def _image_base_type(type): 381 def _image_base_type(type):
@@ -392,11 +392,11 @@ python () {
392 return basetype 392 return basetype
393 393
394 basetypes = {} 394 basetypes = {}
395 alltypes = d.getVar('IMAGE_FSTYPES', True).split() 395 alltypes = d.getVar('IMAGE_FSTYPES').split()
396 typedeps = {} 396 typedeps = {}
397 397
398 if d.getVar('IMAGE_GEN_DEBUGFS', True) == "1": 398 if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
399 debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS', True).split() 399 debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
400 for t in debugfs_fstypes: 400 for t in debugfs_fstypes:
401 alltypes.append("debugfs_" + t) 401 alltypes.append("debugfs_" + t)
402 402
@@ -411,7 +411,7 @@ python () {
411 if t.startswith("debugfs_"): 411 if t.startswith("debugfs_"):
412 t = t[8:] 412 t = t[8:]
413 debug = "debugfs_" 413 debug = "debugfs_"
414 deps = (d.getVar('IMAGE_TYPEDEP_' + t, True) or "").split() 414 deps = (d.getVar('IMAGE_TYPEDEP_' + t) or "").split()
415 vardeps.add('IMAGE_TYPEDEP_' + t) 415 vardeps.add('IMAGE_TYPEDEP_' + t)
416 if baset not in typedeps: 416 if baset not in typedeps:
417 typedeps[baset] = set() 417 typedeps[baset] = set()
@@ -431,7 +431,7 @@ python () {
431 431
432 d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps)) 432 d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
433 433
434 maskedtypes = (d.getVar('IMAGE_TYPES_MASKED', True) or "").split() 434 maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
435 maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")] 435 maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
436 436
437 for t in basetypes: 437 for t in basetypes:
@@ -459,7 +459,7 @@ python () {
459 localdata.delVar('DATETIME') 459 localdata.delVar('DATETIME')
460 localdata.delVar('TMPDIR') 460 localdata.delVar('TMPDIR')
461 461
462 image_cmd = localdata.getVar("IMAGE_CMD", True) 462 image_cmd = localdata.getVar("IMAGE_CMD")
463 vardeps.add('IMAGE_CMD_' + realt) 463 vardeps.add('IMAGE_CMD_' + realt)
464 if image_cmd: 464 if image_cmd:
465 cmds.append("\t" + image_cmd) 465 cmds.append("\t" + image_cmd)
@@ -481,7 +481,7 @@ python () {
481 # Create input image first. 481 # Create input image first.
482 gen_conversion_cmds(type) 482 gen_conversion_cmds(type)
483 localdata.setVar('type', type) 483 localdata.setVar('type', type)
484 cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype, True) or localdata.getVar("COMPRESS_CMD_" + ctype, True)) 484 cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype) or localdata.getVar("COMPRESS_CMD_" + ctype))
485 if cmd not in cmds: 485 if cmd not in cmds:
486 cmds.append(cmd) 486 cmds.append(cmd)
487 vardeps.add('CONVERSION_CMD_' + ctype) 487 vardeps.add('CONVERSION_CMD_' + ctype)
@@ -532,17 +532,17 @@ python () {
532def get_rootfs_size(d): 532def get_rootfs_size(d):
533 import subprocess 533 import subprocess
534 534
535 rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT', True)) 535 rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
536 overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR', True)) 536 overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
537 rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True)) 537 rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
538 rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True)) 538 rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
539 rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True) 539 rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
540 image_fstypes = d.getVar('IMAGE_FSTYPES', True) or '' 540 image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
541 initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or '' 541 initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
542 initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True) 542 initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
543 543
544 output = subprocess.check_output(['du', '-ks', 544 output = subprocess.check_output(['du', '-ks',
545 d.getVar('IMAGE_ROOTFS', True)]) 545 d.getVar('IMAGE_ROOTFS')])
546 size_kb = int(output.split()[0]) 546 size_kb = int(output.split()[0])
547 base_size = size_kb * overhead_factor 547 base_size = size_kb * overhead_factor
548 base_size = max(base_size, rootfs_req_size) + rootfs_extra_space 548 base_size = max(base_size, rootfs_req_size) + rootfs_extra_space
@@ -558,7 +558,7 @@ def get_rootfs_size(d):
558 # Do not check image size of the debugfs image. This is not supposed 558 # Do not check image size of the debugfs image. This is not supposed
559 # to be deployed, etc. so it doesn't make sense to limit the size 559 # to be deployed, etc. so it doesn't make sense to limit the size
560 # of the debug. 560 # of the debug.
561 if (d.getVar('IMAGE_BUILDING_DEBUGFS', True) or "") == "true": 561 if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
562 return base_size 562 return base_size
563 563
564 # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set) 564 # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
@@ -589,11 +589,11 @@ python set_image_size () {
589# 589#
590python create_symlinks() { 590python create_symlinks() {
591 591
592 deploy_dir = d.getVar('IMGDEPLOYDIR', True) 592 deploy_dir = d.getVar('IMGDEPLOYDIR')
593 img_name = d.getVar('IMAGE_NAME', True) 593 img_name = d.getVar('IMAGE_NAME')
594 link_name = d.getVar('IMAGE_LINK_NAME', True) 594 link_name = d.getVar('IMAGE_LINK_NAME')
595 manifest_name = d.getVar('IMAGE_MANIFEST', True) 595 manifest_name = d.getVar('IMAGE_MANIFEST')
596 taskname = d.getVar("BB_CURRENTTASK", True) 596 taskname = d.getVar("BB_CURRENTTASK")
597 subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split() 597 subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
598 imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix', True) or d.expand("${IMAGE_NAME_SUFFIX}.") 598 imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix', True) or d.expand("${IMAGE_NAME_SUFFIX}.")
599 599