kernel.bbclass: fix KERNEL_IMAGETYPE(S) for Image.gz

Message ID 20170601092108.9544-1-nicolas.dechesne@linaro.org
State New
Headers show

Commit Message

Nicolas Dechesne June 1, 2017, 9:21 a.m.
KERNEL_IMAGETYPES lists all the kernel images that we want to build. in
cb17b6c2a7 (kernel.bbclass: support kernel image type of vmlinux.gz), some logic
was added to support vmlinux.gz which is not a target built by kernel
makefiles (only vmlinux). It is clear that the goal of this logic is only to
support vmlinux.gz and not others compressed format (such as Image.gz) which are
valid target for kernel makefiles.

For Image.gz we should rely on the kernel makefiles and not do the compression
in kernel class.

This patch updates the logic used to filter out non supported kernel target from
KERNEL_IMAGETYPES, and make vmlinux.gz a 'special case', instead of *.gz. If
more special cases are needed in the future, we could add them in a similar way.

This patch should be a no-op for anyone using vmlinux or vmlinux.gz, and on top
of that it is fixing the build for Image.gz which was not working until now.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>

---
 meta/classes/kernel.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Andre McCurdy June 1, 2017, 7:11 p.m. | #1
On Thu, Jun 1, 2017 at 2:21 AM, Nicolas Dechesne
<nicolas.dechesne@linaro.org> wrote:
> KERNEL_IMAGETYPES lists all the kernel images that we want to build. in

> cb17b6c2a7 (kernel.bbclass: support kernel image type of vmlinux.gz), some logic

> was added to support vmlinux.gz which is not a target built by kernel

> makefiles (only vmlinux). It is clear that the goal of this logic is only to

> support vmlinux.gz and not others compressed format (such as Image.gz) which are

> valid target for kernel makefiles.

>

> For Image.gz we should rely on the kernel makefiles and not do the compression

> in kernel class.

>

> This patch updates the logic used to filter out non supported kernel target from

> KERNEL_IMAGETYPES, and make vmlinux.gz a 'special case', instead of *.gz. If

> more special cases are needed in the future, we could add them in a similar way.

>

> This patch should be a no-op for anyone using vmlinux or vmlinux.gz, and on top

> of that it is fixing the build for Image.gz which was not working until now.

>

> Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>

> ---

>  meta/classes/kernel.bbclass | 5 ++++-

>  1 file changed, 4 insertions(+), 1 deletion(-)

>

> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass

> index 7a134d5c29..459b6d66a3 100644

> --- a/meta/classes/kernel.bbclass

> +++ b/meta/classes/kernel.bbclass

> @@ -44,7 +44,10 @@ python __anonymous () {

>          types = (alttype + ' ' + types).strip()

>      d.setVar('KERNEL_IMAGETYPES', types)

>

> -    typeformake = re.sub(r'\.gz', '', 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 = re.sub(r'vmlinux\.gz', 'vmlinux', types)


You could use types.replace('vmlinux.gz', 'vmlinux') here (and then
drop the "import re"). Also, if vmlinux.gz is the only special case
being supported, then the kernel_do_compile() can be simplified too
(see the patch I sent yesterday).

>      d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)

>

>      for type in types.split():

> --

> 2.11.0

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Nicolas Dechesne June 1, 2017, 9:31 p.m. | #2
On Thu, Jun 1, 2017 at 9:11 PM, Andre McCurdy <armccurdy@gmail.com> wrote:
> You could use types.replace('vmlinux.gz', 'vmlinux') here (and then

> drop the "import re"). Also, if vmlinux.gz is the only special case

> being supported, then the kernel_do_compile() can be simplified too

> (see the patch I sent yesterday).


yes, you're right. that change seems like an improvement. i will test
it out and resend..
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch hide | download patch | download mbox

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 7a134d5c29..459b6d66a3 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -44,7 +44,10 @@  python __anonymous () {
         types = (alttype + ' ' + types).strip()
     d.setVar('KERNEL_IMAGETYPES', types)
 
-    typeformake = re.sub(r'\.gz', '', 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 = re.sub(r'vmlinux\.gz', 'vmlinux', types)
     d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
 
     for type in types.split():