[v5,4/4] docs: Update custom_kernel docs for split up of kernel scripts and tools

Message ID 20240131160001.322247-5-stefan-koch@siemens.com
State Superseded, archived
Headers show
Series linux-custom: Split up binaries from kernel headers to kbuild package | expand

Commit Message

Koch, Stefan Jan. 31, 2024, 4 p.m. UTC
Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
 doc/custom_kernel.md | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

MOESSBAUER, Felix Feb. 1, 2024, 10:35 a.m. UTC | #1
On Wed, 2024-01-31 at 17:00 +0100, Stefan Koch wrote:
> Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
> ---
>  doc/custom_kernel.md | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
> index 73987a5b..ce5f1bf7 100644
> --- a/doc/custom_kernel.md
> +++ b/doc/custom_kernel.md
> @@ -38,12 +38,18 @@ The linux-custom recipe provides support for:
>   7. Allow the name of the kernel image to be changed via
> `KERNEL_FILE` (defaults
>      to `vmlinuz`)
>  
> - 8. Produce a `linux-headers` package which includes kernel headers
> and kbuild
> -    scripts/tools
> + 8. Produce a `linux-headers` package which includes kernel headers
>  
> - 9. The `linux-headers` package shall support native and cross
> compiles of
> -    out-of-tree kernel modules. However, when built in cross-
> compilation mode,
> -    it cannot be used on the target so far.
> + 9. Produce a `linux-kbuild` package for both `target` and `host`
> arch
> +    which includes kbuild scripts and tools.
> +    Using `linux-kbuild` provides the package for the target and
> when
> +    cross building `linux-kbuild-native` provides the package for
> the host.
> +
> +    So the `linux-headers` package supports native and cross
> compiles of
> +    out-of-tree kernel modules. Even, when built in cross-
> compilation mode,
> +    it can be used on the target using the `linux-kbuild` package.
> +
> +    Only the `host` specific package is built automatically at cross
> builds.

Hi Stefan,

thanks for this series. I tested it and it already improves the
situation a lot (e.g. no native binaries in the arm64 packages).

Just a minor thing: When emulating the compilation of a kernel module
for an otherwise cross-compiled kernel, the build still fails as the
wrong dependency is attracted. I guess this can easily be fixed in
module.inc:

1. add a debian dependency to the "correct" kbuild package (e.g. the
one for arm64)
2. add an explicit debian build dependency to the kbuild package for
the non-native arch (e.g. arm64).

Only do that on non-cross (bitbake via the bitbake var, debian either
via bitbake or via a build-profile selector, e.g. "[cross]").

Best regards,
Felix

>  
>   10. Produce a `linux-libc-dev` package to support user-land builds
>  
> @@ -72,8 +78,6 @@ In the future, the recipe may be extended to:
>  
>   3. Be compatible with Ubuntu
>  
> - 4. When cross-building, generate kernel-headers for both host and
> target
> -
>  ## Examples
>  
>  The linux-custom recipe is currently used by the linux-mainline
> package and is
Koch, Stefan Feb. 6, 2024, 12:44 p.m. UTC | #2
On Thu, 2024-02-01 at 10:35 +0000, Moessbauer, Felix (T CED OES-DE)
wrote:
> On Wed, 2024-01-31 at 17:00 +0100, Stefan Koch wrote:
> > Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
> > ---
> >  doc/custom_kernel.md | 18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 
> > diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
> > index 73987a5b..ce5f1bf7 100644
> > --- a/doc/custom_kernel.md
> > +++ b/doc/custom_kernel.md
> > @@ -38,12 +38,18 @@ The linux-custom recipe provides support for:
> >   7. Allow the name of the kernel image to be changed via
> > `KERNEL_FILE` (defaults
> >      to `vmlinuz`)
> >  
> > - 8. Produce a `linux-headers` package which includes kernel
> > headers
> > and kbuild
> > -    scripts/tools
> > + 8. Produce a `linux-headers` package which includes kernel
> > headers
> >  
> > - 9. The `linux-headers` package shall support native and cross
> > compiles of
> > -    out-of-tree kernel modules. However, when built in cross-
> > compilation mode,
> > -    it cannot be used on the target so far.
> > + 9. Produce a `linux-kbuild` package for both `target` and `host`
> > arch
> > +    which includes kbuild scripts and tools.
> > +    Using `linux-kbuild` provides the package for the target and
> > when
> > +    cross building `linux-kbuild-native` provides the package for
> > the host.
> > +
> > +    So the `linux-headers` package supports native and cross
> > compiles of
> > +    out-of-tree kernel modules. Even, when built in cross-
> > compilation mode,
> > +    it can be used on the target using the `linux-kbuild` package.
> > +
> > +    Only the `host` specific package is built automatically at
> > cross
> > builds.
> 
> Hi Stefan,
> 
> thanks for this series. I tested it and it already improves the
> situation a lot (e.g. no native binaries in the arm64 packages).
> 
> Just a minor thing: When emulating the compilation of a kernel module
> for an otherwise cross-compiled kernel, the build still fails as the
> wrong dependency is attracted. I guess this can easily be fixed in
> module.inc:
> 

I have successful built a module that uses linux-module/module.inc

That works either using cross-compilation or using QEMU based target
compilation.

