1 inherit rootfs_${IMAGE_PKGTYPE}
3 # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
4 # in the non-Linux SDK_OS case, such as mingw32
5 SDKEXTCLASS ?= "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
8 TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
9 TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
10 POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_sysroot_relativelinks; "
14 DEPENDS += "${MLPREFIX}qemuwrapper-cross depmodwrapper-cross"
15 RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL}"
16 RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}"
18 INHIBIT_DEFAULT_DEPS = "1"
20 TESTIMAGECLASS = "${@base_conditional('TEST_IMAGE', '1', 'testimage-auto', '', d)}"
21 inherit ${TESTIMAGECLASS}
23 # IMAGE_FEATURES may contain any available package group
25 IMAGE_FEATURES[type] = "list"
26 IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password post-install-logging"
28 # Generate companion debugfs?
29 IMAGE_GEN_DEBUGFS ?= "0"
31 # rootfs bootstrap install
32 ROOTFS_BOOTSTRAP_INSTALL = "run-postinsts"
34 # These packages will be removed from a read-only rootfs after all other
35 # packages have been installed
36 ROOTFS_RO_UNNEEDED = "update-rc.d base-passwd shadow ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
38 # packages to install from features
39 FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
40 FEATURE_INSTALL[vardepvalue] = "${FEATURE_INSTALL}"
41 FEATURE_INSTALL_OPTIONAL = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
42 FEATURE_INSTALL_OPTIONAL[vardepvalue] = "${FEATURE_INSTALL_OPTIONAL}"
44 # Define some very basic feature package groups
45 FEATURE_PACKAGES_package-management = "${ROOTFS_PKGMANAGE}"
47 FEATURE_PACKAGES_splash = "${SPLASH}"
49 IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
51 def check_image_features(d):
52 valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems') or "").split()
53 valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys()
55 if var.startswith("PACKAGE_GROUP_"):
56 bb.warn("PACKAGE_GROUP is deprecated, please use FEATURE_PACKAGES instead")
57 valid_features.append(var[14:])
58 elif var.startswith("FEATURE_PACKAGES_"):
59 valid_features.append(var[17:])
62 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
63 for feature in features:
64 if feature not in valid_features:
65 if bb.utils.contains('EXTRA_IMAGE_FEATURES', feature, True, False, d):
66 raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES (added via EXTRA_IMAGE_FEATURES) is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
68 raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
71 IMAGE_INSTALL[type] = "list"
72 export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL} ${FEATURE_INSTALL}"
73 PACKAGE_INSTALL_ATTEMPTONLY ?= "${FEATURE_INSTALL_OPTIONAL}"
75 IMGDEPLOYDIR = "${WORKDIR}/deploy-${PN}-image-complete"
77 # Images are generally built explicitly, do not need to be part of world.
78 EXCLUDE_FROM_WORLD = "1"
83 PID = "${@os.getpid()}"
85 PACKAGE_ARCH = "${MACHINE_ARCH}"
87 LDCONFIGDEPEND ?= "ldconfig-native:do_populate_sysroot"
88 LDCONFIGDEPEND_libc-uclibc = ""
89 LDCONFIGDEPEND_libc-musl = ""
91 # This is needed to have depmod data in PKGDATA_DIR,
92 # but if you're building small initramfs image
93 # e.g. to include it in your kernel, you probably
94 # don't want this dependency, which is causing dependency loop
95 KERNELDEPMODDEPEND ?= "virtual/kernel:do_packagedata"
97 do_rootfs[depends] += " \
98 makedevs-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot ${LDCONFIGDEPEND} \
99 virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot \
100 ${KERNELDEPMODDEPEND} \
102 do_rootfs[recrdeptask] += "do_packagedata"
104 def rootfs_command_variables(d):
105 return ['ROOTFS_POSTPROCESS_COMMAND','ROOTFS_PREPROCESS_COMMAND','ROOTFS_POSTINSTALL_COMMAND','ROOTFS_POSTUNINSTALL_COMMAND','OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','IMAGE_POSTPROCESS_COMMAND',
106 'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS']
109 variables = rootfs_command_variables(d) + sdk_command_variables(d)
110 for var in variables:
111 if d.getVar(var, False):
112 d.setVarFlag(var, 'func', '1')
115 def rootfs_variables(d):
116 from oe.rootfs import variable_depends
117 variables = ['IMAGE_DEVICE_TABLE','IMAGE_DEVICE_TABLES','BUILD_IMAGES_FROM_FEEDS','IMAGE_TYPES_MASKED','IMAGE_ROOTFS_ALIGNMENT','IMAGE_OVERHEAD_FACTOR','IMAGE_ROOTFS_SIZE','IMAGE_ROOTFS_EXTRA_SPACE',
118 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS',
119 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
120 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
121 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY']
122 variables.extend(rootfs_command_variables(d))
123 variables.extend(variable_depends(d))
124 return " ".join(variables)
126 do_rootfs[vardeps] += "${@rootfs_variables(d)}"
128 do_build[depends] += "virtual/kernel:do_deploy"
131 if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg
132 d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d))
133 d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
134 if d.getVar('NOISO') == "0" or d.getVar('NOHDD') == "0":
139 IMAGE_TYPE_live = "${@build_live(d)}"
140 inherit ${IMAGE_TYPE_live}
142 IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vmdk.xz", "vdi", "qcow2", "hdddirect"], "image-vm", "", d)}'
144 inherit ${IMAGE_TYPE_vm}
146 IMAGE_TYPE_container = '${@bb.utils.contains("IMAGE_FSTYPES", "container", "image-container", "", d)}'
147 inherit ${IMAGE_TYPE_container}
150 if 'u-boot' in (d.getVar('IMAGE_FSTYPES') or ''):
151 return "image_types_uboot"
155 IMAGE_TYPE_uboot = "${@build_uboot(d)}"
156 inherit ${IMAGE_TYPE_uboot}
158 IMAGE_TYPE_wic = "image_types_wic"
159 inherit ${IMAGE_TYPE_wic}
162 def extraimage_getdepends(task):
164 for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
165 deps += " %s:%s" % (dep, task)
168 d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_lic'))
169 d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot'))
171 deps = " " + imagetypes_getdepends(d)
172 d.appendVarFlag('do_rootfs', 'depends', deps)
174 #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
175 #Check for replaces image features
176 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
177 remain_features = features.copy()
178 for feature in features:
179 replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
180 remain_features -= replaces
182 #Check for conflict image features
183 for feature in remain_features:
184 conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
185 temp = conflicts & remain_features
187 bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
189 d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
191 check_image_features(d)
192 initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
193 if initramfs_image != "":
194 d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN'))
195 d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image)
198 IMAGE_CLASSES += "image_types"
199 inherit ${IMAGE_CLASSES}
201 IMAGE_POSTPROCESS_COMMAND ?= ""
203 # some default locales
204 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
206 LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
208 # Prefer image, but use the fallback files for lookups if the image ones
209 # aren't yet available.
210 PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
212 inherit rootfs-postcommands
214 PACKAGE_EXCLUDE ??= ""
215 PACKAGE_EXCLUDE[type] = "list"
217 fakeroot python do_rootfs () {
218 from oe.rootfs import create_rootfs
219 from oe.manifest import create_manifest
222 logger = d.getVar('BB_TASK_LOGGER', False)
224 logcatcher = bb.utils.LogCatcher()
225 logger.addHandler(logcatcher)
229 # NOTE: if you add, remove or significantly refactor the stages of this
230 # process then you should recalculate the weightings here. This is quite
231 # easy to do - just change the MultiStageProgressReporter line temporarily
232 # to pass debug=True as the last parameter and you'll get a printout of
233 # the weightings as well as a map to the lines where next_stage() was
234 # called. Of course this isn't critical, but it helps to keep the progress
235 # reporting accurate.
236 stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
237 progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
238 progress_reporter.next_stage()
240 # Handle package exclusions
241 excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
242 inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
243 inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
245 d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
246 d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
248 for pkg in excl_pkgs:
250 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))
251 inst_pkgs.remove(pkg)
253 if pkg in inst_attempt_pkgs:
254 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))
255 inst_attempt_pkgs.remove(pkg)
257 d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
258 d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
260 # Ensure we handle package name remapping
261 # We have to delay the runtime_mapping_rename until just before rootfs runs
262 # otherwise, the multilib renaming could step in and squash any fixups that
265 runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
266 runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
267 runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
269 # Generate the initial manifest
272 progress_reporter.next_stage()
275 create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
277 progress_reporter.finish()
279 do_rootfs[dirs] = "${TOPDIR}"
280 do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
281 do_rootfs[umask] = "022"
282 addtask rootfs before do_build after do_prepare_recipe_sysroot
284 fakeroot python do_image () {
285 from oe.utils import execute_pre_post_process
287 pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
289 execute_pre_post_process(d, pre_process_cmds)
291 do_image[dirs] = "${TOPDIR}"
292 do_image[umask] = "022"
293 addtask do_image after do_rootfs before do_build
295 fakeroot python do_image_complete () {
296 from oe.utils import execute_pre_post_process
298 post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
300 execute_pre_post_process(d, post_process_cmds)
302 do_image_complete[dirs] = "${TOPDIR}"
303 do_image_complete[umask] = "022"
304 SSTATETASKS += "do_image_complete"
305 SSTATE_SKIP_CREATION_task-image-complete = '1'
306 do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
307 do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
308 do_image_complete[stamp-extra-info] = "${MACHINE}"
309 addtask do_image_complete after do_image before do_build
311 # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
313 # IMAGE_QA_COMMANDS += " \
314 # image_check_everything_ok \
316 # This task runs all functions in IMAGE_QA_COMMANDS after the image
317 # construction has completed in order to validate the resulting image.
318 fakeroot python do_image_qa () {
319 from oe.utils import ImageQAFailed
321 qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
326 bb.build.exec_func(cmd, d)
327 except oe.utils.ImageQAFailed as e:
328 qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
329 except bb.build.FuncFailed as e:
330 qamsg = qamsg + '\tImage QA function %s failed' % e.name
332 qamsg = qamsg + ' (log file is located at %s)' % e.logfile
336 imgname = d.getVar('IMAGE_NAME')
337 bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
339 addtask do_image_qa after do_image_complete before do_build
341 def setup_debugfs_variables(d):
342 d.appendVar('IMAGE_ROOTFS', '-dbg')
343 d.appendVar('IMAGE_LINK_NAME', '-dbg')
344 d.appendVar('IMAGE_NAME','-dbg')
345 d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
346 debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
347 if debugfs_image_fstypes:
348 d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
350 python setup_debugfs () {
351 setup_debugfs_variables(d)
356 # We allow CONVERSIONTYPES to have duplicates. That avoids breaking
357 # derived distros when OE-core or some other layer independently adds
358 # the same type. There is still only one command for each type, but
359 # presumably the commands will do the same when the type is the same,
360 # even when added in different places.
362 # Without de-duplication, gen_conversion_cmds() below
363 # would create the same compression command multiple times.
364 ctypes = set(d.getVar('CONVERSIONTYPES').split())
365 old_overrides = d.getVar('OVERRIDES', False)
367 def _image_base_type(type):
370 if type.endswith("." + ctype):
371 basetype = type[:-len("." + ctype)]
375 # New base type itself might be generated by a conversion command.
376 basetype = _image_base_type(basetype)
381 alltypes = d.getVar('IMAGE_FSTYPES').split()
384 if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
385 debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
386 for t in debugfs_fstypes:
387 alltypes.append("debugfs_" + t)
390 baset = _image_base_type(t)
392 if baset not in basetypes:
394 if t not in basetypes[baset]:
395 basetypes[baset].append(t)
397 if t.startswith("debugfs_"):
400 deps = (d.getVar('IMAGE_TYPEDEP_' + t) or "").split()
401 vardeps.add('IMAGE_TYPEDEP_' + t)
402 if baset not in typedeps:
403 typedeps[baset] = set()
404 deps = [debug + dep for dep in deps]
406 if dep not in alltypes:
409 basedep = _image_base_type(dep)
410 typedeps[baset].add(basedep)
415 for t in alltypes[:]:
418 d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
420 maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
421 maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
432 localdata = bb.data.createCopy(d)
434 if t.startswith("debugfs_"):
435 setup_debugfs_variables(localdata)
436 debug = "setup_debugfs "
438 localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides))
439 localdata.setVar('type', realt)
440 # Delete DATETIME so we don't expand any references to it now
441 # This means the task's hash can be stable rather than having hardcoded
442 # date/time values. It will get expanded at execution time.
443 # Similarly TMPDIR since otherwise we see QA stamp comparision problems
444 localdata.delVar('DATETIME')
445 localdata.delVar('TMPDIR')
447 image_cmd = localdata.getVar("IMAGE_CMD")
448 vardeps.add('IMAGE_CMD_' + realt)
450 cmds.append("\t" + image_cmd)
452 bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
453 cmds.append(localdata.expand("\tcd ${IMGDEPLOYDIR}"))
455 # Since a copy of IMAGE_CMD_xxx will be inlined within do_image_xxx,
456 # prevent a redundant copy of IMAGE_CMD_xxx being emitted as a function.
457 d.delVarFlag('IMAGE_CMD_' + realt, 'func')
459 rm_tmp_images = set()
460 def gen_conversion_cmds(bt):
461 for ctype in sorted(ctypes):
462 if bt.endswith("." + ctype):
463 type = bt[0:-len(ctype) - 1]
464 if type.startswith("debugfs_"):
466 # Create input image first.
467 gen_conversion_cmds(type)
468 localdata.setVar('type', type)
469 cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype) or localdata.getVar("COMPRESS_CMD_" + ctype))
472 vardeps.add('CONVERSION_CMD_' + ctype)
473 vardeps.add('COMPRESS_CMD_' + ctype)
474 subimage = type + "." + ctype
475 if subimage not in subimages:
476 subimages.append(subimage)
477 if type not in alltypes:
478 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
480 for bt in basetypes[t]:
481 gen_conversion_cmds(bt)
483 localdata.setVar('type', realt)
484 if t not in alltypes:
485 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
487 subimages.append(realt)
489 # Clean up after applying all conversion commands. Some of them might
490 # use the same input, therefore we cannot delete sooner without applying
491 # some complex dependency analysis.
492 for image in sorted(rm_tmp_images):
493 cmds.append("\trm " + image)
496 for dep in typedeps[t]:
497 after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")
499 t = t.replace("-", "_").replace(".", "_")
501 d.setVar('do_image_%s' % t, '\n'.join(cmds))
502 d.setVarFlag('do_image_%s' % t, 'func', '1')
503 d.setVarFlag('do_image_%s' % t, 'fakeroot', '1')
504 d.setVarFlag('do_image_%s' % t, 'prefuncs', debug + 'set_image_size')
505 d.setVarFlag('do_image_%s' % t, 'postfuncs', 'create_symlinks')
506 d.setVarFlag('do_image_%s' % t, 'subimages', ' '.join(subimages))
507 d.appendVarFlag('do_image_%s' % t, 'vardeps', ' '.join(vardeps))
508 d.appendVarFlag('do_image_%s' % t, 'vardepsexclude', 'DATETIME')
510 bb.debug(2, "Adding type %s before %s, after %s" % (t, 'do_image_complete', after))
511 bb.build.addtask('do_image_%s' % t, 'do_image_complete', after, d)
515 # Compute the rootfs size
517 def get_rootfs_size(d):
520 rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
521 overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
522 rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
523 rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
524 rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
525 image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
526 initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
527 initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
529 output = subprocess.check_output(['du', '-ks',
530 d.getVar('IMAGE_ROOTFS')])
531 size_kb = int(output.split()[0])
532 base_size = size_kb * overhead_factor
533 base_size = max(base_size, rootfs_req_size) + rootfs_extra_space
535 if base_size != int(base_size):
536 base_size = int(base_size + 1)
538 base_size = int(base_size)
540 base_size += rootfs_alignment - 1
541 base_size -= base_size % rootfs_alignment
543 # Do not check image size of the debugfs image. This is not supposed
544 # to be deployed, etc. so it doesn't make sense to limit the size
546 if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
549 # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
551 rootfs_maxsize_int = int(rootfs_maxsize)
552 if base_size > rootfs_maxsize_int:
553 bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
554 (base_size, rootfs_maxsize_int))
556 # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
557 if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
558 initramfs_maxsize_int = int(initramfs_maxsize)
559 if base_size > initramfs_maxsize_int:
560 bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \
561 (base_size, initramfs_maxsize_int))
562 bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
563 bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
566 python set_image_size () {
567 rootfs_size = get_rootfs_size(d)
568 d.setVar('ROOTFS_SIZE', str(rootfs_size))
569 d.setVarFlag('ROOTFS_SIZE', 'export', '1')
573 # Create symlinks to the newly created image
575 python create_symlinks() {
577 deploy_dir = d.getVar('IMGDEPLOYDIR')
578 img_name = d.getVar('IMAGE_NAME')
579 link_name = d.getVar('IMAGE_LINK_NAME')
580 manifest_name = d.getVar('IMAGE_MANIFEST')
581 taskname = d.getVar("BB_CURRENTTASK")
582 subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
583 imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.")
587 for type in subimages:
588 dst = os.path.join(deploy_dir, link_name + "." + type)
589 src = img_name + imgsuffix + type
590 if os.path.exists(os.path.join(deploy_dir, src)):
591 bb.note("Creating symlink: %s -> %s" % (dst, src))
592 if os.path.islink(dst):
596 bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
599 MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"
600 MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
601 MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
603 do_fetch[noexec] = "1"
604 do_unpack[noexec] = "1"
605 do_patch[noexec] = "1"
606 do_configure[noexec] = "1"
607 do_compile[noexec] = "1"
608 do_install[noexec] = "1"
609 deltask do_populate_sysroot
610 do_package[noexec] = "1"
611 deltask do_package_qa
612 do_packagedata[noexec] = "1"
613 do_package_write_ipk[noexec] = "1"
614 do_package_write_deb[noexec] = "1"
615 do_package_write_rpm[noexec] = "1"
617 # Allow the kernel to be repacked with the initramfs and boot image file as a single file
618 do_bundle_initramfs[depends] += "virtual/kernel:do_bundle_initramfs"
619 do_bundle_initramfs[nostamp] = "1"
620 do_bundle_initramfs[noexec] = "1"
621 do_bundle_initramfs () {
624 addtask bundle_initramfs after do_image_complete