* [PATCH v6 0/8] scripts/make_fit: Support ramdisks and faster operations
@ 2025-11-19 18:13 Simon Glass
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
0 siblings, 2 replies; 14+ messages in thread
From: Simon Glass @ 2025-11-19 18:13 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Thomas Weißschuh, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Simon Glass,
Ard Biesheuvel, Bill Wendling, Catalin Marinas, David Sterba,
Josh Poimboeuf, Justin Stitt, Kees Cook, Miguel Ojeda,
Nathan Chancellor, Nick Desaulniers, Nick Terrell, Nicolas Schier,
Rong Xu, Tamir Duberstein, Will Deacon, linux-kbuild,
linux-kernel, llvm
This series updates 'make image.fit' to support adding a ramdisk to the
FIT, either one provided as a parameter or one created from all the
kernel modules.
It also includes a few performance improvement, so that building a FIT
from ~450MB of kernel/module/devicetree files only takes a few seconds
on a modern machine.
Note: I included support for using the existing cpio script as suggested
by Ahmad, but a fallback remains in case that is not available.
https://lore.kernel.org/lkml/CAFLszThpTg-FBoNG_tQ0xve0LkYWER85EJeHuem-_JUD8J1Ocw@mail.gmail.com/
Changes in v6:
- Using the modules.order file instead of 'find'
- Use gen_initramfs.sh where available
- Mention that FIT_MODULES just needs to be non-empty
- Make use of modules.order instead of using 'find'
Changes in v5:
- Fix 'use' typo
- Add a new patch to split out module targets into a variable
- Build modules automatically if needed (fix from Nicolas Schier)
Changes in v4:
- Update the commit message
- Provide the list of modules from the Makefile
- Reduce verbosity (don't print every module filename)
- Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
- Use an empty FIT_MODULES to disable the feature, instead of '0'
- Make use of the 'modules' dependency to ensure modules are built
- Pass the list of modules to the script
Changes in v3:
- Move the ramdisk chunk into the correct patch
- Add a comment at the top of the file about the -r option
- Count the ramdisk in the total files
- Update the commit message
- Add a way to add built modules into the FIT
Changes in v2:
- Don't compress the ramdisk as it is already compressed
Simon Glass (8):
scripts/make_fit: Speed up operation
scripts/make_fit: Support an initial ramdisk
scripts/make_fit: Move dtb processing into a function
scripts/make_fit: Provide a way to add built modules
kbuild: Split out module targets into a variable
kbuild: Allow adding modules into the FIT ramdisk
scripts/make_fit: Support a few more parallel compressors
scripts/make_fit: Compress dtbs in parallel
Makefile | 8 +-
arch/arm64/Makefile | 1 +
scripts/Makefile.lib | 6 +-
scripts/make_fit.py | 293 +++++++++++++++++++++++++++++++++++++------
4 files changed, 269 insertions(+), 39 deletions(-)
--
2.43.0
base-commit: 4a71531471926e3c391665ee9c42f4e0295a4585
branch: fita6
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v6 5/8] kbuild: Split out module targets into a variable
2025-11-19 18:13 [PATCH v6 0/8] scripts/make_fit: Support ramdisks and faster operations Simon Glass
@ 2025-11-19 18:13 ` Simon Glass
2025-11-19 20:20 ` Nicolas Schier
2025-11-26 11:10 ` Ahmad Fatoum
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
1 sibling, 2 replies; 14+ messages in thread
From: Simon Glass @ 2025-11-19 18:13 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Thomas Weißschuh, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Simon Glass,
Bill Wendling, Justin Stitt, Miguel Ojeda, Nathan Chancellor,
Nick Desaulniers, Nicolas Schier, Tamir Duberstein, linux-kbuild,
linux-kernel, llvm
Add a modules-targets variable to list the targets which cause modules
to be built, since we want to add a conditional target.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
(no changes since v5)
Changes in v5:
- Add a new patch to split out module targets into a variable
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 638bc09a546a..8cd46222fc48 100644
--- a/Makefile
+++ b/Makefile
@@ -772,7 +772,12 @@ endif
# in addition to whatever we do anyway.
# Just "make" or "make all" shall build modules as well
-ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),)
+modules-targets := all
+modules-targets += modules
+modules-targets += nsdeps
+modules-targets += compile_commands.json
+modules-targets += clang-%
+ifneq ($(filter $(modules-targets),$(MAKECMDGOALS)),)
KBUILD_MODULES := y
endif
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-19 18:13 [PATCH v6 0/8] scripts/make_fit: Support ramdisks and faster operations Simon Glass
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
@ 2025-11-19 18:13 ` Simon Glass
2025-11-19 20:20 ` Nicolas Schier
2025-11-20 7:49 ` Thomas Weißschuh
1 sibling, 2 replies; 14+ messages in thread
From: Simon Glass @ 2025-11-19 18:13 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Thomas Weißschuh, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Simon Glass,
Reviewed-by : Nicolas Schier, Nathan Chancellor, Ard Biesheuvel,
Catalin Marinas, Josh Poimboeuf, Kees Cook, Miguel Ojeda,
Nicolas Schier, Rong Xu, Tamir Duberstein, Will Deacon,
linux-kbuild, linux-kernel
Support 'make image.fit FIT_MODULES=1' to put all the modules into a
ramdisk image within the FIT.
Add image.fit as a target which requires modules, so that modules will
built automatically when using FIT_MODULES is not empty.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Suggested-by: Reviewed-by: Nicolas Schier <nsc@kernel.org>
Acked-by: Nathan Chancellor <nathan@kernel.org>
---
Changes in v6:
- Mention that FIT_MODULES just needs to be non-empty
- Make use of modules.order instead of using 'find'
Changes in v5:
- Build modules automatically if needed (fix from Nicolas Schier)
Changes in v4:
- Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
- Use an empty FIT_MODULES to disable the feature, instead of '0'
- Make use of the 'modules' dependency to ensure modules are built
- Pass the list of modules to the script
Makefile | 1 +
arch/arm64/Makefile | 1 +
scripts/Makefile.lib | 6 +++++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8cd46222fc48..4eccaef95826 100644
--- a/Makefile
+++ b/Makefile
@@ -773,6 +773,7 @@ endif
# Just "make" or "make all" shall build modules as well
modules-targets := all
+modules-targets += $(if $(FIT_MODULES),image.fit)
modules-targets += modules
modules-targets += nsdeps
modules-targets += compile_commands.json
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 73a10f65ce8b..7036f251ab40 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -174,6 +174,7 @@ endif
all: $(notdir $(KBUILD_IMAGE))
image.fit: dtbs
+image.fit: $(if $(FIT_MODULES),modules)
vmlinuz.efi image.fit: Image
$(BOOT_TARGETS): vmlinux
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1d581ba5df66..28e0cc0865b1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -398,11 +398,15 @@ MAKE_FIT := $(srctree)/scripts/make_fit.py
# Use this to override the compression algorithm
FIT_COMPRESSION ?= gzip
+# Set this to non-empty to include an initrd with all the kernel modules
+FIT_MODULES ?=
+
quiet_cmd_fit = FIT $@
cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
- --name '$(UIMAGE_NAME)' \
+ --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
$(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
+ $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
# XZ
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v6 5/8] kbuild: Split out module targets into a variable
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
@ 2025-11-19 20:20 ` Nicolas Schier
2025-11-26 11:10 ` Ahmad Fatoum
1 sibling, 0 replies; 14+ messages in thread
From: Nicolas Schier @ 2025-11-19 20:20 UTC (permalink / raw)
To: Simon Glass
Cc: linux-arm-kernel, Thomas Weißschuh, Masahiro Yamada,
Tom Rini, Ahmad Fatoum, J . Neuschäfer, Chen-Yu Tsai,
Bill Wendling, Justin Stitt, Miguel Ojeda, Nathan Chancellor,
Nick Desaulniers, Tamir Duberstein, linux-kbuild, linux-kernel,
llvm
On Wed, Nov 19, 2025 at 11:13:26AM -0700, Simon Glass wrote:
> Add a modules-targets variable to list the targets which cause modules
> to be built, since we want to add a conditional target.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Add a new patch to split out module targets into a variable
>
> Makefile | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 638bc09a546a..8cd46222fc48 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -772,7 +772,12 @@ endif
> # in addition to whatever we do anyway.
> # Just "make" or "make all" shall build modules as well
>
> -ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),)
> +modules-targets := all
> +modules-targets += modules
> +modules-targets += nsdeps
> +modules-targets += compile_commands.json
> +modules-targets += clang-%
> +ifneq ($(filter $(modules-targets),$(MAKECMDGOALS)),)
> KBUILD_MODULES := y
> endif
>
> --
> 2.43.0
>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
@ 2025-11-19 20:20 ` Nicolas Schier
2025-11-20 7:49 ` Thomas Weißschuh
1 sibling, 0 replies; 14+ messages in thread
From: Nicolas Schier @ 2025-11-19 20:20 UTC (permalink / raw)
To: Simon Glass
Cc: linux-arm-kernel, Thomas Weißschuh, Masahiro Yamada,
Tom Rini, Ahmad Fatoum, J . Neuschäfer, Chen-Yu Tsai,
Nathan Chancellor, Ard Biesheuvel, Catalin Marinas,
Josh Poimboeuf, Kees Cook, Miguel Ojeda, Rong Xu,
Tamir Duberstein, Will Deacon, linux-kbuild, linux-kernel
On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> Support 'make image.fit FIT_MODULES=1' to put all the modules into a
> ramdisk image within the FIT.
>
> Add image.fit as a target which requires modules, so that modules will
> built automatically when using FIT_MODULES is not empty.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Suggested-by: Reviewed-by: Nicolas Schier <nsc@kernel.org>
I think the
Reviewed-by: Nicolas Schier <nsc@kernel.org>
is enough :)
Thanks.
> Acked-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> Changes in v6:
> - Mention that FIT_MODULES just needs to be non-empty
> - Make use of modules.order instead of using 'find'
>
> Changes in v5:
> - Build modules automatically if needed (fix from Nicolas Schier)
>
> Changes in v4:
> - Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
> - Use an empty FIT_MODULES to disable the feature, instead of '0'
> - Make use of the 'modules' dependency to ensure modules are built
> - Pass the list of modules to the script
>
> Makefile | 1 +
> arch/arm64/Makefile | 1 +
> scripts/Makefile.lib | 6 +++++-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 8cd46222fc48..4eccaef95826 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -773,6 +773,7 @@ endif
> # Just "make" or "make all" shall build modules as well
>
> modules-targets := all
> +modules-targets += $(if $(FIT_MODULES),image.fit)
> modules-targets += modules
> modules-targets += nsdeps
> modules-targets += compile_commands.json
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 73a10f65ce8b..7036f251ab40 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -174,6 +174,7 @@ endif
> all: $(notdir $(KBUILD_IMAGE))
>
> image.fit: dtbs
> +image.fit: $(if $(FIT_MODULES),modules)
>
> vmlinuz.efi image.fit: Image
> $(BOOT_TARGETS): vmlinux
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 1d581ba5df66..28e0cc0865b1 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -398,11 +398,15 @@ MAKE_FIT := $(srctree)/scripts/make_fit.py
> # Use this to override the compression algorithm
> FIT_COMPRESSION ?= gzip
>
> +# Set this to non-empty to include an initrd with all the kernel modules
> +FIT_MODULES ?=
> +
> quiet_cmd_fit = FIT $@
> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> - --name '$(UIMAGE_NAME)' \
> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
> --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
>
> # XZ
> --
> 2.43.0
>
--
Nicolas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
2025-11-19 20:20 ` Nicolas Schier
@ 2025-11-20 7:49 ` Thomas Weißschuh
2025-11-20 20:09 ` Nicolas Schier
2025-11-25 21:58 ` Simon Glass
1 sibling, 2 replies; 14+ messages in thread
From: Thomas Weißschuh @ 2025-11-20 7:49 UTC (permalink / raw)
To: Simon Glass
Cc: linux-arm-kernel, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai,
Reviewed-by : Nicolas Schier, Nathan Chancellor, Ard Biesheuvel,
Catalin Marinas, Josh Poimboeuf, Kees Cook, Miguel Ojeda,
Nicolas Schier, Rong Xu, Tamir Duberstein, Will Deacon,
linux-kbuild, linux-kernel
On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> Support 'make image.fit FIT_MODULES=1' to put all the modules into a
> ramdisk image within the FIT.
>
> Add image.fit as a target which requires modules, so that modules will
> built automatically when using FIT_MODULES is not empty.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Suggested-by: Reviewed-by: Nicolas Schier <nsc@kernel.org>
> Acked-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> Changes in v6:
> - Mention that FIT_MODULES just needs to be non-empty
> - Make use of modules.order instead of using 'find'
>
> Changes in v5:
> - Build modules automatically if needed (fix from Nicolas Schier)
>
> Changes in v4:
> - Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
> - Use an empty FIT_MODULES to disable the feature, instead of '0'
> - Make use of the 'modules' dependency to ensure modules are built
> - Pass the list of modules to the script
>
> Makefile | 1 +
> arch/arm64/Makefile | 1 +
> scripts/Makefile.lib | 6 +++++-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 8cd46222fc48..4eccaef95826 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -773,6 +773,7 @@ endif
> # Just "make" or "make all" shall build modules as well
>
> modules-targets := all
> +modules-targets += $(if $(FIT_MODULES),image.fit)
> modules-targets += modules
> modules-targets += nsdeps
> modules-targets += compile_commands.json
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 73a10f65ce8b..7036f251ab40 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -174,6 +174,7 @@ endif
> all: $(notdir $(KBUILD_IMAGE))
>
> image.fit: dtbs
> +image.fit: $(if $(FIT_MODULES),modules)
>
> vmlinuz.efi image.fit: Image
> $(BOOT_TARGETS): vmlinux
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 1d581ba5df66..28e0cc0865b1 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -398,11 +398,15 @@ MAKE_FIT := $(srctree)/scripts/make_fit.py
> # Use this to override the compression algorithm
> FIT_COMPRESSION ?= gzip
>
> +# Set this to non-empty to include an initrd with all the kernel modules
> +FIT_MODULES ?=
> +
> quiet_cmd_fit = FIT $@
> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> - --name '$(UIMAGE_NAME)' \
> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
Remnant of a previous revision?
> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
I am wondering how module dependencies work without the depmod invocation
and modules.dep file.
> --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
>
> # XZ
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-20 7:49 ` Thomas Weißschuh
@ 2025-11-20 20:09 ` Nicolas Schier
2025-11-25 21:58 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: Nicolas Schier @ 2025-11-20 20:09 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Simon Glass, linux-arm-kernel, Masahiro Yamada, Tom Rini,
Ahmad Fatoum, J . Neuschäfer, Chen-Yu Tsai,
Nathan Chancellor, Ard Biesheuvel, Catalin Marinas,
Josh Poimboeuf, Kees Cook, Miguel Ojeda, Rong Xu,
Tamir Duberstein, Will Deacon, linux-kbuild, linux-kernel
On Thu, Nov 20, 2025 at 08:49:14AM +0100, Thomas Weißschuh wrote:
> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> > Support 'make image.fit FIT_MODULES=1' to put all the modules into a
> > ramdisk image within the FIT.
> >
> > Add image.fit as a target which requires modules, so that modules will
> > built automatically when using FIT_MODULES is not empty.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > Suggested-by: Reviewed-by: Nicolas Schier <nsc@kernel.org>
> > Acked-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >
> > Changes in v6:
> > - Mention that FIT_MODULES just needs to be non-empty
> > - Make use of modules.order instead of using 'find'
> >
> > Changes in v5:
> > - Build modules automatically if needed (fix from Nicolas Schier)
> >
> > Changes in v4:
> > - Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
> > - Use an empty FIT_MODULES to disable the feature, instead of '0'
> > - Make use of the 'modules' dependency to ensure modules are built
> > - Pass the list of modules to the script
> >
> > Makefile | 1 +
> > arch/arm64/Makefile | 1 +
> > scripts/Makefile.lib | 6 +++++-
> > 3 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 8cd46222fc48..4eccaef95826 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -773,6 +773,7 @@ endif
> > # Just "make" or "make all" shall build modules as well
> >
> > modules-targets := all
> > +modules-targets += $(if $(FIT_MODULES),image.fit)
> > modules-targets += modules
> > modules-targets += nsdeps
> > modules-targets += compile_commands.json
> > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> > index 73a10f65ce8b..7036f251ab40 100644
> > --- a/arch/arm64/Makefile
> > +++ b/arch/arm64/Makefile
> > @@ -174,6 +174,7 @@ endif
> > all: $(notdir $(KBUILD_IMAGE))
> >
> > image.fit: dtbs
> > +image.fit: $(if $(FIT_MODULES),modules)
> >
> > vmlinuz.efi image.fit: Image
> > $(BOOT_TARGETS): vmlinux
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 1d581ba5df66..28e0cc0865b1 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -398,11 +398,15 @@ MAKE_FIT := $(srctree)/scripts/make_fit.py
> > # Use this to override the compression algorithm
> > FIT_COMPRESSION ?= gzip
> >
> > +# Set this to non-empty to include an initrd with all the kernel modules
> > +FIT_MODULES ?=
> > +
> > quiet_cmd_fit = FIT $@
> > cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> > - --name '$(UIMAGE_NAME)' \
> > + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
>
> Remnant of a previous revision?
>
> > $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> > $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> > + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
>
> I am wondering how module dependencies work without the depmod invocation
> and modules.dep file.
oh, good point. Stripping and signing and module compression is also
done during 'modules_install'.
--
Nicolas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-20 7:49 ` Thomas Weißschuh
2025-11-20 20:09 ` Nicolas Schier
@ 2025-11-25 21:58 ` Simon Glass
2025-11-26 7:16 ` Thomas Weißschuh
1 sibling, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-11-25 21:58 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: linux-arm-kernel, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai,
Reviewed-by : Nicolas Schier, Nathan Chancellor, Ard Biesheuvel,
Catalin Marinas, Josh Poimboeuf, Kees Cook, Miguel Ojeda,
Nicolas Schier, Rong Xu, Tamir Duberstein, Will Deacon,
linux-kbuild, linux-kernel
Hi Thomas,
On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
<thomas.weissschuh@linutronix.de> wrote:
>
> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> > Support 'make image.fit FIT_MODULES=1' to put all the modules into a
> > ramdisk image within the FIT.
> >
> > Add image.fit as a target which requires modules, so that modules will
> > built automatically when using FIT_MODULES is not empty.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > Suggested-by: Reviewed-by: Nicolas Schier <nsc@kernel.org>
> > Acked-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >
> > Changes in v6:
> > - Mention that FIT_MODULES just needs to be non-empty
> > - Make use of modules.order instead of using 'find'
> >
> > Changes in v5:
> > - Build modules automatically if needed (fix from Nicolas Schier)
> >
> > Changes in v4:
> > - Rename the Makefile variable from 'EXTRA' to 'MAKE_FIT_FLAGS'
> > - Use an empty FIT_MODULES to disable the feature, instead of '0'
> > - Make use of the 'modules' dependency to ensure modules are built
> > - Pass the list of modules to the script
> >
> > Makefile | 1 +
> > arch/arm64/Makefile | 1 +
> > scripts/Makefile.lib | 6 +++++-
> > 3 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 8cd46222fc48..4eccaef95826 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -773,6 +773,7 @@ endif
> > # Just "make" or "make all" shall build modules as well
> >
> > modules-targets := all
> > +modules-targets += $(if $(FIT_MODULES),image.fit)
> > modules-targets += modules
> > modules-targets += nsdeps
> > modules-targets += compile_commands.json
> > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> > index 73a10f65ce8b..7036f251ab40 100644
> > --- a/arch/arm64/Makefile
> > +++ b/arch/arm64/Makefile
> > @@ -174,6 +174,7 @@ endif
> > all: $(notdir $(KBUILD_IMAGE))
> >
> > image.fit: dtbs
> > +image.fit: $(if $(FIT_MODULES),modules)
> >
> > vmlinuz.efi image.fit: Image
> > $(BOOT_TARGETS): vmlinux
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 1d581ba5df66..28e0cc0865b1 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -398,11 +398,15 @@ MAKE_FIT := $(srctree)/scripts/make_fit.py
> > # Use this to override the compression algorithm
> > FIT_COMPRESSION ?= gzip
> >
> > +# Set this to non-empty to include an initrd with all the kernel modules
> > +FIT_MODULES ?=
> > +
> > quiet_cmd_fit = FIT $@
> > cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> > - --name '$(UIMAGE_NAME)' \
> > + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
>
> Remnant of a previous revision?
The flags are there to allow extra options to be passed if needed.
>
> > $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> > $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> > + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
>
> I am wondering how module dependencies work without the depmod invocation
> and modules.dep file.
We have a mechanism to place a pre-build initrd with the filesystem,
etc. into the FIT. But for this particular feature (suggested by Ahmad
Fatoum) we are just providing the raw modules. Presumably another
initrd would be needed to provide the startup files?
>
> > --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
> >
> > # XZ
> > --
> > 2.43.0
> >
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-25 21:58 ` Simon Glass
@ 2025-11-26 7:16 ` Thomas Weißschuh
2025-11-26 11:26 ` Ahmad Fatoum
0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2025-11-26 7:16 UTC (permalink / raw)
To: Simon Glass
Cc: linux-arm-kernel, Masahiro Yamada, Tom Rini, Ahmad Fatoum,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Nicolas Schier,
Nathan Chancellor, Ard Biesheuvel, Catalin Marinas,
Josh Poimboeuf, Kees Cook, Miguel Ojeda, Nicolas Schier, Rong Xu,
Tamir Duberstein, Will Deacon, linux-kbuild, linux-kernel
On Tue, Nov 25, 2025 at 02:58:12PM -0700, Simon Glass wrote:
> On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
> <thomas.weissschuh@linutronix.de> wrote:
> >
> > On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
(...)
> > > quiet_cmd_fit = FIT $@
> > > cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> > > - --name '$(UIMAGE_NAME)' \
> > > + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
> >
> > Remnant of a previous revision?
>
> The flags are there to allow extra options to be passed if needed.
Are they necessary for the module functionality added here?
If not I'd put them into a dedicated commit.
> >
> > > $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> > > $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> > > + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
> >
> > I am wondering how module dependencies work without the depmod invocation
> > and modules.dep file.
>
> We have a mechanism to place a pre-build initrd with the filesystem,
> etc. into the FIT. But for this particular feature (suggested by Ahmad
> Fatoum) we are just providing the raw modules. Presumably another
> initrd would be needed to provide the startup files?
modules.dep is more than optional and generic startup files but an integral
part of a module tree. Without it, any module depending on another module's
symbols will fail to load. Also the modules will be unsigned, potentially
making them unloadable. Ahmad's patch does produce a complete and fully
functional module tree by means of 'make headers_install'.
> > > --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
> > >
> > > # XZ
> > > --
> > > 2.43.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 5/8] kbuild: Split out module targets into a variable
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
2025-11-19 20:20 ` Nicolas Schier
@ 2025-11-26 11:10 ` Ahmad Fatoum
1 sibling, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-11-26 11:10 UTC (permalink / raw)
To: Simon Glass, linux-arm-kernel
Cc: Thomas Weißschuh, Masahiro Yamada, Tom Rini,
J . Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Bill Wendling,
Justin Stitt, Miguel Ojeda, Nathan Chancellor, Nick Desaulniers,
Nicolas Schier, Tamir Duberstein, linux-kbuild, linux-kernel,
llvm
On 11/19/25 7:13 PM, Simon Glass wrote:
> Add a modules-targets variable to list the targets which cause modules
> to be built, since we want to add a conditional target.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>
> (no changes since v5)
>
> Changes in v5:
> - Add a new patch to split out module targets into a variable
>
> Makefile | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 638bc09a546a..8cd46222fc48 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -772,7 +772,12 @@ endif
> # in addition to whatever we do anyway.
> # Just "make" or "make all" shall build modules as well
>
> -ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),)
> +modules-targets := all
> +modules-targets += modules
> +modules-targets += nsdeps
> +modules-targets += compile_commands.json
> +modules-targets += clang-%
> +ifneq ($(filter $(modules-targets),$(MAKECMDGOALS)),)
> KBUILD_MODULES := y
> endif
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-26 7:16 ` Thomas Weißschuh
@ 2025-11-26 11:26 ` Ahmad Fatoum
2025-12-02 10:31 ` Thomas Weißschuh
0 siblings, 1 reply; 14+ messages in thread
From: Ahmad Fatoum @ 2025-11-26 11:26 UTC (permalink / raw)
To: Thomas Weißschuh, Simon Glass
Cc: linux-arm-kernel, Masahiro Yamada, Tom Rini, J. Neuschäfer,
Nicolas Schier, Chen-Yu Tsai, Nicolas Schier, Nathan Chancellor,
Ard Biesheuvel, Catalin Marinas, Josh Poimboeuf, Kees Cook,
Miguel Ojeda, Nicolas Schier, Rong Xu, Tamir Duberstein,
Will Deacon, linux-kbuild, linux-kernel
Hi,
On 11/26/25 8:16 AM, Thomas Weißschuh wrote:
> On Tue, Nov 25, 2025 at 02:58:12PM -0700, Simon Glass wrote:
>> On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
>> <thomas.weissschuh@linutronix.de> wrote:
>>>
>>> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
>
> (...)
>
>>>> quiet_cmd_fit = FIT $@
>>>> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
>>>> - --name '$(UIMAGE_NAME)' \
>>>> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
>>>
>>> Remnant of a previous revision?
>>
>> The flags are there to allow extra options to be passed if needed.
>
> Are they necessary for the module functionality added here?
> If not I'd put them into a dedicated commit.
>
>>>
>>>> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
>>>> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
>>>> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
>>>
>>> I am wondering how module dependencies work without the depmod invocation
>>> and modules.dep file.
>>
>> We have a mechanism to place a pre-build initrd with the filesystem,
>> etc. into the FIT. But for this particular feature (suggested by Ahmad
>> Fatoum) we are just providing the raw modules. Presumably another
>> initrd would be needed to provide the startup files?
>
> modules.dep is more than optional and generic startup files but an integral
> part of a module tree. Without it, any module depending on another module's
> symbols will fail to load. Also the modules will be unsigned, potentially
> making them unloadable.
I'll use the occasion to elaborate a bit on why I thought adding modules
is a good idea.
- You have a system boot from FIT and maybe even a r/o rootfs
- You want to boot a different kernel without any userspace changes,
e.g. to bisect
- Fortunately, you have a build target that generates you a FIT with
kernel, enabled device trees and all modules (including deps and such)
- In the bootloader[1], you specify that a CPIO with a minimal init[2]
that bindmounts /lib/modules in the initramfs over the rootfs modules
before pivot_root
and that's it, you are running your new kernel with the old rootfs
unchanged. I believe this would be really handy, which is why I
suggested it.
> Ahmad's patch does produce a complete and fully
> functional module tree by means of 'make headers_install'.
I originally thought that we could generate the CPIO normally as part of
the kernel build and then we can readily depend on it in the rule that
invokes make_fit.py.
If this proves to be too cumbersome, I think it's already an improvement
if the user can manually run make modules-cpio-pkg and then make
image.fit with the initrd specified. A single target would be neater of
course, but I didn't intend for this to stall the series.
It can always follow later.
[1]: For my particular usage, I intend to extend the barebox boot
override mechanism. Currently, it's possible to do:
barebox$ boot -o bootm.initrd=/mnt/tftp/my-ramdisk.cpio /mnt/tftp/my-fit
and I want to extend it to allow appending any number of CPIOs:
barebox$ boot -o bootm.initrd=":/mnt/tftp/my-init.cpio" /mnt/tftp/my-fit
[2]: The bind mount logic for the initramfs init will probably go into
https://github.com/pengutronix/rsinit, which I can compile once per
architecture, put into my TFTP srv path and then not have to worry about it.
Cheers,
Ahmad
>
>>>> --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
>>>>
>>>> # XZ
>>>> --
>>>> 2.43.0
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-11-26 11:26 ` Ahmad Fatoum
@ 2025-12-02 10:31 ` Thomas Weißschuh
2025-12-11 13:31 ` Simon Glass
0 siblings, 1 reply; 14+ messages in thread
From: Thomas Weißschuh @ 2025-12-02 10:31 UTC (permalink / raw)
To: Ahmad Fatoum
Cc: Simon Glass, linux-arm-kernel, Masahiro Yamada, Tom Rini,
J. Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Nicolas Schier,
Nathan Chancellor, Ard Biesheuvel, Catalin Marinas,
Josh Poimboeuf, Kees Cook, Miguel Ojeda, Nicolas Schier, Rong Xu,
Tamir Duberstein, Will Deacon, linux-kbuild, linux-kernel
On Wed, Nov 26, 2025 at 12:26:49PM +0100, Ahmad Fatoum wrote:
> On 11/26/25 8:16 AM, Thomas Weißschuh wrote:
> > On Tue, Nov 25, 2025 at 02:58:12PM -0700, Simon Glass wrote:
> >> On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
> >> <thomas.weissschuh@linutronix.de> wrote:
> >>>
> >>> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> >
> > (...)
> >
> >>>> quiet_cmd_fit = FIT $@
> >>>> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> >>>> - --name '$(UIMAGE_NAME)' \
> >>>> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
> >>>
> >>> Remnant of a previous revision?
> >>
> >> The flags are there to allow extra options to be passed if needed.
> >
> > Are they necessary for the module functionality added here?
> > If not I'd put them into a dedicated commit.
> >
> >>>
> >>>> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> >>>> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> >>>> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
> >>>
> >>> I am wondering how module dependencies work without the depmod invocation
> >>> and modules.dep file.
> >>
> >> We have a mechanism to place a pre-build initrd with the filesystem,
> >> etc. into the FIT. But for this particular feature (suggested by Ahmad
> >> Fatoum) we are just providing the raw modules. Presumably another
> >> initrd would be needed to provide the startup files?
> >
> > modules.dep is more than optional and generic startup files but an integral
> > part of a module tree. Without it, any module depending on another module's
> > symbols will fail to load. Also the modules will be unsigned, potentially
> > making them unloadable.
>
> I'll use the occasion to elaborate a bit on why I thought adding modules
> is a good idea.
>
> - You have a system boot from FIT and maybe even a r/o rootfs
> - You want to boot a different kernel without any userspace changes,
> e.g. to bisect
> - Fortunately, you have a build target that generates you a FIT with
> kernel, enabled device trees and all modules (including deps and such)
> - In the bootloader[1], you specify that a CPIO with a minimal init[2]
> that bindmounts /lib/modules in the initramfs over the rootfs modules
> before pivot_root
>
> and that's it, you are running your new kernel with the old rootfs
> unchanged. I believe this would be really handy, which is why I
> suggested it.
The idea sounds good.
> > Ahmad's patch does produce a complete and fully
> > functional module tree by means of 'make headers_install'.
>
> I originally thought that we could generate the CPIO normally as part of
> the kernel build and then we can readily depend on it in the rule that
> invokes make_fit.py.
That works, but it is not what the patch under discussion does, or did.
> If this proves to be too cumbersome, I think it's already an improvement
> if the user can manually run make modules-cpio-pkg and then make
> image.fit with the initrd specified. A single target would be neater of
> course, but I didn't intend for this to stall the series.
The single target idea would require 'modules-cpio-pkg' to not be a PHONY
target anymore but to properly track dependencies. Otherwise the CPIO and FIT
image will be rebuilt even if no sources change. Proper dependencies are always
better than PHONY targets, but it will be a bit of additional work.
> It can always follow later.
Yep. But for the patch as it is proposed I am still wondering how it will work
without modules.dep and friends.
(...)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-12-02 10:31 ` Thomas Weißschuh
@ 2025-12-11 13:31 ` Simon Glass
2025-12-11 13:49 ` Ahmad Fatoum
0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2025-12-11 13:31 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Ahmad Fatoum, linux-arm-kernel, Masahiro Yamada, Tom Rini,
J. Neuschäfer, Nicolas Schier, Chen-Yu Tsai, Nicolas Schier,
Nathan Chancellor, Ard Biesheuvel, Catalin Marinas,
Josh Poimboeuf, Kees Cook, Miguel Ojeda, Nicolas Schier, Rong Xu,
Tamir Duberstein, Will Deacon, linux-kbuild, linux-kernel
Hi Thomas,
On Tue, 2 Dec 2025 at 03:31, Thomas Weißschuh
<thomas.weissschuh@linutronix.de> wrote:
>
> On Wed, Nov 26, 2025 at 12:26:49PM +0100, Ahmad Fatoum wrote:
> > On 11/26/25 8:16 AM, Thomas Weißschuh wrote:
> > > On Tue, Nov 25, 2025 at 02:58:12PM -0700, Simon Glass wrote:
> > >> On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
> > >> <thomas.weissschuh@linutronix.de> wrote:
> > >>>
> > >>> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
> > >
> > > (...)
> > >
> > >>>> quiet_cmd_fit = FIT $@
> > >>>> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
> > >>>> - --name '$(UIMAGE_NAME)' \
> > >>>> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
> > >>>
> > >>> Remnant of a previous revision?
> > >>
> > >> The flags are there to allow extra options to be passed if needed.
> > >
> > > Are they necessary for the module functionality added here?
> > > If not I'd put them into a dedicated commit.
> > >
> > >>>
> > >>>> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> > >>>> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> > >>>> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
> > >>>
> > >>> I am wondering how module dependencies work without the depmod invocation
> > >>> and modules.dep file.
> > >>
> > >> We have a mechanism to place a pre-build initrd with the filesystem,
> > >> etc. into the FIT. But for this particular feature (suggested by Ahmad
> > >> Fatoum) we are just providing the raw modules. Presumably another
> > >> initrd would be needed to provide the startup files?
> > >
> > > modules.dep is more than optional and generic startup files but an integral
> > > part of a module tree. Without it, any module depending on another module's
> > > symbols will fail to load. Also the modules will be unsigned, potentially
> > > making them unloadable.
> >
> > I'll use the occasion to elaborate a bit on why I thought adding modules
> > is a good idea.
> >
> > - You have a system boot from FIT and maybe even a r/o rootfs
> > - You want to boot a different kernel without any userspace changes,
> > e.g. to bisect
> > - Fortunately, you have a build target that generates you a FIT with
> > kernel, enabled device trees and all modules (including deps and such)
> > - In the bootloader[1], you specify that a CPIO with a minimal init[2]
> > that bindmounts /lib/modules in the initramfs over the rootfs modules
> > before pivot_root
> >
> > and that's it, you are running your new kernel with the old rootfs
> > unchanged. I believe this would be really handy, which is why I
> > suggested it.
>
> The idea sounds good.
>
> > > Ahmad's patch does produce a complete and fully
> > > functional module tree by means of 'make headers_install'.
> >
> > I originally thought that we could generate the CPIO normally as part of
> > the kernel build and then we can readily depend on it in the rule that
> > invokes make_fit.py.
>
> That works, but it is not what the patch under discussion does, or did.
>
> > If this proves to be too cumbersome, I think it's already an improvement
> > if the user can manually run make modules-cpio-pkg and then make
> > image.fit with the initrd specified. A single target would be neater of
> > course, but I didn't intend for this to stall the series.
>
> The single target idea would require 'modules-cpio-pkg' to not be a PHONY
> target anymore but to properly track dependencies. Otherwise the CPIO and FIT
> image will be rebuilt even if no sources change. Proper dependencies are always
> better than PHONY targets, but it will be a bit of additional work.
>
> > It can always follow later.
>
> Yep. But for the patch as it is proposed I am still wondering how it will work
> without modules.dep and friends.
>
> (...)
I'm going to send a v7 and perhaps Ahmad can help to refine this.
Unfortunately the modules generation has turned into a significant
detour. We can either drop it, or continue to try to resolve this.
Regards,
SImon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk
2025-12-11 13:31 ` Simon Glass
@ 2025-12-11 13:49 ` Ahmad Fatoum
0 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-12-11 13:49 UTC (permalink / raw)
To: Simon Glass, Thomas Weißschuh
Cc: linux-arm-kernel, Masahiro Yamada, Tom Rini, J. Neuschäfer,
Chen-Yu Tsai, Nicolas Schier, Nathan Chancellor, Ard Biesheuvel,
Catalin Marinas, Josh Poimboeuf, Kees Cook, Miguel Ojeda,
Nicolas Schier, Rong Xu, Tamir Duberstein, Will Deacon,
linux-kbuild, linux-kernel
Hi Simon,
On 12/11/25 2:31 PM, Simon Glass wrote:
> Hi Thomas,
>
> On Tue, 2 Dec 2025 at 03:31, Thomas Weißschuh
> <thomas.weissschuh@linutronix.de> wrote:
>>
>> On Wed, Nov 26, 2025 at 12:26:49PM +0100, Ahmad Fatoum wrote:
>>> On 11/26/25 8:16 AM, Thomas Weißschuh wrote:
>>>> On Tue, Nov 25, 2025 at 02:58:12PM -0700, Simon Glass wrote:
>>>>> On Thu, 20 Nov 2025 at 00:49, Thomas Weißschuh
>>>>> <thomas.weissschuh@linutronix.de> wrote:
>>>>>>
>>>>>> On Wed, Nov 19, 2025 at 11:13:27AM -0700, Simon Glass wrote:
>>>>
>>>> (...)
>>>>
>>>>>>> quiet_cmd_fit = FIT $@
>>>>>>> cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
>>>>>>> - --name '$(UIMAGE_NAME)' \
>>>>>>> + --name '$(UIMAGE_NAME)' $(MAKE_FIT_FLAGS) \
>>>>>>
>>>>>> Remnant of a previous revision?
>>>>>
>>>>> The flags are there to allow extra options to be passed if needed.
>>>>
>>>> Are they necessary for the module functionality added here?
>>>> If not I'd put them into a dedicated commit.
>>>>
>>>>>>
>>>>>>> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
>>>>>>> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
>>>>>>> + $(if $(FIT_MODULES),--modules @$(objtree)/modules.order) \
>>>>>>
>>>>>> I am wondering how module dependencies work without the depmod invocation
>>>>>> and modules.dep file.
>>>>>
>>>>> We have a mechanism to place a pre-build initrd with the filesystem,
>>>>> etc. into the FIT. But for this particular feature (suggested by Ahmad
>>>>> Fatoum) we are just providing the raw modules. Presumably another
>>>>> initrd would be needed to provide the startup files?
>>>>
>>>> modules.dep is more than optional and generic startup files but an integral
>>>> part of a module tree. Without it, any module depending on another module's
>>>> symbols will fail to load. Also the modules will be unsigned, potentially
>>>> making them unloadable.
>>>
>>> I'll use the occasion to elaborate a bit on why I thought adding modules
>>> is a good idea.
>>>
>>> - You have a system boot from FIT and maybe even a r/o rootfs
>>> - You want to boot a different kernel without any userspace changes,
>>> e.g. to bisect
>>> - Fortunately, you have a build target that generates you a FIT with
>>> kernel, enabled device trees and all modules (including deps and such)
>>> - In the bootloader[1], you specify that a CPIO with a minimal init[2]
>>> that bindmounts /lib/modules in the initramfs over the rootfs modules
>>> before pivot_root
>>>
>>> and that's it, you are running your new kernel with the old rootfs
>>> unchanged. I believe this would be really handy, which is why I
>>> suggested it.
>>
>> The idea sounds good.
>>
>>>> Ahmad's patch does produce a complete and fully
>>>> functional module tree by means of 'make headers_install'.
>>>
>>> I originally thought that we could generate the CPIO normally as part of
>>> the kernel build and then we can readily depend on it in the rule that
>>> invokes make_fit.py.
>>
>> That works, but it is not what the patch under discussion does, or did.
>>
>>> If this proves to be too cumbersome, I think it's already an improvement
>>> if the user can manually run make modules-cpio-pkg and then make
>>> image.fit with the initrd specified. A single target would be neater of
>>> course, but I didn't intend for this to stall the series.
>>
>> The single target idea would require 'modules-cpio-pkg' to not be a PHONY
>> target anymore but to properly track dependencies. Otherwise the CPIO and FIT
>> image will be rebuilt even if no sources change. Proper dependencies are always
>> better than PHONY targets, but it will be a bit of additional work.
>>
>>> It can always follow later.
>>
>> Yep. But for the patch as it is proposed I am still wondering how it will work
>> without modules.dep and friends.
>>
>> (...)
>
> I'm going to send a v7 and perhaps Ahmad can help to refine this.
> Unfortunately the modules generation has turned into a significant
> detour. We can either drop it, or continue to try to resolve this.
I'd suggest to drop it and tackle that separately.
Sorry for the inconvenience,
Ahmad
>
> Regards,
> SImon
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-12-11 13:50 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 18:13 [PATCH v6 0/8] scripts/make_fit: Support ramdisks and faster operations Simon Glass
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
2025-11-19 20:20 ` Nicolas Schier
2025-11-26 11:10 ` Ahmad Fatoum
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
2025-11-19 20:20 ` Nicolas Schier
2025-11-20 7:49 ` Thomas Weißschuh
2025-11-20 20:09 ` Nicolas Schier
2025-11-25 21:58 ` Simon Glass
2025-11-26 7:16 ` Thomas Weißschuh
2025-11-26 11:26 ` Ahmad Fatoum
2025-12-02 10:31 ` Thomas Weißschuh
2025-12-11 13:31 ` Simon Glass
2025-12-11 13:49 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).