
At present a single .config file is used to configure the build for all phases, with SPL phases having a SPL_ or TPL_ prefix on each CONFIG to indicate which build it controls.
So, for example, we have CONFIG_MISC and CONFIG_SPL_MISC to control the inclusion of MISC drivers in each phase.
From this .config a few other files are generated (by the kconfig tool)
for use with make and from C code (auto.conf and autoconf.h).
This all works well but is a bit ugly in places, for example requiring the use of a SPL_TPL_ macro in Makefiles to distinguish between options intended for SPL and U-Boot proper.
In discussions with trini the idea came up of creating separate config files for each type of build. So instead of using SPL_ or TPL_ prefixes, each build includes its own files with the config it needs.
This series takes a pass at implementing this. It makes only minor changes to the existing Kconfig files, to make things work, but updates the kconfig tool to output seperate files for each phase. These changes may need reworking to send upstream.
With this series, SPL_TPL_ resolves to an empty value, so it is possible to drop this macro.
This cannot be applied as is. Any ad-hoc CONFIG options break the logic in this series, since these are not processed by the kconfig tool. A special xSPL_TPL_ macro is added to show this problem.
A run indicative of the current state (without the last patch, which breaks everything) is here:
https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/9135
Once CONFIG migration is completed, something along these lines can be applied.
Simon Glass (17): env: Avoid checking ENV_IS_IN when env disabled x86: Fix qemu condition for arch_cpu_init() acpi: Add a Kconfig for SPL cmd: Add an SPL Kconfig for CMDLINE and HUSH cros_ec: Add SPL Kconfigs for cros_ec features power: Add SPL Kconfig for sandbox pmc emulator test: Add SPL Kconfig for compression tests sandbox: Enable MISC support for the SPL build serial: Tidy up the Makefile condition for DM_SERIAL virtio: Add SPL Kconfig for virtio kconfig: Refactor code into separate writer functions kconfig: Support writing separate SPL files Makefile: Include the config for the phase being built Makefile: Use empty SPL_ and SPL_TPL_ vars Makefile: Support ad-hoc COMFIX_SPL_IMAGE_SIZE et al kconfig: Update CONFIG_IS_ENABLED() for split files kconfig: Add a new CONFIG() macro
Makefile | 11 +- arch/x86/cpu/qemu/qemu.c | 2 +- cmd/Kconfig | 10 ++ cmd/nvedit.c | 2 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + drivers/core/Kconfig | 5 + drivers/i2c/Kconfig | 10 ++ drivers/power/acpi_pmc/Kconfig | 5 + drivers/serial/Makefile | 2 +- drivers/virtio/Kconfig | 6 + include/linux/kconfig.h | 91 +++------- scripts/Kbuild.include | 17 +- scripts/Makefile.build | 10 +- scripts/Makefile.spl | 33 +++- scripts/kconfig/conf.c | 4 + scripts/kconfig/confdata.c | 286 ++++++++++++++++++++++++++++--- scripts/kconfig/expr.h | 9 + scripts/kconfig/lkc.h | 9 + test/Kconfig | 5 + 20 files changed, 408 insertions(+), 111 deletions(-)