kernel-fitimage.bbclass: introduce get_fit_replacement_type function

Avoid to set KERNEL_IMAGETYPE_REPLACEMENT in anonymous python function,
otherwise it chould not be overridden in config files, for instance,
it's being set now in meta/lib/oeqa/selftest/cases/fitimage.py.

Introduce a get_fit_replacement_type function to get the default value
of KERNEL_IMAGETYPE_REPLACEMENT, and it could be overridden in config
files.

(From OE-Core rev: 5238facb2f067b65959ac51695d100c0e849d3ee)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ming Liu
2022-03-19 13:32:19 +01:00
committed by Richard Purdie
parent 43299607cc
commit 16d7103df1

View File

@@ -1,14 +1,9 @@
inherit kernel-uboot kernel-artifact-names uboot-sign
KERNEL_IMAGETYPE_REPLACEMENT = ""
python __anonymous () {
def get_fit_replacement_type(d):
kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
replacementtype = ""
if 'fitImage' in kerneltypes.split():
depends = d.getVar("DEPENDS")
depends = "%s u-boot-tools-native dtc-native" % depends
d.setVar("DEPENDS", depends)
uarch = d.getVar("UBOOT_ARCH")
if uarch == "arm64":
replacementtype = "Image"
@@ -22,15 +17,18 @@ python __anonymous () {
replacementtype = "linux.bin"
else:
replacementtype = "zImage"
return replacementtype
d.setVar("KERNEL_IMAGETYPE_REPLACEMENT", 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', replacementtype))
d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', d.getVar('KERNEL_IMAGETYPE_REPLACEMENT')))
image = d.getVar('INITRAMFS_IMAGE')
if image: