We have had experimental module support in barebox for quite a while, but AFAIK it doesn't see much real world usage and thus bitrots over time.
One use case I see for modules though is systems, where we want to fit barebox prebootloader + compressed barebox proper into SRAM to avoid the need for a PBL-only eMMC driver for example. In these cases, it would be quite useful if we could strip barebox to the bare minimum amount of drivers and just load e.g. network driver on demand. There's a number of things we need before that though: At least support for W^X (CONFIG_ARM_MMU_PERMISSIONS), ARM64 support and support for module signature verification. But for now, let's ensure the support we already have doesn't deteriorate further and fix some bitrot accumulated so far and add a test to the test suite to verify module loading continues to work in future as well. The test is also wired into CI, so it runs on every push (and Github pull request). Ahmad Fatoum (12): boards: qemu-virt: reserve BIOS device tree ARM: qemu-virt: add image for use as -bios kbuild: build *.mod.c with -std=gnu11 ARM32: mark modules as incompatible with ARM_MMU_PERMISSIONS treewide: fix some missing EXPORT_SYMBOL pci: ecam: enable build as module kbuild: add support for installing and stripping modules ARM32: module: handle more relocations commands: pm_domain: make command tristate test: conftest: add support for describing FW_CFG environment in YAML defaultenv: add barebox_modules_env target test: arm: add simple driver/command module test .github/workflows/test-labgrid-pytest.yml | 4 + Makefile | 31 +-- arch/arm/boards/Makefile | 1 + arch/arm/boards/qemu-virt/Makefile | 2 +- arch/arm/boards/qemu-virt/lowlevel.c | 80 ++++++++ arch/arm/configs/modules32_defconfig | 230 ++++++++++++++++++++++ arch/arm/cpu/Kconfig | 2 +- arch/arm/include/asm/elf.h | 2 + arch/arm/lib32/Makefile | 1 + arch/arm/lib32/module.c | 20 ++ arch/arm/lib32/string.c | 7 + commands/Kconfig | 2 +- common/Kconfig | 14 ++ common/bbu.c | 1 + common/block.c | 2 + common/boards/qemu-virt/board.c | 32 +++ common/firmware.c | 1 + common/globalvar.c | 1 + common/machine_id.c | 1 + common/memory.c | 1 + common/structio.c | 3 + conftest.py | 19 ++ defaultenv/.gitignore | 1 + drivers/base/bus.c | 2 + drivers/base/class.c | 1 + drivers/base/driver.c | 1 + drivers/base/platform.c | 1 + drivers/base/power.c | 2 + drivers/clk/clk-bulk.c | 2 +- drivers/clk/clk.c | 1 + drivers/firmware/arm_scmi/driver.c | 1 + drivers/gpio/gpiolib.c | 2 +- drivers/hw_random/core.c | 1 + drivers/mtd/core.c | 1 + drivers/net/dsa.c | 1 + drivers/nvmem/core.c | 1 + drivers/of/base.c | 3 +- drivers/pci/Kconfig | 2 +- drivers/pci/pci.c | 2 + drivers/pinctrl/pinctrl.c | 1 + drivers/video/fb.c | 1 + fs/pstore/platform.c | 1 + images/Makefile.vexpress | 5 + include/compressed-dtb.h | 1 + lib/parameter.c | 1 + lib/string.c | 2 + lib/stringlist.c | 3 + lib/ucs2_string.c | 2 +- net/eth.c | 1 + net/net.c | 1 + scripts/Makefile.modinst | 67 +++++++ test/arm/modules32_defconfig.yaml | 27 +++ test/arm/virt-el2@multi_v8_defconfig.yaml | 23 +++ test/arm/virt@multi_v8_defconfig.yaml | 4 +- test/py/test_module.py | 54 +++++ 55 files changed, 653 insertions(+), 23 deletions(-) create mode 100644 arch/arm/boards/qemu-virt/lowlevel.c create mode 100644 arch/arm/configs/modules32_defconfig create mode 100644 arch/arm/lib32/string.c create mode 100644 scripts/Makefile.modinst create mode 100644 test/arm/modules32_defconfig.yaml create mode 100644 test/arm/virt-el2@multi_v8_defconfig.yaml create mode 100644 test/py/test_module.py -- 2.47.3
