Add support for developer config snippets

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-04-19 22:31:15 +02:00
parent 4212a38c3b
commit 2603b0ea1b
5 changed files with 65 additions and 9 deletions
+22 -3
View File
@@ -9,8 +9,10 @@ O ?= output
# otherwise treat it as relative to ./buildroot.
override O := $(if $(filter /%,$O),$O,$(CURDIR)/$O)
config := $(O)/.config
bmake = $(MAKE) -C buildroot O=$(O) $1
config := $(O)/.config
bmake = $(MAKE) -C buildroot O=$(O) $1
SNIPPETS_DIR := $(CURDIR)/configs/snippets
MERGE_CONFIG := $(CURDIR)/buildroot/support/kconfig/merge_config.sh
all: $(config) buildroot/Makefile
@@ -26,6 +28,23 @@ $(config):
@echo "'make <board>_defconfig' before building an image."
@exit 1
apply-%: $(SNIPPETS_DIR)/%.conf | $(config)
@KCONFIG_CONFIG=$(config) $(MERGE_CONFIG) -m $(config) $<
@+$(call bmake,olddefconfig)
@echo "Applied snippet: $<"
list-snippets:
@echo "Available snippets (use 'make apply-<name>'):"
@ls $(SNIPPETS_DIR)/*.conf 2>/dev/null | sed 's|.*/||; s|\.conf$$||; s|^| |'
dev: | $(config)
@for s in $(SNIPPETS_DIR)/*.conf; do \
KCONFIG_CONFIG=$(config) $(MERGE_CONFIG) -m $(config) $$s; \
echo "Applied snippet: $$s"; \
done
@+$(call bmake,olddefconfig)
@+$(call bmake,all)
%: | buildroot/Makefile
@+$(call bmake,$@)
@@ -44,4 +63,4 @@ test:
buildroot/Makefile:
@git submodule update --init
.PHONY: all check coverity dep test cyclonedx
.PHONY: all check coverity dep test cyclonedx list-snippets dev
+1
View File
@@ -0,0 +1 @@
BR2_TARGET_ENABLE_ROOT_LOGIN=y
+3
View File
@@ -0,0 +1,3 @@
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
+35 -5
View File
@@ -7,12 +7,12 @@ account, which is created based on credentials found in the VPD area --
for Qemu devices this is emulated using `qemu_fw_cfg`.
For developers this can be quite frustrating to be blocked from logging
in to debug the system. So we recommend enabling the `root` account in
the Buildroot `make menuconfig` system.
in to debug the system. The quickest way to enable root login is to
apply the `dev` configuration snippet:
make menuconfig
-> System configuration
-> [*]Enable root login with password
make apply-dev
See [Configuration Snippets](#configuration-snippets) for more details.
> [!IMPORTANT]
> Please see the [Contributing](#contributing) section, below, for
@@ -166,6 +166,36 @@ on Buildroot to finalize the target filesystem and generate the images.
The final `run` argument is explained below.
### Configuration Snippets
Infix ships a set of Kconfig fragments in `configs/snippets/` that can
be merged into your active `.config` on demand. This avoids polluting
defconfigs with settings that are only useful during development.
To see what snippets are available:
make list-snippets
To apply a single snippet to the current output directory:
make apply-dev # enable root login
make apply-ext4 # build an ext4 rootfs (needed for boards
# whose bootloader lacks squashfs support,
# e.g. Marvell ESPRESSObin)
The `apply-*` targets require an existing `.config` (i.e. you must have
already run a `make <board>_defconfig`). The snippet is merged using
Buildroot's `merge_config.sh`, so it behaves like `make menuconfig`:
unrelated settings are preserved, conflicting ones are overridden.
To apply **all** snippets at once and then build:
make dev
This is the recommended one-shot command for setting up a development
build from a freshly selected defconfig.
### YANG Model
When making changes to the `confd` and `statd` services, you will often
+4 -1
View File
@@ -1,4 +1,6 @@
#!/bin/sh
# Verify all config/*_defconfig files, skipping any subdirectories,
# e.g., developer snippets not used in official builds.
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
CONFIGS="$SCRIPT_PATH/../../../configs"
@@ -47,6 +49,7 @@ check()
done
}
check "$CONFIGS"/* || exit 1
# shellcheck disable=SC2046
check $(find "$CONFIGS" -maxdepth 1 -type f | LC_ALL=C sort) || exit 1
exit 0