[v2,1/3] module.inc: fix kbuild dependency

Message ID 20240510103653.3364162-2-adriaan.schmidt@siemens.com
State Superseded, archived
Headers show
Series Kbuild follow-up | expand

Commit Message

Schmidt, Adriaan May 10, 2024, 10:36 a.m. UTC
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-isar/recipes-kernel/example-module/example-module.bb | 2 ++
 meta/recipes-kernel/linux-module/module.inc               | 3 ++-
 meta/recipes-kernel/linux/linux-custom.inc                | 3 ---
 meta/recipes-kernel/linux/linux-distro.bb                 | 1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

Comments

Jan Kiszka May 10, 2024, 11:21 a.m. UTC | #1
On 10.05.24 12:36, 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-isar/recipes-kernel/example-module/example-module.bb | 2 ++
>  meta/recipes-kernel/linux-module/module.inc               | 3 ++-
>  meta/recipes-kernel/linux/linux-custom.inc                | 3 ---
>  meta/recipes-kernel/linux/linux-distro.bb                 | 1 +
>  4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb b/meta-isar/recipes-kernel/example-module/example-module.bb
> index 22f3cc47..d486470d 100644
> --- a/meta-isar/recipes-kernel/example-module/example-module.bb
> +++ b/meta-isar/recipes-kernel/example-module/example-module.bb
> @@ -12,3 +12,5 @@ SRC_URI += "file://src"
>  S = "${WORKDIR}/src"
>  
>  AUTOLOAD = "example-module"
> +
> +ISAR_CROSS_COMPILE = "0"
> \ No newline at end of file

Looks like a debugging/testing left-over.

Jan

> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
> index eddbf177..1cca9cfb 100644
> --- a/meta/recipes-kernel/linux-module/module.inc
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -17,7 +17,8 @@ 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"
>  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'):
Schmidt, Adriaan May 13, 2024, 4:18 a.m. UTC | #2
Kiszka, Jan (T CED), 10. Mai 2024 13:22:
> On 10.05.24 12:36, 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-isar/recipes-kernel/example-module/example-module.bb | 2 ++
> >  meta/recipes-kernel/linux-module/module.inc               | 3 ++-
> >  meta/recipes-kernel/linux/linux-custom.inc                | 3 ---
> >  meta/recipes-kernel/linux/linux-distro.bb                 | 1 +
> >  4 files changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb
> b/meta-isar/recipes-kernel/example-module/example-module.bb
> > index 22f3cc47..d486470d 100644
> > --- a/meta-isar/recipes-kernel/example-module/example-module.bb
> > +++ b/meta-isar/recipes-kernel/example-module/example-module.bb
> > @@ -12,3 +12,5 @@ SRC_URI += "file://src"
> >  S = "${WORKDIR}/src"
> >
> >  AUTOLOAD = "example-module"
> > +
> > +ISAR_CROSS_COMPILE = "0"
> > \ No newline at end of file
> 
> Looks like a debugging/testing left-over.

Yes it is... sent v3.

Adriaan

> Jan
> 
> > diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-
> kernel/linux-module/module.inc
> > index eddbf177..1cca9cfb 100644
> > --- a/meta/recipes-kernel/linux-module/module.inc
> > +++ b/meta/recipes-kernel/linux-module/module.inc
> > @@ -17,7 +17,8 @@ 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"
> >  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

Patch

diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb b/meta-isar/recipes-kernel/example-module/example-module.bb
index 22f3cc47..d486470d 100644
--- a/meta-isar/recipes-kernel/example-module/example-module.bb
+++ b/meta-isar/recipes-kernel/example-module/example-module.bb
@@ -12,3 +12,5 @@  SRC_URI += "file://src"
 S = "${WORKDIR}/src"
 
 AUTOLOAD = "example-module"
+
+ISAR_CROSS_COMPILE = "0"
\ No newline at end of file
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index eddbf177..1cca9cfb 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -17,7 +17,8 @@  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"
 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'):