u-boot.mk: add support for config customization
authorPetr Štetiar <ynezz@true.cz>
Fri, 2 Jun 2023 11:54:20 +0000 (13:54 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sat, 10 Jun 2023 19:31:07 +0000 (21:31 +0200)
Make it possible to easily customize U-Boot config options via new
`UBOOT_CUSTOMIZE_CONFIG` variable, so we don't need to patch config
files or override config step with shell hackery.

This generic approach uses `config` CLI to tweak the .config as needed,
for example:

 UBOOT_CUSTOMIZE_CONFIG := \
--enable CMD_EFIDEBUG \
--enable CMD_BOOTMENU \
--enable AUTOBOOT \
--enable AUTOBOOT_MENU_SHOW \
--disable AUTOBOOT_KEYED \
--disable AUTOBOOT_USE_MENUKEY \
--disable BOOTMENU_DISABLE_UBOOT_CONSOLE \
--set-val BOOTDELAY 2

Signed-off-by: Petr Štetiar <ynezz@true.cz>
include/u-boot.mk

index 8945e8e2b8f5682e46bac6d574c3beb761768def..2b8106410f592182ad7dc0691f6cfdd47ec695f1 100644 (file)
@@ -83,6 +83,9 @@ endef
 
 define Build/Configure/U-Boot
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
+       $(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)),
+               $(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG)
+               +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) oldconfig)
 endef
 
 DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)