> 1. add a debian dependency to the "correct" kbuild package (e.g. the
> one for arm64)
Was automatically used (:arm64) when ISAR_CROSS_COMPILE = "0" otherwise
(:amd64)
> 2. add an explicit debian build dependency to the kbuild package for
> the non-native arch (e.g. arm64).
Was unchanged
> 
> Only do that on non-cross (bitbake via the bitbake var, debian either
> via bitbake or via a build-profile selector, e.g. "[cross]").
Was unchanged, too
> 
> Best regards,
> Felix
> 
Stefan
> >  
> >   10. Produce a `linux-libc-dev` package to support user-land
> > builds
> >  
> > @@ -72,8 +78,6 @@ In the future, the recipe may be extended to:
> >  
> >   3. Be compatible with Ubuntu
> >  
> > - 4. When cross-building, generate kernel-headers for both host and
> > target
> > -
> >  ## Examples
> >  
> >  The linux-custom recipe is currently used by the linux-mainline
> > package and is
> 
> -- 
> Siemens AG, Technology
> Linux Expert Center
> 
>
MOESSBAUER, Felix Feb. 6, 2024, 12:50 p.m. UTC | #3
> > Hi Stefan,
> > 
> > thanks for this series. I tested it and it already improves the
> > situation a lot (e.g. no native binaries in the arm64 packages).
> > 
> > Just a minor thing: When emulating the compilation of a kernel
> > module
> > for an otherwise cross-compiled kernel, the build still fails as
> > the
> > wrong dependency is attracted. I guess this can easily be fixed in
> > module.inc:
> > 
> 
> I have successful built a module that uses linux-module/module.inc
> 
> That works either using cross-compilation or using QEMU based target
> compilation.

Right, thanks for the clarification. In my tests I combined a cross-
compiled kernel with a qemu-based compile of a module (and vice versa).
These use-cases are pretty special, so I don't want to delay this
series. I'll send my Tested-by for the whole series.

Best regards,
Felix

> 
> > 1. add a debian dependency to the "correct" kbuild package (e.g.
> > the
> > one for arm64)
> Was automatically used (:arm64) when ISAR_CROSS_COMPILE = "0"
> otherwise
> (:amd64)
> > 2. add an explicit debian build dependency to the kbuild package
> > for
> > the non-native arch (e.g. arm64).
> Was unchanged
> > 
> > Only do that on non-cross (bitbake via the bitbake var, debian
> > either
> > via bitbake or via a build-profile selector, e.g. "[cross]").
> Was unchanged, too
> > 
> > Best regards,
> > Felix
> > 
> Stefan
> >
Koch, Stefan Feb. 6, 2024, 1:04 p.m. UTC | #4
On Tue, 2024-02-06 at 12:50 +0000, Moessbauer, Felix (T CED OES-DE)
wrote:
> > > Hi Stefan,
> > > 
> > > thanks for this series. I tested it and it already improves the
> > > situation a lot (e.g. no native binaries in the arm64 packages).
> > > 
> > > Just a minor thing: When emulating the compilation of a kernel
> > > module
> > > for an otherwise cross-compiled kernel, the build still fails as
> > > the
> > > wrong dependency is attracted. I guess this can easily be fixed
> > > in
> > > module.inc:
> > > 
> > 
> > I have successful built a module that uses linux-module/module.inc
> > 
> > That works either using cross-compilation or using QEMU based
> > target
> > compilation.
> 
> Right, thanks for the clarification. In my tests I combined a cross-
> compiled kernel with a qemu-based compile of a module (and vice
> versa).
> These use-cases are pretty special, so I don't want to delay this
> series. I'll send my Tested-by for the whole series.

Same in my test case. Cross compiled kernel and built both kbuild
packages (native+target) and build module using qemu (and cross) - both
working.
> 
> Best regards,
> Felix
> 
> > 
> > > 1. add a debian dependency to the "correct" kbuild package (e.g.
> > > the
> > > one for arm64)
> > Was automatically used (:arm64) when ISAR_CROSS_COMPILE = "0"
> > otherwise
> > (:amd64)
> > > 2. add an explicit debian build dependency to the kbuild package
> > > for
> > > the non-native arch (e.g. arm64).
> > Was unchanged
> > > 
> > > Only do that on non-cross (bitbake via the bitbake var, debian
> > > either
> > > via bitbake or via a build-profile selector, e.g. "[cross]").
> > Was unchanged, too
> > > 
> > > Best regards,
> > > Felix
> > > 
> > Stefan
> > > 
> -- 
> Siemens AG, Technology
> Linux Expert Center
> 
>

Patch

diff --git a/doc/custom_kernel.md b/doc/custom_kernel.md
index 73987a5b..ce5f1bf7 100644
--- a/doc/custom_kernel.md
+++ b/doc/custom_kernel.md
@@ -38,12 +38,18 @@  The linux-custom recipe provides support for:
  7. Allow the name of the kernel image to be changed via `KERNEL_FILE` (defaults
     to `vmlinuz`)
 
- 8. Produce a `linux-headers` package which includes kernel headers and kbuild
-    scripts/tools
+ 8. Produce a `linux-headers` package which includes kernel headers
 
- 9. The `linux-headers` package shall support native and cross compiles of
-    out-of-tree kernel modules. However, when built in cross-compilation mode,
-    it cannot be used on the target so far.
+ 9. Produce a `linux-kbuild` package for both `target` and `host` arch
+    which includes kbuild scripts and tools.
+    Using `linux-kbuild` provides the package for the target and when
+    cross building `linux-kbuild-native` provides the package for the host.
+
+    So the `linux-headers` package supports native and cross compiles of
+    out-of-tree kernel modules. Even, when built in cross-compilation mode,
+    it can be used on the target using the `linux-kbuild` package.
+
+    Only the `host` specific package is built automatically at cross builds.
 
  10. Produce a `linux-libc-dev` package to support user-land builds
 
@@ -72,8 +78,6 @@  In the future, the recipe may be extended to:
 
  3. Be compatible with Ubuntu
 
- 4. When cross-building, generate kernel-headers for both host and target
-
 ## Examples
 
 The linux-custom recipe is currently used by the linux-mainline package and is