From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: David Dgien <dgienda125@gmail.com>, Claude <noreply@claude.ai>,
Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 12/13] defaultenv: add barebox_modules_env target
Date: Fri, 16 Jan 2026 17:06:35 +0100 [thread overview]
Message-ID: <20260116160654.3981425-13-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260116160654.3981425-1-a.fatoum@barebox.org>
We want a single file with all modules to make it easier to load them
inside emulation. Add a very simple environment target to facilitate
this.
There may be room for improvement as enabling CONFIG_MODULES_ENVIRONMENT
triggers the rebuild every time, but for experimental feature that's
not enabled by default, it should be acceptable for now.
Co-developed-by: Claude <noreply@claude.ai>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Makefile | 14 ++++++++++++++
common/Kconfig | 14 ++++++++++++++
defaultenv/.gitignore | 1 +
3 files changed, 29 insertions(+)
diff --git a/Makefile b/Makefile
index b6023dc4ff2c..9c70aa0f49a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1341,6 +1341,20 @@ else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
+# Target to build modules environment
+MODULES_ENV_DIR := $(objtree)/.tmp_barebox_modules_env
+CLEAN_DIRS += $(MODULES_ENV_DIR)
+
+barebox_modules_env: modules FORCE
+ $(Q)rm -rf $(MODULES_ENV_DIR)
+ $(Q)$(MAKE) -f $(srctree)/Makefile modules_install MODLIB=$(MODULES_ENV_DIR)
+ $(Q)$(objtree)/scripts/bareboxenv -s $(MODULES_ENV_DIR)/barebox $@
+ $(Q)mv barebox_modules_env $(objtree)/defaultenv/
+
+ifdef CONFIG_MODULES_ENVIRONMENT
+all: barebox_modules_env
+endif
+
else # CONFIG_MODULES
# Modules not configured
diff --git a/common/Kconfig b/common/Kconfig
index d4d9d930a996..50c26695b2b5 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -356,6 +356,20 @@ config MODULES
As modules can't be signed, loading external modules is not
recommended for secure systems.
+config MODULES_ENVIRONMENT
+ bool "Build environment with all modules"
+ depends on MODULES
+ help
+ This option creates a separate environment file (barebox_modules_env)
+ containing all built modules in stripped form. This environment is
+ not built into barebox but can be flashed separately and mounted
+ at runtime to load modules.
+
+ The modules are taken from the barebox/ directory inside $MODLIB
+ after running modules_install and have been stripped.
+
+ If unsure, say n here.
+
config KALLSYMS
depends on HAS_KALLSYMS
bool "kallsyms"
diff --git a/defaultenv/.gitignore b/defaultenv/.gitignore
index d14aa0f494b5..7847b5ce19d6 100644
--- a/defaultenv/.gitignore
+++ b/defaultenv/.gitignore
@@ -2,4 +2,5 @@
barebox_default_env*
barebox_zero_env
+barebox_modules_env
defaultenv-2-ikconfig/
--
2.47.3
next prev parent reply other threads:[~2026-01-16 16:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 16:06 [PATCH 00/13] ARM32: modules: fix bitrot and add test Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 01/13] kbuild: fold rmdirs into rmfiles Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 02/13] boards: qemu-virt: reserve BIOS device tree Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 03/13] ARM: qemu-virt: add image for use as -bios Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 04/13] kbuild: build *.mod.c with -std=gnu11 Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 05/13] ARM32: mark modules as incompatible with ARM_MMU_PERMISSIONS Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 06/13] treewide: fix some missing EXPORT_SYMBOL Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 07/13] pci: ecam: enable build as module Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 08/13] kbuild: add support for installing and stripping modules Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 09/13] ARM32: module: handle more relocations Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 10/13] commands: pm_domain: make command tristate Ahmad Fatoum
2026-01-16 16:06 ` [PATCH 11/13] test: conftest: add support for describing FW_CFG environment in YAML Ahmad Fatoum
2026-01-16 16:06 ` Ahmad Fatoum [this message]
2026-01-16 16:06 ` [PATCH 13/13] test: arm: add simple driver/command module test Ahmad Fatoum
2026-01-19 7:28 ` [PATCH 00/13] ARM32: modules: fix bitrot and add test Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260116160654.3981425-13-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=dgienda125@gmail.com \
--cc=noreply@claude.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox