diff mbox series

[RFC] kernel-yocto: Support in-tree config fragments

Message ID 20241002100900.2975523-1-paul@pbarker.dev
State New
Headers show
Series [RFC] kernel-yocto: Support in-tree config fragments | expand

Commit Message

Paul Barker Oct. 2, 2024, 10:09 a.m. UTC
[This is currently an RFC as it depends on a separate patch to add
  support for config fragments with .config file extensions in
  yocto-kernel-tools:
  https://lists.yoctoproject.org/g/linux-yocto/message/14431]

In Linux 6.8, the in-tree rv32_defconfig file for 32-bit RISC-V support
was dropped in favour of a Makefile target which combines the RISC-V
defconfig with a config fragment '32-bit.config'. So to build for 32-bit
RISC-V using the in-tree configuration from an upstream kernel, we need
to be able to enable this 32-bit config fragment.

We can support this via KERNEL_FEATURES if we add the in-tree arch
config directory (arch/${ARCH}/configs) to the search path.

While we're here, let's also add the generic config directory
(kernel/configs) to the search path so in-tree config fragments such as
'hardening.config' can be used.

Signed-off-by: Paul Barker <paul@pbarker.dev>
---
 meta/classes-recipe/kernel-yocto.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bruce Ashfield Oct. 2, 2024, 1:39 p.m. UTC | #1
On Wed, Oct 2, 2024 at 6:09 AM Paul Barker via lists.openembedded.org
<paul=pbarker.dev@lists.openembedded.org> wrote:
>
> [This is currently an RFC as it depends on a separate patch to add
>   support for config fragments with .config file extensions in
>   yocto-kernel-tools:
>   https://lists.yoctoproject.org/g/linux-yocto/message/14431]
>
> In Linux 6.8, the in-tree rv32_defconfig file for 32-bit RISC-V support
> was dropped in favour of a Makefile target which combines the RISC-V
> defconfig with a config fragment '32-bit.config'. So to build for 32-bit
> RISC-V using the in-tree configuration from an upstream kernel, we need
> to be able to enable this 32-bit config fragment.
>
> We can support this via KERNEL_FEATURES if we add the in-tree arch
> config directory (arch/${ARCH}/configs) to the search path.

Agreed, that this is a more consistent way to bring in these types
of fragments (versus being hidden under the build/make, etc).

The only issue is that the audit won't react correctly to these
fragments, so we'll potentially end up with silent failure of them
to apply and/or options that are not valid, etc.

Let me queue this patch locally, do some audit testing (and changes
if necessary) and I'll send it along in my next pull request.

(Same goes for the kern-tools patch).

Bruce

>
> While we're here, let's also add the generic config directory
> (kernel/configs) to the search path so in-tree config fragments such as
> 'hardening.config' can be used.
>
> Signed-off-by: Paul Barker <paul@pbarker.dev>
> ---
>  meta/classes-recipe/kernel-yocto.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
> index 6d5c3b6327b6..66602d359404 100644
> --- a/meta/classes-recipe/kernel-yocto.bbclass
> +++ b/meta/classes-recipe/kernel-yocto.bbclass
> @@ -248,6 +248,9 @@ do_kernel_metadata() {
>                  fi
>         done
>
> +       # allow in-tree config fragments to be used in KERNEL_FEATURES
> +       includes="$includes -I${S}/arch/${ARCH}/configs -I${S}/kernel/configs"
> +
>         # expand kernel features into their full path equivalents
>         bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
>         if [ -z "$bsp_definition" ]; then
> --
> 2.39.5
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#205183): https://lists.openembedded.org/g/openembedded-core/message/205183
> Mute This Topic: https://lists.openembedded.org/mt/108776739/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index 6d5c3b6327b6..66602d359404 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -248,6 +248,9 @@  do_kernel_metadata() {
                 fi
 	done
 
+	# allow in-tree config fragments to be used in KERNEL_FEATURES
+	includes="$includes -I${S}/arch/${ARCH}/configs -I${S}/kernel/configs"
+
 	# expand kernel features into their full path equivalents
 	bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
 	if [ -z "$bsp_definition" ]; then