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 deps = " " + imagetypes_getdepends(d)
163 d.appendVarFlag('do_rootfs', 'depends', deps)
166 for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
167 deps += " %s:do_populate_sysroot" % dep
168 d.appendVarFlag('do_image_complete', 'depends', deps)
170 #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
171 #Check for replaces image features
172 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
173 remain_features = features.copy()
174 for feature in features:
175 replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
176 remain_features -= replaces
178 #Check for conflict image features
179 for feature in remain_features:
180 conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
181 temp = conflicts & remain_features
183 bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
185 d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
187 check_image_features(d)
188 initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
189 if initramfs_image != "":
190 d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN'))
191 d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image)
194 IMAGE_CLASSES += "image_types"
195 inherit ${IMAGE_CLASSES}
197 IMAGE_POSTPROCESS_COMMAND ?= ""
199 # some default locales
200 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
202 LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
204 # Prefer image, but use the fallback files for lookups if the image ones
205 # aren't yet available.
206 PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
208 inherit rootfs-postcommands
210 PACKAGE_EXCLUDE ??= ""
211 PACKAGE_EXCLUDE[type] = "list"
213 fakeroot python do_rootfs () {
214 from oe.rootfs import create_rootfs
215 from oe.manifest import create_manifest
218 logger = d.getVar('BB_TASK_LOGGER', False)
220 logcatcher = bb.utils.LogCatcher()
221 logger.addHandler(logcatcher)
225 # NOTE: if you add, remove or significantly refactor the stages of this
226 # process then you should recalculate the weightings here. This is quite
227 # easy to do - just change the MultiStageProgressReporter line temporarily
228 # to pass debug=True as the last parameter and you'll get a printout of
229 # the weightings as well as a map to the lines where next_stage() was
230 # called. Of course this isn't critical, but it helps to keep the progress
231 # reporting accurate.
232 stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
233 progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
234 progress_reporter.next_stage()
236 # Handle package exclusions
237 excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
238 inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
239 inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
241 d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
242 d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
244 for pkg in excl_pkgs:
246 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))
247 inst_pkgs.remove(pkg)
249 if pkg in inst_attempt_pkgs:
250 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))
251 inst_attempt_pkgs.remove(pkg)
253 d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
254 d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
256 # Ensure we handle package name remapping
257 # We have to delay the runtime_mapping_rename until just before rootfs runs
258 # otherwise, the multilib renaming could step in and squash any fixups that
261 runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
262 runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
263 runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
265 # Generate the initial manifest
268 progress_reporter.next_stage()
271 create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
273 progress_reporter.finish()
275 do_rootfs[dirs] = "${TOPDIR}"
276 do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
277 do_rootfs[umask] = "022"
278 addtask rootfs before do_build after do_prepare_recipe_sysroot
280 fakeroot python do_image () {
281 from oe.utils import execute_pre_post_process
283 pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
285 execute_pre_post_process(d, pre_process_cmds)
287 do_image[dirs] = "${TOPDIR}"
288 do_image[umask] = "022"
289 addtask do_image after do_rootfs before do_build
291 fakeroot python do_image_complete () {
292 from oe.utils import execute_pre_post_process
294 post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
296 execute_pre_post_process(d, post_process_cmds)
298 do_image_complete[dirs] = "${TOPDIR}"
299 do_image_complete[umask] = "022"
300 SSTATETASKS += "do_image_complete"
301 SSTATE_SKIP_CREATION_task-image-complete = '1'
302 do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
303 do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
304 do_image_complete[stamp-extra-info] = "${MACHINE}"
305 addtask do_image_complete after do_image before do_build
307 # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
309 # IMAGE_QA_COMMANDS += " \
310 # image_check_everything_ok \
312 # This task runs all functions in IMAGE_QA_COMMANDS after the image
313 # construction has completed in order to validate the resulting image.
314 fakeroot python do_image_qa () {
315 from oe.utils import ImageQAFailed
317 qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
322 bb.build.exec_func(cmd, d)
323 except oe.utils.ImageQAFailed as e:
324 qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
325 except bb.build.FuncFailed as e:
326 qamsg = qamsg + '\tImage QA function %s failed' % e.name
328 qamsg = qamsg + ' (log file is located at %s)' % e.logfile
332 imgname = d.getVar('IMAGE_NAME')
333 bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
335 addtask do_image_qa after do_image_complete before do_build
337 def setup_debugfs_variables(d):
338 d.appendVar('IMAGE_ROOTFS', '-dbg')
339 d.appendVar('IMAGE_LINK_NAME', '-dbg')
340 d.appendVar('IMAGE_NAME','-dbg')
341 d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
342 debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
343 if debugfs_image_fstypes:
344 d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
346 python setup_debugfs () {
347 setup_debugfs_variables(d)
352 # We allow CONVERSIONTYPES to have duplicates. That avoids breaking
353 # derived distros when OE-core or some other layer independently adds
354 # the same type. There is still only one command for each type, but
355 # presumably the commands will do the same when the type is the same,
356 # even when added in different places.
358 # Without de-duplication, gen_conversion_cmds() below
359 # would create the same compression command multiple times.
360 ctypes = set(d.getVar('CONVERSIONTYPES').split())
361 old_overrides = d.getVar('OVERRIDES', False)
363 def _image_base_type(type):
366 if type.endswith("." + ctype):
367 basetype = type[:-len("." + ctype)]
371 # New base type itself might be generated by a conversion command.
372 basetype = _image_base_type(basetype)
377 alltypes = d.getVar('IMAGE_FSTYPES').split()
380 if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
381 debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
382 for t in debugfs_fstypes:
383 alltypes.append("debugfs_" + t)
386 baset = _image_base_type(t)
388 if baset not in basetypes:
390 if t not in basetypes[baset]:
391 basetypes[baset].append(t)
393 if t.startswith("debugfs_"):
396 deps = (d.getVar('IMAGE_TYPEDEP_' + t) or "").split()
397 vardeps.add('IMAGE_TYPEDEP_' + t)
398 if baset not in typedeps:
399 typedeps[baset] = set()
400 deps = [debug + dep for dep in deps]
402 if dep not in alltypes:
405 basedep = _image_base_type(dep)
406 typedeps[baset].add(basedep)
411 for t in alltypes[:]:
414 d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
416 maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
417 maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
428 localdata = bb.data.createCopy(d)
430 if t.startswith("debugfs_"):
431 setup_debugfs_variables(localdata)
432 debug = "setup_debugfs "
434 localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides))
435 localdata.setVar('type', realt)
436 # Delete DATETIME so we don't expand any references to it now
437 # This means the task's hash can be stable rather than having hardcoded
438 # date/time values. It will get expanded at execution time.
439 # Similarly TMPDIR since otherwise we see QA stamp comparision problems
440 localdata.delVar('DATETIME')
441 localdata.delVar('TMPDIR')
443 image_cmd = localdata.getVar("IMAGE_CMD")
444 vardeps.add('IMAGE_CMD_' + realt)
446 cmds.append("\t" + image_cmd)
448 bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
449 cmds.append(localdata.expand("\tcd ${IMGDEPLOYDIR}"))
451 # Since a copy of IMAGE_CMD_xxx will be inlined within do_image_xxx,
452 # prevent a redundant copy of IMAGE_CMD_xxx being emitted as a function.
453 d.delVarFlag('IMAGE_CMD_' + realt, 'func')
455 rm_tmp_images = set()
456 def gen_conversion_cmds(bt):
458 if bt[bt.find('.') + 1:] == ctype:
459 type = bt[0:-len(ctype) - 1]
460 if type.startswith("debugfs_"):
462 # Create input image first.
463 gen_conversion_cmds(type)
464 localdata.setVar('type', type)
465 cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype) or localdata.getVar("COMPRESS_CMD_" + ctype))
468 vardeps.add('CONVERSION_CMD_' + ctype)
469 vardeps.add('COMPRESS_CMD_' + ctype)
470 subimage = type + "." + ctype
471 if subimage not in subimages:
472 subimages.append(subimage)
473 if type not in alltypes:
474 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
476 for bt in basetypes[t]:
477 gen_conversion_cmds(bt)
479 localdata.setVar('type', realt)
480 if t not in alltypes:
481 rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
483 subimages.append(realt)
485 # Clean up after applying all conversion commands. Some of them might
486 # use the same input, therefore we cannot delete sooner without applying
487 # some complex dependency analysis.
488 for image in rm_tmp_images:
489 cmds.append("\trm " + image)
492 for dep in typedeps[t]:
493 after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")
495 t = t.replace("-", "_").replace(".", "_")
497 d.setVar('do_image_%s' % t, '\n'.join(cmds))
498 d.setVarFlag('do_image_%s' % t, 'func', '1')
499 d.setVarFlag('do_image_%s' % t, 'fakeroot', '1')
500 d.setVarFlag('do_image_%s' % t, 'prefuncs', debug + 'set_image_size')
501 d.setVarFlag('do_image_%s' % t, 'postfuncs', 'create_symlinks')
502 d.setVarFlag('do_image_%s' % t, 'subimages', ' '.join(subimages))
503 d.appendVarFlag('do_image_%s' % t, 'vardeps', ' '.join(vardeps))
504 d.appendVarFlag('do_image_%s' % t, 'vardepsexclude', 'DATETIME')
506 bb.debug(2, "Adding type %s before %s, after %s" % (t, 'do_image_complete', after))
507 bb.build.addtask('do_image_%s' % t, 'do_image_complete', after, d)
511 # Compute the rootfs size
513 def get_rootfs_size(d):
516 rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
517 overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
518 rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
519 rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
520 rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
521 image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
522 initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
523 initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
525 output = subprocess.check_output(['du', '-ks',
526 d.getVar('IMAGE_ROOTFS')])
527 size_kb = int(output.split()[0])
528 base_size = size_kb * overhead_factor
529 base_size = max(base_size, rootfs_req_size) + rootfs_extra_space
531 if base_size != int(base_size):
532 base_size = int(base_size + 1)
534 base_size = int(base_size)
536 base_size += rootfs_alignment - 1
537 base_size -= base_size % rootfs_alignment
539 # Do not check image size of the debugfs image. This is not supposed
540 # to be deployed, etc. so it doesn't make sense to limit the size
542 if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
545 # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
547 rootfs_maxsize_int = int(rootfs_maxsize)
548 if base_size > rootfs_maxsize_int:
549 bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
550 (base_size, rootfs_maxsize_int))
552 # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
553 if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
554 initramfs_maxsize_int = int(initramfs_maxsize)
555 if base_size > initramfs_maxsize_int:
556 bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \
557 (base_size, initramfs_maxsize_int))
558 bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
559 bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
562 python set_image_size () {
563 rootfs_size = get_rootfs_size(d)
564 d.setVar('ROOTFS_SIZE', str(rootfs_size))
565 d.setVarFlag('ROOTFS_SIZE', 'export', '1')
569 # Create symlinks to the newly created image
571 python create_symlinks() {
573 deploy_dir = d.getVar('IMGDEPLOYDIR')
574 img_name = d.getVar('IMAGE_NAME')
575 link_name = d.getVar('IMAGE_LINK_NAME')
576 manifest_name = d.getVar('IMAGE_MANIFEST')
577 taskname = d.getVar("BB_CURRENTTASK")
578 subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
579 imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.")
583 for type in subimages:
584 dst = os.path.join(deploy_dir, link_name + "." + type)
585 src = img_name + imgsuffix + type
586 if os.path.exists(os.path.join(deploy_dir, src)):
587 bb.note("Creating symlink: %s -> %s" % (dst, src))
588 if os.path.islink(dst):
592 bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
595 MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"
596 MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
597 MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
599 do_fetch[noexec] = "1"
600 do_unpack[noexec] = "1"
601 do_patch[noexec] = "1"
602 do_configure[noexec] = "1"
603 do_compile[noexec] = "1"
604 do_install[noexec] = "1"
605 deltask do_populate_sysroot
606 do_package[noexec] = "1"
607 deltask do_package_qa
608 do_packagedata[noexec] = "1"
609 do_package_write_ipk[noexec] = "1"
610 do_package_write_deb[noexec] = "1"
611 do_package_write_rpm[noexec] = "1"
613 # Allow the kernel to be repacked with the initramfs and boot image file as a single file
614 do_bundle_initramfs[depends] += "virtual/kernel:do_bundle_initramfs"
615 do_bundle_initramfs[nostamp] = "1"
616 do_bundle_initramfs[noexec] = "1"
617 do_bundle_initramfs () {
620 addtask bundle_initramfs after do_image_complete