diff mbox series

[v6,10/21] kernel-uboot.bbclass: deploy the vmlinux kernel binary

Message ID 20250602075714.32122-11-adrian.freihofer@siemens.com
State New
Headers show
Series FIT image improvements | expand

Commit Message

Freihofer, Adrian June 2, 2025, 7:56 a.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Extend the kernel-uboot.bbclass to build and deploy the kernel binary
intended for inclusion in a FIT image.
Note that the kernel used in a FIT image is a stripped (and optionally
compressed) vmlinux ELF binary - not a self-extracting format like
zImage, which is already available in the deploy directory if needed
separately.

The kernel.bbclass inherits all classes listed in the KERNEL_CLASSES
variable. By default, KERNEL_CLASSES is defined as:
  KERNEL_CLASSES ?= " kernel-uimage "
Since kernel-uimage.bbclass inherits from kernel-uboot.bbclass, the
creation and deployment of the kernel binary for inclusion in a FIT
image happens automatically by default.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes-recipe/kernel-uboot.bbclass | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Bruce Ashfield June 2, 2025, 6:51 p.m. UTC | #1
In message: [OE-core] [PATCH v6 10/21] kernel-uboot.bbclass: deploy the vmlinux kernel binary
on 02/06/2025 Adrian Freihofer via lists.openembedded.org wrote:

> From: Adrian Freihofer <adrian.freihofer@siemens.com>
> 
> Extend the kernel-uboot.bbclass to build and deploy the kernel binary
> intended for inclusion in a FIT image.
> Note that the kernel used in a FIT image is a stripped (and optionally
> compressed) vmlinux ELF binary - not a self-extracting format like
> zImage, which is already available in the deploy directory if needed
> separately.
> 
> The kernel.bbclass inherits all classes listed in the KERNEL_CLASSES
> variable. By default, KERNEL_CLASSES is defined as:
>   KERNEL_CLASSES ?= " kernel-uimage "
> Since kernel-uimage.bbclass inherits from kernel-uboot.bbclass, the
> creation and deployment of the kernel binary for inclusion in a FIT
> image happens automatically by default.
> 
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/classes-recipe/kernel-uboot.bbclass | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass
> index d2a63524ece..e26ba6f0aa9 100644
> --- a/meta/classes-recipe/kernel-uboot.bbclass
> +++ b/meta/classes-recipe/kernel-uboot.bbclass
> @@ -56,4 +56,13 @@ uboot_prep_kimage() {
>  	fi
>  
>  	printf "$linux_comp" > "$output_dir/linux_comp"
> -}
> \ No newline at end of file
> +}
> +
> +kernel_do_deploy:append() {
> +	# Provide the kernel artifacts to post processing recipes e.g. for creating a FIT image
> +	uboot_prep_kimage "$deployDir"
> +	# For x86 a setup.bin needs to be include"d in a fitImage as well
> +	if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
> +		install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin" "$deployDir/"
> +	fi

Isn't this adding extra steps / overhead to a user of kernel-uboot
bbclass that isn't building or using a fitimage ?

Bruce

> +}
> -- 
> 2.49.0
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#217701): https://lists.openembedded.org/g/openembedded-core/message/217701
> Mute This Topic: https://lists.openembedded.org/mt/113424435/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Freihofer, Adrian June 2, 2025, 7:44 p.m. UTC | #2
Hi Bruce

