* [PATCH 0/3] Kbuild follow-up
@ 2024-05-09 10:34 Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 1/3] module.inc: fix kbuild dependency Adriaan Schmidt
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Adriaan Schmidt @ 2024-05-09 10:34 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, stefan-koch, Adriaan Schmidt
Based on the Stefan's "[PATCH] linux-module: Support emulated module build
with cross-compiled kernel", and on the result of staring at dependency
graphs with Jan, this mainly addresses corner cases of the refactored
kbuild packaging when cross-compiling.
I've tested
- cross-compiled custom kernel and cross module build
- cross-compiled custom kernel and emulated module build
- distro kernel and emulated module build
Let me know if one of your use-cases is still missing.
Also including some fixups brought up in recent reviews on the ML.
Adriaan
Adriaan Schmidt (3):
module.inc: fix kbuild dependency
linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE
kbuildtarget.bbclass: add missing license header
meta/recipes-kernel/linux-module/module.inc | 5 ++++-
meta/recipes-kernel/linux/classes/kbuildtarget.bbclass | 5 +++++
meta/recipes-kernel/linux/linux-custom.inc | 5 +----
meta/recipes-kernel/linux/linux-distro.bb | 1 +
4 files changed, 11 insertions(+), 5 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] module.inc: fix kbuild dependency
2024-05-09 10:34 [PATCH 0/3] Kbuild follow-up Adriaan Schmidt
@ 2024-05-09 10:34 ` Adriaan Schmidt
2024-05-09 17:35 ` Jan Kiszka
2024-05-09 10:34 ` [PATCH 2/3] linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE Adriaan Schmidt
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Adriaan Schmidt @ 2024-05-09 10:34 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, stefan-koch, Adriaan Schmidt
This achieves two things:
* Module builds explicitly depend on linux-kbuild-* as build dependency.
Previously we only had an implicit RDEPENDS in linux-custom, which is
not sufficient. For linux-distro, this means we need to PROVIDE linux-kbuild.
* Remove the unconditional building of native kbuild when it is
not needed, i.e. when we're not actually cross-building a module
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta/recipes-kernel/linux-module/module.inc | 5 ++++-
meta/recipes-kernel/linux/linux-custom.inc | 3 ---
meta/recipes-kernel/linux/linux-distro.bb | 1 +
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index eddbf177..7d65c96a 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -17,7 +17,10 @@ PN .= "-${KERNEL_NAME}"
KERNEL_IMAGE_PKG ??= "linux-image-${KERNEL_NAME}"
KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
-DEPENDS += "${KERNEL_HEADERS_PKG}"
+KERNEL_KBUILD_PKG ??= "linux-kbuild-${KERNEL_NAME}"
+DEPENDS += " \
+ ${KERNEL_HEADERS_PKG} \
+ ${KERNEL_KBUILD_PKG}${@'-native' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) else ''}"
DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
SIGNATURE_KEYFILE ??= ""
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 0d222332..35c61187 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -148,9 +148,6 @@ PROVIDES += "${RECIPE_PROVIDES}"
# Append build profiles
DEB_BUILD_PROFILES += "${BUILD_PROFILES}"
-# Add dependency to build -kbuildtarget and -native automatically
-RDEPENDS:append:cross-profile = " ${BPN}-native"
-
def get_kernel_arch(d):
distro_arch = d.getVar("DISTRO_ARCH")
if distro_arch in ["amd64", "i386"]:
diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-kernel/linux/linux-distro.bb
index bc43528c..13b8dc7e 100644
--- a/meta/recipes-kernel/linux/linux-distro.bb
+++ b/meta/recipes-kernel/linux/linux-distro.bb
@@ -10,6 +10,7 @@ python() {
for kernel in distro_kernels.split():
d.appendVar('PROVIDES', ' linux-image-' + kernel)
d.appendVar('PROVIDES', ' linux-headers-' + kernel)
+ d.appendVar('PROVIDES', ' linux-kbuild-' + kernel)
if d.getVar('KERNEL_IMAGE_PKG'):
d.appendVar('PROVIDES', ' ' + d.getVar('KERNEL_IMAGE_PKG'))
if d.getVar('KERNEL_HEADERS_PKG'):
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE
2024-05-09 10:34 [PATCH 0/3] Kbuild follow-up Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 1/3] module.inc: fix kbuild dependency Adriaan Schmidt
@ 2024-05-09 10:34 ` Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 3/3] kbuildtarget.bbclass: add missing license header Adriaan Schmidt
2024-05-09 17:35 ` [PATCH 0/3] Kbuild follow-up Jan Kiszka
3 siblings, 0 replies; 7+ messages in thread
From: Adriaan Schmidt @ 2024-05-09 10:34 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, stefan-koch, Adriaan Schmidt
we've changed style/convention in Isar sometime during the review of the
kbuild series, and this was missed.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta/recipes-kernel/linux/linux-custom.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 35c61187..53516ef3 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -97,7 +97,7 @@ KERNEL_NAME_PROVIDED ?= "${@ d.getVar('BPN').partition('linux-')[2]}"
# Determine cross-profile override
python() {
- if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and d.getVar("ISAR_CROSS_COMPILE", True) == "1" and "class-native" not in d.getVar("OVERRIDES", True).split(":"):
+ if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")) and "class-native" not in d.getVar("OVERRIDES", True).split(":"):
d.appendVar("OVERRIDES", ":cross-profile")
}
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] kbuildtarget.bbclass: add missing license header
2024-05-09 10:34 [PATCH 0/3] Kbuild follow-up Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 1/3] module.inc: fix kbuild dependency Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 2/3] linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE Adriaan Schmidt
@ 2024-05-09 10:34 ` Adriaan Schmidt
2024-05-09 17:35 ` [PATCH 0/3] Kbuild follow-up Jan Kiszka
3 siblings, 0 replies; 7+ messages in thread
From: Adriaan Schmidt @ 2024-05-09 10:34 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, stefan-koch, Adriaan Schmidt
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta/recipes-kernel/linux/classes/kbuildtarget.bbclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meta/recipes-kernel/linux/classes/kbuildtarget.bbclass b/meta/recipes-kernel/linux/classes/kbuildtarget.bbclass
index 26369861..648825e4 100644
--- a/meta/recipes-kernel/linux/classes/kbuildtarget.bbclass
+++ b/meta/recipes-kernel/linux/classes/kbuildtarget.bbclass
@@ -1,3 +1,8 @@
+# This software is a part of ISAR.
+# Copyright (C) 2024 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
python kbuildtarget_virtclass_handler() {
pn = e.data.getVar('PN')
if pn.endswith('-kbuildtarget'):
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] module.inc: fix kbuild dependency
2024-05-09 10:34 ` [PATCH 1/3] module.inc: fix kbuild dependency Adriaan Schmidt
@ 2024-05-09 17:35 ` Jan Kiszka
2024-05-10 4:44 ` Schmidt, Adriaan
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2024-05-09 17:35 UTC (permalink / raw)
To: Adriaan Schmidt, isar-users; +Cc: stefan-koch
On 09.05.24 12:34, Adriaan Schmidt wrote:
> This achieves two things:
>
> * Module builds explicitly depend on linux-kbuild-* as build dependency.
> Previously we only had an implicit RDEPENDS in linux-custom, which is
> not sufficient. For linux-distro, this means we need to PROVIDE linux-kbuild.
> * Remove the unconditional building of native kbuild when it is
> not needed, i.e. when we're not actually cross-building a module
>
> Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> ---
> meta/recipes-kernel/linux-module/module.inc | 5 ++++-
> meta/recipes-kernel/linux/linux-custom.inc | 3 ---
> meta/recipes-kernel/linux/linux-distro.bb | 1 +
> 3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
> index eddbf177..7d65c96a 100644
> --- a/meta/recipes-kernel/linux-module/module.inc
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -17,7 +17,10 @@ PN .= "-${KERNEL_NAME}"
>
> KERNEL_IMAGE_PKG ??= "linux-image-${KERNEL_NAME}"
> KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
> -DEPENDS += "${KERNEL_HEADERS_PKG}"
> +KERNEL_KBUILD_PKG ??= "linux-kbuild-${KERNEL_NAME}"
> +DEPENDS += " \
> + ${KERNEL_HEADERS_PKG} \
> + ${KERNEL_KBUILD_PKG}${@'-native' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) else ''}"
Isn't -native always available, thus can't we simply depend on the
native variant unconditionally?
Jan
> DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
>
> SIGNATURE_KEYFILE ??= ""
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index 0d222332..35c61187 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -148,9 +148,6 @@ PROVIDES += "${RECIPE_PROVIDES}"
> # Append build profiles
> DEB_BUILD_PROFILES += "${BUILD_PROFILES}"
>
> -# Add dependency to build -kbuildtarget and -native automatically
> -RDEPENDS:append:cross-profile = " ${BPN}-native"
> -
> def get_kernel_arch(d):
> distro_arch = d.getVar("DISTRO_ARCH")
> if distro_arch in ["amd64", "i386"]:
> diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-kernel/linux/linux-distro.bb
> index bc43528c..13b8dc7e 100644
> --- a/meta/recipes-kernel/linux/linux-distro.bb
> +++ b/meta/recipes-kernel/linux/linux-distro.bb
> @@ -10,6 +10,7 @@ python() {
> for kernel in distro_kernels.split():
> d.appendVar('PROVIDES', ' linux-image-' + kernel)
> d.appendVar('PROVIDES', ' linux-headers-' + kernel)
> + d.appendVar('PROVIDES', ' linux-kbuild-' + kernel)
> if d.getVar('KERNEL_IMAGE_PKG'):
> d.appendVar('PROVIDES', ' ' + d.getVar('KERNEL_IMAGE_PKG'))
> if d.getVar('KERNEL_HEADERS_PKG'):
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Kbuild follow-up
2024-05-09 10:34 [PATCH 0/3] Kbuild follow-up Adriaan Schmidt
` (2 preceding siblings ...)
2024-05-09 10:34 ` [PATCH 3/3] kbuildtarget.bbclass: add missing license header Adriaan Schmidt
@ 2024-05-09 17:35 ` Jan Kiszka
3 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2024-05-09 17:35 UTC (permalink / raw)
To: Adriaan Schmidt, isar-users; +Cc: stefan-koch
On 09.05.24 12:34, Adriaan Schmidt wrote:
> Based on the Stefan's "[PATCH] linux-module: Support emulated module build
> with cross-compiled kernel", and on the result of staring at dependency
> graphs with Jan, this mainly addresses corner cases of the refactored
> kbuild packaging when cross-compiling.
>
> I've tested
>
> - cross-compiled custom kernel and cross module build
> - cross-compiled custom kernel and emulated module build
> - distro kernel and emulated module build
>
> Let me know if one of your use-cases is still missing.
>
> Also including some fixups brought up in recent reviews on the ML.
>
> Adriaan
>
> Adriaan Schmidt (3):
> module.inc: fix kbuild dependency
> linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE
> kbuildtarget.bbclass: add missing license header
>
> meta/recipes-kernel/linux-module/module.inc | 5 ++++-
> meta/recipes-kernel/linux/classes/kbuildtarget.bbclass | 5 +++++
> meta/recipes-kernel/linux/linux-custom.inc | 5 +----
> meta/recipes-kernel/linux/linux-distro.bb | 1 +
> 4 files changed, 11 insertions(+), 5 deletions(-)
>
Thanks for the cleanups!
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 1/3] module.inc: fix kbuild dependency
2024-05-09 17:35 ` Jan Kiszka
@ 2024-05-10 4:44 ` Schmidt, Adriaan
0 siblings, 0 replies; 7+ messages in thread
From: Schmidt, Adriaan @ 2024-05-10 4:44 UTC (permalink / raw)
To: Kiszka, Jan, isar-users; +Cc: Koch, Stefan
Kiszka, Jan, Donnerstag, 9. Mai 2024 19:35:
> On 09.05.24 12:34, Adriaan Schmidt wrote:
> > This achieves two things:
> >
> > * Module builds explicitly depend on linux-kbuild-* as build dependency.
> > Previously we only had an implicit RDEPENDS in linux-custom, which is
> > not sufficient. For linux-distro, this means we need to PROVIDE linux-
> kbuild.
> > * Remove the unconditional building of native kbuild when it is
> > not needed, i.e. when we're not actually cross-building a module
> >
> > Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> > ---
> > meta/recipes-kernel/linux-module/module.inc | 5 ++++-
> > meta/recipes-kernel/linux/linux-custom.inc | 3 ---
> > meta/recipes-kernel/linux/linux-distro.bb | 1 +
> > 3 files changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-
> kernel/linux-module/module.inc
> > index eddbf177..7d65c96a 100644
> > --- a/meta/recipes-kernel/linux-module/module.inc
> > +++ b/meta/recipes-kernel/linux-module/module.inc
> > @@ -17,7 +17,10 @@ PN .= "-${KERNEL_NAME}"
> >
> > KERNEL_IMAGE_PKG ??= "linux-image-${KERNEL_NAME}"
> > KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
> > -DEPENDS += "${KERNEL_HEADERS_PKG}"
> > +KERNEL_KBUILD_PKG ??= "linux-kbuild-${KERNEL_NAME}"
> > +DEPENDS += " \
> > + ${KERNEL_HEADERS_PKG} \
> > + ${KERNEL_KBUILD_PKG}${@'-native' if
> bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) else ''}"
>
> Isn't -native always available, thus can't we simply depend on the
> native variant unconditionally?
Huh, you're right... I guess I missed that feature (that you added) :)
v2 coming up...
Adriaan
> Jan
>
> > DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
> >
> > SIGNATURE_KEYFILE ??= ""
> > diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-
> kernel/linux/linux-custom.inc
> > index 0d222332..35c61187 100644
> > --- a/meta/recipes-kernel/linux/linux-custom.inc
> > +++ b/meta/recipes-kernel/linux/linux-custom.inc
> > @@ -148,9 +148,6 @@ PROVIDES += "${RECIPE_PROVIDES}"
> > # Append build profiles
> > DEB_BUILD_PROFILES += "${BUILD_PROFILES}"
> >
> > -# Add dependency to build -kbuildtarget and -native automatically
> > -RDEPENDS:append:cross-profile = " ${BPN}-native"
> > -
> > def get_kernel_arch(d):
> > distro_arch = d.getVar("DISTRO_ARCH")
> > if distro_arch in ["amd64", "i386"]:
> > diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-
> kernel/linux/linux-distro.bb
> > index bc43528c..13b8dc7e 100644
> > --- a/meta/recipes-kernel/linux/linux-distro.bb
> > +++ b/meta/recipes-kernel/linux/linux-distro.bb
> > @@ -10,6 +10,7 @@ python() {
> > for kernel in distro_kernels.split():
> > d.appendVar('PROVIDES', ' linux-image-' + kernel)
> > d.appendVar('PROVIDES', ' linux-headers-' + kernel)
> > + d.appendVar('PROVIDES', ' linux-kbuild-' + kernel)
> > if d.getVar('KERNEL_IMAGE_PKG'):
> > d.appendVar('PROVIDES', ' ' + d.getVar('KERNEL_IMAGE_PKG'))
> > if d.getVar('KERNEL_HEADERS_PKG'):
>
> --
> Siemens AG, Technology
> Linux Expert Center
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-10 4:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09 10:34 [PATCH 0/3] Kbuild follow-up Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 1/3] module.inc: fix kbuild dependency Adriaan Schmidt
2024-05-09 17:35 ` Jan Kiszka
2024-05-10 4:44 ` Schmidt, Adriaan
2024-05-09 10:34 ` [PATCH 2/3] linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE Adriaan Schmidt
2024-05-09 10:34 ` [PATCH 3/3] kbuildtarget.bbclass: add missing license header Adriaan Schmidt
2024-05-09 17:35 ` [PATCH 0/3] Kbuild follow-up Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox