@@ -26,20 +26,8 @@ def get_fit_replacement_type(d):
return replacementtype
KERNEL_IMAGETYPE_REPLACEMENT ?= "${@get_fit_replacement_type(d)}"
-DEPENDS:append = " ${@'u-boot-tools-native dtc-native' if 'fitImage' in (d.getVar('KERNEL_IMAGETYPES') or '').split() else ''}"
python __anonymous () {
- # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
- # to kernel.bbclass . We have to override it, since we pack zImage
- # (at least for now) into the fitImage .
- typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
- if 'fitImage' in typeformake.split():
- d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', d.getVar('KERNEL_IMAGETYPE_REPLACEMENT')))
-
- image = d.getVar('INITRAMFS_IMAGE')
- if image:
- d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
-
ubootenv = d.getVar('UBOOT_ENV')
if ubootenv:
d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/bootloader:do_populate_sysroot')
@@ -48,8 +36,31 @@ python __anonymous () {
providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb")
if providerdtb:
d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/dtb:do_populate_sysroot')
- d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' virtual/dtb:do_populate_sysroot')
d.setVar('EXTERNAL_KERNEL_DEVICETREE', "${RECIPE_SYSROOT}/boot/devicetree")
+
+ typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
+ if 'fitImage' in typeformake.split():
+ # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
+ # to kernel.bbclass . We have to override it, since we pack zImage
+ # (at least for now) into the fitImage .
+ d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', d.getVar('KERNEL_IMAGETYPE_REPLACEMENT')))
+
+ # mkimage and dtc are required by the fitimage_assemble function
+ d.appendVarFlag('do_assemble_fitimage', 'depends',
+ ' u-boot-tools-native:do_populate_sysroot dtc-native:do_populate_sysroot')
+
+ initramfs_image = d.getVar('INITRAMFS_IMAGE')
+ bundled = bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE'))
+ if initramfs_image:
+ if bundled:
+ bb.build.addtask('do_assemble_fitimage_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
+ else:
+ bb.build.addtask('do_assemble_fitimage_initramfs', 'do_deploy', 'do_install', d)
+
+ d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends',
+ ' u-boot-tools-native:do_populate_sysroot dtc-native:do_populate_sysroot ${INITRAMFS_IMAGE}:do_image_complete')
+ if providerdtb:
+ d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' virtual/dtb:do_populate_sysroot')
}
@@ -797,19 +808,14 @@ do_install:append() {
}
do_assemble_fitimage_initramfs() {
- if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
- test -n "${INITRAMFS_IMAGE}" ; then
- cd ${B}
- if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-bundle ""
- ln -sf fitImage-bundle ${B}/${KERNEL_OUTPUT_DIR}/fitImage
- else
- fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
- fi
+ if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
+ fitimage_assemble "fit-image-${INITRAMFS_IMAGE}.its" "${KERNEL_OUTPUT_DIR}/fitImage-bundle" ""
+ ln -sf fitImage-bundle "${B}/${KERNEL_OUTPUT_DIR}/fitImage"
+ else
+ fitimage_assemble "fit-image-${INITRAMFS_IMAGE}.its" "${KERNEL_OUTPUT_DIR}/fitImage-${INITRAMFS_IMAGE}" 1
fi
}
-
-addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs
+do_assemble_fitimage_initramfs[dirs] = "${B}"
do_kernel_generate_rsa_keys() {
if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
@@ -864,6 +870,7 @@ kernel_do_deploy:append() {
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
+ # deploy the artifacts of do_assemble_fitimage
bbnote "Copying fit-image.its source file..."
install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
@@ -878,12 +885,14 @@ kernel_do_deploy:append() {
fi
if [ -n "${INITRAMFS_IMAGE}" ]; then
+ # deploy the artifacts of do_assemble_fitimage_initramfs for bundled as well as un-bundled mode
bbnote "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
fi
+ # deploy the artifacts of do_assemble_fitimage_initramfs for bundled mode only
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
bbnote "Copying fitImage-${INITRAMFS_IMAGE} file..."
install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}"
@@ -139,18 +139,23 @@ fi
set -e
""" % (type, type, type))
-
image = d.getVar('INITRAMFS_IMAGE')
- # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
- # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built
- # standalone for use by wic and other tools.
if image:
- if d.getVar('INITRAMFS_MULTICONFIG'):
- d.appendVarFlag('do_bundle_initramfs', 'mcdepends', ' mc::${INITRAMFS_MULTICONFIG}:${INITRAMFS_IMAGE}:do_image_complete')
+ # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0,
+ # the do_bundle_initramfs is not needed, but the INITRAMFS_IMAGE is built
+ # standalone for use by wic and other tools.
+ def add_initramfs_dep_task(initramfs_dep_task, d):
+ if d.getVar('INITRAMFS_MULTICONFIG'):
+ d.appendVarFlag(initramfs_dep_task, 'mcdepends', ' mc::${INITRAMFS_MULTICONFIG}:${INITRAMFS_IMAGE}:do_image_complete')
+ else:
+ d.appendVarFlag(initramfs_dep_task, 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
+
+ if bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')):
+ bb.build.addtask('do_bundle_initramfs', 'do_deploy', 'do_install', d)
+ add_initramfs_dep_task('do_bundle_initramfs', d)
+ bb.build.addtask('do_transform_bundled_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
else:
- d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
- if image and bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')):
- bb.build.addtask('do_transform_bundled_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
+ add_initramfs_dep_task('do_deploy', d)
# NOTE: setting INITRAMFS_TASK is for backward compatibility
# The preferred method is to set INITRAMFS_IMAGE, because
@@ -330,6 +335,8 @@ do_bundle_initramfs () {
mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType
fi
done
+ else
+ bbwarn "Calling do_bundle_initramfs with INITRAMFS_IMAGE_BUNDLE=1 is deprecated"
fi
}
do_bundle_initramfs[dirs] = "${B}"
@@ -350,8 +357,6 @@ python do_devshell:prepend () {
os.environ["LDFLAGS"] = ''
}
-addtask bundle_initramfs after do_install before do_deploy
-
KERNEL_DEBUG_TIMESTAMPS ??= "0"
kernel_do_compile() {
@@ -873,7 +878,7 @@ kernel_do_deploy() {
# ensure we get the right values for both
do_deploy[prefuncs] += "read_subpackage_metadata"
-addtask deploy after do_populate_sysroot do_packagedata
+addtask deploy after do_install do_populate_sysroot do_packagedata
EXPORT_FUNCTIONS do_deploy