* [PATCH] kernel.bbclass: avoid duplicates in KERNEL_IMAGETYPE_FOR_MAKE
@ 2018-03-12 23:19 Andre McCurdy
2018-03-13 6:58 ` Martin Hundebøll
0 siblings, 1 reply; 2+ messages in thread
From: Andre McCurdy @ 2018-03-12 23:19 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
---
meta/classes/kernel.bbclass | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index dc0152f..4bcaa61 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -62,31 +62,37 @@ python __anonymous () {
type = d.getVar('KERNEL_IMAGETYPE') or ""
alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
types = d.getVar('KERNEL_IMAGETYPES') or ""
- kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
if type not in types.split():
types = (type + ' ' + types).strip()
if alttype not in types.split():
types = (alttype + ' ' + types).strip()
d.setVar('KERNEL_IMAGETYPES', types)
- # some commonly used kernel images aren't generated by the kernel build system, such as vmlinux.gz
- # typeformake lists only valid kernel make targets, and post processing can be done after the kernel
- # is built (such as using gzip to compress vmlinux)
- typeformake = types.replace('vmlinux.gz', 'vmlinux')
+ # KERNEL_IMAGETYPES may contain a mixture of image types supported directly
+ # by the kernel build system and others which are created by post-processing
+ # (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.
+
+ typeformake = ""
+ for type in types.split():
+ if type == 'vmlinux.gz':
+ type = 'vmlinux'
+ if type in types.split():
+ continue
+ typeformake = (typeformake + ' ' + type).strip()
+
d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
+ kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
+ imagedest = d.getVar('KERNEL_IMAGEDEST')
+
for type in types.split():
typelower = type.lower()
- imagedest = d.getVar('KERNEL_IMAGEDEST')
-
d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
-
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.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')
image = d.getVar('INITRAMFS_IMAGE')
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel.bbclass: avoid duplicates in KERNEL_IMAGETYPE_FOR_MAKE
2018-03-12 23:19 [PATCH] kernel.bbclass: avoid duplicates in KERNEL_IMAGETYPE_FOR_MAKE Andre McCurdy
@ 2018-03-13 6:58 ` Martin Hundebøll
0 siblings, 0 replies; 2+ messages in thread
From: Martin Hundebøll @ 2018-03-13 6:58 UTC (permalink / raw)
To: Andre McCurdy, openembedded-core
Hi Andre,
On 2018-03-13 00:19, Andre McCurdy wrote:
> 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.
>
> Signed-off-by: Andre McCurdy<armccurdy@gmail.com>
> ---
> meta/classes/kernel.bbclass | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index dc0152f..4bcaa61 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -62,31 +62,37 @@ python __anonymous () {
> type = d.getVar('KERNEL_IMAGETYPE') or ""
> alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or ""
> types = d.getVar('KERNEL_IMAGETYPES') or ""
> - kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
> if type not in types.split():
> types = (type + ' ' + types).strip()
> if alttype not in types.split():
> types = (alttype + ' ' + types).strip()
> d.setVar('KERNEL_IMAGETYPES', types)
>
> - # some commonly used kernel images aren't generated by the kernel build system, such as vmlinux.gz
> - # typeformake lists only valid kernel make targets, and post processing can be done after the kernel
> - # is built (such as using gzip to compress vmlinux)
> - typeformake = types.replace('vmlinux.gz', 'vmlinux')
> + # KERNEL_IMAGETYPES may contain a mixture of image types supported directly
> + # by the kernel build system and others which are created by post-processing
> + # (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.
> +
> + typeformake = ""
> + for type in types.split():
> + if type == 'vmlinux.gz':
> + type = 'vmlinux'
> + if type in types.split():
> + continue
> + typeformake = (typeformake + ' ' + type).strip()
> +
> d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
I think this hunk go be better implemented using a python set(), e.g.
something like this (untested) piece:
> typeformake = set()
> post_extensions = ('gz', 'xz', 'bz2')
> for type in types.split():
> extsplit = type.rsplit('.', 1)
> if len(extsplit) == 2 and extsplit[1] in post_extensions:
> typeformake.add(extsplit[0])
> else:
> typeformake.add(type)
>
> d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', " ".join(typeformake))
This should allow easier addition of other OE-supported extensions...
// Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-13 8:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 23:19 [PATCH] kernel.bbclass: avoid duplicates in KERNEL_IMAGETYPE_FOR_MAKE Andre McCurdy
2018-03-13 6:58 ` Martin Hundebøll
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.