On Mon, 2025-06-02 at 14:51 -0400, Bruce Ashfield wrote:
>
>
> In message: [OE-core] [PATCH v6 10/21] kernel-uboot.bbclass: deploy
> the vmlinux kernel binary
> on 02/06/2025 Adrian Freihofer via lists.openembedded.org wrote:
>
> > From: Adrian Freihofer <adrian.freihofer@siemens.com>
> >
> > Extend the kernel-uboot.bbclass to build and deploy the kernel
> > binary
> > intended for inclusion in a FIT image.
> > Note that the kernel used in a FIT image is a stripped (and
> > optionally
> > compressed) vmlinux ELF binary - not a self-extracting format like
> > zImage, which is already available in the deploy directory if
> > needed
> > separately.
> >
> > The kernel.bbclass inherits all classes listed in the
> > KERNEL_CLASSES
> > variable. By default, KERNEL_CLASSES is defined as:
> >   KERNEL_CLASSES ?= " kernel-uimage "
> > Since kernel-uimage.bbclass inherits from kernel-uboot.bbclass, the
> > creation and deployment of the kernel binary for inclusion in a FIT
> > image happens automatically by default.
> >
> > Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> > ---
> >  meta/classes-recipe/kernel-uboot.bbclass | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/classes-recipe/kernel-uboot.bbclass
> > b/meta/classes-recipe/kernel-uboot.bbclass
> > index d2a63524ece..e26ba6f0aa9 100644
> > --- a/meta/classes-recipe/kernel-uboot.bbclass
> > +++ b/meta/classes-recipe/kernel-uboot.bbclass
> > @@ -56,4 +56,13 @@ uboot_prep_kimage() {
> >     fi
> >
> >     printf "$linux_comp" > "$output_dir/linux_comp"
> > -}
> > \ No newline at end of file
> > +}
> > +
> > +kernel_do_deploy:append() {
> > +   # Provide the kernel artifacts to post processing recipes
> > e.g. for creating a FIT image
> > +   uboot_prep_kimage "$deployDir"
> > +   # For x86 a setup.bin needs to be include"d in a fitImage
> > as well
> > +   if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
> > +           install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin"
> > "$deployDir/"
> > +   fi
>
> Isn't this adding extra steps / overhead to a user of kernel-uboot
> bbclass that isn't building or using a fitimage ?

Yes, the vmlinux is generated and deployed. For some x86 machines the
setup.bin gets deployed as well.

We could argue that this default is good, because all the different use
cases just work (for little overhead). For those who do not like this
overhead it is possible to add
  KERNEL_CLASSES = ""

But we could also argue that uImage and fitImage should be completely
opt-in and changing the default (in kernel.bbclass) from
  KERNEL_CLASSES ?= " kernel-uimage "
to
  KERNEL_CLASSES ?= ""
would be better.

Or we could leave the uImage exactly as it is, and for the fitImage,
introduce a new bbclass called 'kernel-export-vmlinux.bbclass'. This
new class would be enabled by adding:
  KERNEL_CLASSES = "kernel-export-vmlinux"


Any preferences?

Thank you for the re-view.
Adrian

>
> Bruce
>
> > +}
> > --
> > 2.49.0
> >
>
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#217701):
> > https://lists.openembedded.org/g/openembedded-core/message/217701
> > Mute This Topic:
> > https://lists.openembedded.org/mt/113424435/1050810
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe:
> > https://lists.openembedded.org/g/openembedded-core/unsub
> >  [bruce.ashfield@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Bruce Ashfield June 2, 2025, 7:53 p.m. UTC | #3
On Mon, Jun 2, 2025 at 3:44 PM Freihofer, Adrian <
adrian.freihofer@siemens.com> wrote:

> Hi Bruce
>
> On Mon, 2025-06-02 at 14:51 -0400, Bruce Ashfield wrote:
> >
> >
> > In message: [OE-core] [PATCH v6 10/21] kernel-uboot.bbclass: deploy
> > the vmlinux kernel binary
> > on 02/06/2025 Adrian Freihofer via lists.openembedded.org wrote:
> >
> > > From: Adrian Freihofer <adrian.freihofer@siemens.com>
> > >
> > > Extend the kernel-uboot.bbclass to build and deploy the kernel
> > > binary
> > > intended for inclusion in a FIT image.
> > > Note that the kernel used in a FIT image is a stripped (and
> > > optionally
> > > compressed) vmlinux ELF binary - not a self-extracting format like
> > > zImage, which is already available in the deploy directory if
> > > needed
> > > separately.
> > >
> > > The kernel.bbclass inherits all classes listed in the
> > > KERNEL_CLASSES
> > > variable. By default, KERNEL_CLASSES is defined as:
> > >   KERNEL_CLASSES ?= " kernel-uimage "
> > > Since kernel-uimage.bbclass inherits from kernel-uboot.bbclass, the
> > > creation and deployment of the kernel binary for inclusion in a FIT
> > > image happens automatically by default.
> > >
> > > Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> > > ---
> > >  meta/classes-recipe/kernel-uboot.bbclass | 11 ++++++++++-
> > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/meta/classes-recipe/kernel-uboot.bbclass
> > > b/meta/classes-recipe/kernel-uboot.bbclass
> > > index d2a63524ece..e26ba6f0aa9 100644
> > > --- a/meta/classes-recipe/kernel-uboot.bbclass
> > > +++ b/meta/classes-recipe/kernel-uboot.bbclass
> > > @@ -56,4 +56,13 @@ uboot_prep_kimage() {
> > >     fi
> > >
> > >     printf "$linux_comp" > "$output_dir/linux_comp"
> > > -}
> > > \ No newline at end of file
> > > +}
> > > +
> > > +kernel_do_deploy:append() {
> > > +   # Provide the kernel artifacts to post processing recipes
> > > e.g. for creating a FIT image
> > > +   uboot_prep_kimage "$deployDir"
> > > +   # For x86 a setup.bin needs to be include"d in a fitImage
> > > as well
> > > +   if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
> > > +           install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin"
> > > "$deployDir/"
> > > +   fi
> >
> > Isn't this adding extra steps / overhead to a user of kernel-uboot
> > bbclass that isn't building or using a fitimage ?
>
> Yes, the vmlinux is generated and deployed. For some x86 machines the
> setup.bin gets deployed as well.
>
> We could argue that this default is good, because all the different use
> cases just work (for little overhead). For those who do not like this
> overhead it is possible to add
>   KERNEL_CLASSES = ""
>
> But we could also argue that uImage and fitImage should be completely
> opt-in and changing the default (in kernel.bbclass) from
>   KERNEL_CLASSES ?= " kernel-uimage "
> to
>   KERNEL_CLASSES ?= ""
> would be better.
>
> Or we could leave the uImage exactly as it is, and for the fitImage,
> introduce a new bbclass called 'kernel-export-vmlinux.bbclass'. This
> new class would be enabled by adding:
>   KERNEL_CLASSES = "kernel-export-vmlinux"
>
>
> Any preferences?
>

I prefer #3, with the explicit export kernel class.

option #1 might be hard to find, we could argue that if you are having
such an issue with space / time, you'd dig in and find out how to disable
the processing. But I still prefer something obvious

#2 I do like opt-in, but leaving the default as it currently is makes sense.

Bruce



>
> Thank you for the re-view.
> Adrian
>
> >
> > Bruce
> >
> > > +}
> > > --
> > > 2.49.0
> > >
> >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#217701):
> > > https://lists.openembedded.org/g/openembedded-core/message/217701
> > > Mute This Topic:
> > > https://lists.openembedded.org/mt/113424435/1050810
> > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > Unsubscribe:
> > > https://lists.openembedded.org/g/openembedded-core/unsub
> > >  [bruce.ashfield@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
> >
>
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass
index d2a63524ece..e26ba6f0aa9 100644
--- a/meta/classes-recipe/kernel-uboot.bbclass
+++ b/meta/classes-recipe/kernel-uboot.bbclass
@@ -56,4 +56,13 @@  uboot_prep_kimage() {
 	fi
 
 	printf "$linux_comp" > "$output_dir/linux_comp"
-}
\ No newline at end of file
+}
+
+kernel_do_deploy:append() {
+	# Provide the kernel artifacts to post processing recipes e.g. for creating a FIT image
+	uboot_prep_kimage "$deployDir"
+	# For x86 a setup.bin needs to be include"d in a fitImage as well
+	if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
+		install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin" "$deployDir/"
+	fi
+}