linux: add bbappend for generic cases
PATCH 1/1 linux: add bbappend for generic cases
From: Chee Yang Lee <[email protected]>
add generic .bbappend for linux kernel recipe to allow all linux kernel recipe with name "linux-%" to enjoy the kernel config from virtualization layer.
[YOCTO #13727]
--- recipes-kernel/linux/linux-%.bbappend | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes-kernel/linux/linux-%.bbappend
recipes-kernel/linux/linux-%.bbappend new file +1 -0
@@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto_virtualization.inc', '', d)}
Signature · 1 line
2.7.4
Quoted 6 lines · Lee Chee Yang
From: Chee Yang Lee <[email protected]>
add generic .bbappend for linux kernel recipe to allow all linux kernel recipe with name "linux-%" to enjoy the kernel config from virtualization layer.
The generic bbappend makes sense, but having them completely unversioned is an issue. Having them completely generic gives us no way to adjust the names as they change over time (and they do) and can give the false impression that they've been tested or are valid for any version.
Last I checked, the % wildcard means "until the end", so we can't do linux-%_<version>.bbappend
I've always had the LINUX_VERSION variable in linux-yocto for cases like this, so I'm wondering if not only can we check the distro feature, but can we also check the version before doing the kernel feature addition ?
I've cc'd Richard, in case he sees this and can offer a suggestion.
I'll think on this more, since I'd rather collapse all the linux-yocto* bbappends, into a single bbappend that works like this, so not only can it be used by other kernels, I can actually test it :D
Bruce
Quoted 17 lines
[YOCTO #13727]
Signed-off-by Chee Yang Lee <[email protected]>--- recipes-kernel/linux/linux-%.bbappend | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes-kernel/linux/linux-%.bbappendrecipes-kernel/linux/linux-%.bbappend new file +1
-1@@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto_virtualization.inc', '', d)} --
Quoted 3 lines
2.7.4
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Quoted 23 lines · Bruce Ashfield
Quoted 5 lines · Lee Chee Yang
From: Chee Yang Lee <[email protected]>
add generic .bbappend for linux kernel recipe to allow all linux kernel recipe with name "linux-%" to enjoy the kernel config from virtualization layer.
The generic bbappend makes sense, but having them completely unversioned is an issue. Having them completely generic gives us no way to adjust the names as they change over time (and they do) and can
give the false impression that they've been tested or are valid for any version.Last I checked, the % wildcard means "until the end", so we can't do linux-%_<version>.bbappend
I've always had the
LINUX_VERSIONvariable in linux-yocto for cases like this, so I'm wondering if not only can we check the distro feature, but can we also check the version before doing the kernel feature addition ?
Quoted 6 lines
I've cc'd Richard, in case he sees this and can offer a suggestion.
I'll think on this more, since I'd rather collapse all the linux-yocto* bbappends, into a single bbappend that works like this, so not only can it be used by other kernels, I can actually test it :D
There are a few options. You could for example probably do something like:
include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto-${LINUX_VERSION}_virtualization.inc', '', d)}
(note include instead of require)
Cheers,
Richard
Quoted 32 lines · Richard Purdie
Quoted 23 lines · Bruce Ashfield
Quoted 5 lines · Lee Chee Yang
From: Chee Yang Lee <[email protected]>
add generic .bbappend for linux kernel recipe to allow all linux kernel recipe with name "linux-%" to enjoy the kernel config from virtualization layer.
The generic bbappend makes sense, but having them completely unversioned is an issue. Having them completely generic gives us no way to adjust the names as they change over time (and they do) and can
give the false impression that they've been tested or are valid for any version.Last I checked, the % wildcard means "until the end", so we can't do linux-%_<version>.bbappend
I've always had the
LINUX_VERSIONvariable in linux-yocto for cases like this, so I'm wondering if not only can we check the distro feature, but can we also check the version before doing the kernel feature addition ?Quoted 6 lines
I've cc'd Richard, in case he sees this and can offer a suggestion.
I'll think on this more, since I'd rather collapse all the linux-yocto* bbappends, into a single bbappend that works like this, so not only can it be used by other kernels, I can actually test it :D
Quoted 6 lines
There are a few options. You could for example probably do something like:
include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto-${LINUX_VERSION}_virtualization.inc', '', d)}
(note include instead of require)
Indeed!
I'll try and pull something together for this, since I do want that version variable to come into play, otherwise, we are looking at nasty runtime debug versus an easier to diagnose build/config time thing.
Thanks Richard,
Bruce
Quoted 5 lines
Cheers,
Richard
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
In message: Re: [meta-virtualization] [PATCH] linux: add bbappend for generic cases
Quoted 22 lines · on 25/02/2020 Bruce Ashfield wrote:
Quoted 6 lines · Lee Chee Yang
From: Chee Yang Lee <[email protected]>
add generic .bbappend for linux kernel recipe to allow all linux kernel recipe with name "linux-%" to enjoy the kernel config from virtualization layer.
The generic bbappend makes sense, but having them completely unversioned is an issue. Having them completely generic gives us no way to adjust the names as they change over time (and they do) and can give the false impression that they've been tested or are valid for any version.
Last I checked, the % wildcard means "until the end", so we can't do linux-%_<version>.bbappend
I've always had the
LINUX_VERSIONvariable in linux-yocto for cases like this, so I'm wondering if not only can we check the distro feature, but can we also check the version before doing the kernel feature addition ?
Quoted 5 lines
I've cc'd Richard, in case he sees this and can offer a suggestion.
I'll think on this more, since I'd rather collapse all the linux-yocto* bbappends, into a single bbappend that works like this, so not only can it be used by other kernels, I can actually test it :D
I've come up with the following patch. It works for linux-yocto*, and is setup to work for any fragment enabled kernel.
I'm sure someone will point out a parse ordering, or some other corner case, but this is the direction I'd like to go with this.
Cheers,
Bruce
Quoted 23 lines
Bruce
Quoted 19 lines
[YOCTO #13727]
Signed-off-by Chee Yang Lee <[email protected]>--- recipes-kernel/linux/linux-%.bbappend | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes-kernel/linux/linux-%.bbappendrecipes-kernel/linux/linux-%.bbappend new file +1
-1@@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto_virtualization.inc', '', d)} --2.7.4
Quoted 8 lines
Quoted 1 line
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
From f2f36a8061c600b35b5f0ce1599d59f1d144a3aa Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <[email protected]>
Date: Wed, 26 Feb 2020 08:53:04 -0500
Subject: [PATCH] kernel: allow fragment re-use from any aware kernel
The kernel fragments contained in this layer could not easily be consumed by any fragment aware kernel not called "linux-yocto".
To make them easier to include, we make the bbappend more generic, to match any linux*.bb recipe (note: this means it will match things like linux-atm.bb as well).
To avoid adding the fragments to recipes that can't use them, or to a version that hasn't been valided, we use the LINUX_VERSION variable to pull out the major/minor kernel release and then include a specific version of the .inc file.
--- recipes-kernel/linux/linux-%.bbappend | 10 ++++++++++ recipes-kernel/linux/linux-yocto-rt_%.bbappend | 1 - recipes-kernel/linux/linux-yocto_5.2.bbappend | 1 - .../linux/linux-yocto_5.2_virtualization.inc | 4 ++++ recipes-kernel/linux/linux-yocto_5.4.bbappend | 1 - .../linux/linux-yocto_5.4_virtualization.inc | 4 ++++ 6 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 recipes-kernel/linux/linux-%.bbappend delete mode 100644 recipes-kernel/linux/linux-yocto-rt_%.bbappend delete mode 100644 recipes-kernel/linux/linux-yocto_5.2.bbappend create mode 100644 recipes-kernel/linux/linux-yocto_5.2_virtualization.inc delete mode 100644 recipes-kernel/linux/linux-yocto_5.4.bbappend create mode 100644 recipes-kernel/linux/linux-yocto_5.4_virtualization.inc
recipes-kernel/linux/linux-%.bbappend new file +10 -0
@@ -0,0 +1,10 @@ +# any kernel recipe with fragment support, that sets LINUX_VERSION to one of the tested +# values, will get the appropriate fragments included in their SRC_URI + +LINUX_MAJOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[0]}" +LINUX_MINOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[1]}" + +include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto_${LINUX_MAJOR}.${LINUX_MINOR}_virtualization.inc', '', d)} + + +
recipes-kernel/linux/linux-yocto-rt_%.bbappend deleted +0 -1
@@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-yocto_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_5.2.bbappend deleted +0 -1
@@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_5.2_virtualization.inc new file +4 -0
@@ -0,0 +1,4 @@ +# include the baseline meta virtualization configuration options +# after this include, we can do version specific things + +include linux-yocto_virtualization.inc
recipes-kernel/linux/linux-yocto_5.4.bbappend deleted +0 -1
@@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_5.4_virtualization.inc new file +4 -0
@@ -0,0 +1,4 @@ +# include the baseline meta virtualization configuration options +# after this include, we can do version specific things + +include linux-yocto_virtualization.inc
Signature · 1 line
2.19.1