kernel.bbclass: avoid duplicates in KERNEL_IMAGETYPE_FOR_MAKE

Currently if KERNEL_IMAGETYPES contains both vmlinux and vmlinux.gz,
KERNEL_IMAGETYPE_FOR_MAKE will end up containing two copies of
vmlinux, which will result in two calls to "make vmlinux" from
kernel_do_compile().

Avoid duplicating vmlinux in KERNEL_IMAGETYPE_FOR_MAKE plus some
minor non-functional updates to formatting and comments.

(From OE-Core rev: 80455a0b6cce6d12a5b32194d0cad2e4c7f71599)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andre McCurdy
2018-05-15 12:13:51 -07:00
committed by Richard Purdie
parent 0124d2d94e
commit 95a1d7aefa

View File

@@ -62,32 +62,36 @@ python __anonymous () {
type = d.getVar('KERNEL_IMAGETYPE') or "" type = d.getVar('KERNEL_IMAGETYPE') or ""
alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or "" alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
types = d.getVar('KERNEL_IMAGETYPES') or "" types = d.getVar('KERNEL_IMAGETYPES') or ""
kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
if type not in types.split(): if type not in types.split():
types = (type + ' ' + types).strip() types = (type + ' ' + types).strip()
if alttype not in types.split(): if alttype not in types.split():
types = (alttype + ' ' + types).strip() types = (alttype + ' ' + types).strip()
d.setVar('KERNEL_IMAGETYPES', types) d.setVar('KERNEL_IMAGETYPES', types)
# KERNEL_IMAGETYPES may contain a mixture of image types supported directly
# by the kernel build system and types which are created by post-processing
# the output of the kernel build system (e.g. compressing vmlinux ->
# vmlinux.gz in kernel_do_compile()).
# KERNEL_IMAGETYPE_FOR_MAKE should contain only image types supported
# directly by the kernel build system.
if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'): if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'):
# some commonly used kernel images aren't generated by the kernel build system, such as vmlinux.gz typeformake = set()
# typeformake lists only valid kernel make targets, and post processing can be done after the kernel for type in types.split():
# is built (such as using gzip to compress vmlinux) if type == 'vmlinux.gz':
typeformake = types.replace('vmlinux.gz', 'vmlinux') type = 'vmlinux'
d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake) typeformake.add(type)
d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' '.join(sorted(typeformake)))
kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
imagedest = d.getVar('KERNEL_IMAGEDEST')
for type in types.split(): for type in types.split():
typelower = type.lower() typelower = type.lower()
imagedest = d.getVar('KERNEL_IMAGEDEST')
d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower)) d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type) d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower)) d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower))
d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower)) d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1') d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1')
image = d.getVar('INITRAMFS_IMAGE') image = d.getVar('INITRAMFS_IMAGE')