[PATCH 5/5] linux: add linux-direct-boot-menuconfig target

Daniel Gomez <[email protected]> Fri, 12 Jun 2026 14:18:42 +0200
Newsgroups dev.linux.lists.kdevops
Message-ID <20260612-b4-bootlinux-direct-boot-followups-v1-5-c72537a65d08@samsung.com>
From: Daniel Gomez <[email protected]>

`make menuconfig` against the out-of-tree direct-boot build needs
the same env + make params the actual build uses (LOCALVERSION,
CC=ccache {clang,gcc}, KBUILD_BUILD_*) or the resulting .config
drifts from what the next direct-boot rebuild expects.

Compose the invocation directly in the Makefile from the
CONFIG_BOOTLINUX_* knobs the role defaults already drive
bootlinux_make_params + bootlinux_build_environment from. `make
linux-direct-boot-menuconfig` becomes one Make recipe: cd into the
tree, exec `make O=<build> <vars> menuconfig`. Make's recipe shell
inherits the user's TTY, so the ncurses TUI Just Works.

The original draft round-tripped through ansible to render a
launcher script with the resolved values; pulling the values
straight from .config drops a moving part and makes the recipe
trivially auditable.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 workflows/linux/Makefile | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/workflows/linux/Makefile b/workflows/linux/Makefile
index 38167634..82753ad9 100644
--- a/workflows/linux/Makefile
+++ b/workflows/linux/Makefile
@@ -90,6 +90,10 @@ linux-help-menu:
 	@if [[ "$(CONFIG_BOOTLINUX_9P)" == "y" ]]; then \
 		echo "linux-mount        - Mounts 9p path on targets" ;\
 	fi
+	@if [[ "$(CONFIG_BOOTLINUX_DIRECT_BOOT)" == "y" ]]; then \
+		echo "linux-direct-boot              - Build the kernel into the direct-boot destdir" ;\
+		echo "linux-direct-boot-menuconfig   - Open menuconfig against the direct-boot build dir" ;\
+	fi
 	@echo "linux-deploy       - Builds, installs, updates GRUB and reboots - useful for rapid development"
 	@echo "linux-build        - Builds kernel"
 	@echo "linux-install      - Only builds and installs Linux"
@@ -168,6 +172,37 @@ linux-direct-boot:
 		--tags bootlinux_direct_boot_build \
 		--extra-vars="$(BOOTLINUX_ARGS)"
 
+DIRECT_BOOT_DATA := $(subst ",,$(CONFIG_KDEVOPS_CONTROLLER_DATA_PATH))
+DIRECT_BOOT_TREE := $(subst {{ kdevops_controller_data_path }},$(DIRECT_BOOT_DATA),$(subst ",,$(CONFIG_BOOTLINUX_DIRECT_BOOT_TREE_PATH)))
+DIRECT_BOOT_BUILDDIR := $(subst {{ kdevops_controller_data_path }},$(DIRECT_BOOT_DATA),$(subst ",,$(CONFIG_BOOTLINUX_DIRECT_BOOT_BUILDDIR)))
+DIRECT_BOOT_LOCALVERSION := $(subst ",,$(CONFIG_BOOTLINUX_TREE_LOCALVERSION))
+
+DIRECT_BOOT_MAKE_VARS :=
+ifeq (y,$(CONFIG_BOOTLINUX_CCACHE))
+ifeq (y,$(CONFIG_BOOTLINUX_COMPILER_CLANG))
+DIRECT_BOOT_MAKE_VARS += CC='ccache clang'
+else
+DIRECT_BOOT_MAKE_VARS += CC='ccache gcc'
+endif
+endif
+
+ifeq (y,$(CONFIG_BOOTLINUX_REPRODUCIBLE_BUILDS))
+DIRECT_BOOT_MAKE_VARS += KBUILD_BUILD_TIMESTAMP=''
+DIRECT_BOOT_MAKE_VARS += KBUILD_BUILD_USER=kdevops
+DIRECT_BOOT_MAKE_VARS += KBUILD_BUILD_HOST=kdevops
+endif
+
+# mrproper clears stale in-tree state (.config, include/config, ...)
+# the kernel's outputmakefile check refuses to start an O= build with.
+PHONY += linux-direct-boot-menuconfig
+linux-direct-boot-menuconfig:
+	$(Q)make -C '$(DIRECT_BOOT_TREE)' mrproper
+	$(Q)LOCALVERSION='$(DIRECT_BOOT_LOCALVERSION)' \
+	make --directory='$(DIRECT_BOOT_TREE)' \
+		O='$(DIRECT_BOOT_BUILDDIR)' \
+		$(DIRECT_BOOT_MAKE_VARS) \
+		menuconfig
+
 PHONY += linux-deploy
 linux-deploy:
 	$(Q)ansible-playbook \

-- 
2.54.0