* [PATCH 1/8] test: move common config fragments into common/boards/configs
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 2/8] kconfig: merge_config.sh: sync with Linux v6.9 Ahmad Fatoum
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We'll start using these fragments inside Kbuild too for merged defconfigs
to cut down on defconfigs that are largely duplicated, but differ only
in a few options. To share such configs between architectures, we add
common/boards/configs as a common fragment directory here and
standardize on using .config as extension.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
.github/workflows/build-defconfigs.yml | 8 +++++---
.github/workflows/test-labgrid-pytest.yml | 6 ++++--
.../base.cfg => common/boards/configs/base.config | 0
.../boards/configs/disable_size_check.config | 0
.../boards/configs/disable_target_tools.config | 0
.../boards/configs/enable_self_test.config | 0
.../boards/configs/enable_werror.config | 0
.../full.cfg => common/boards/configs/full.config | 0
.../boards/configs/virtio-pci.config | 0
scripts/container.sh | 2 +-
test/emulate.pl | 10 +++++-----
test/x86/virtio@efi_defconfig.yaml | 2 +-
12 files changed, 16 insertions(+), 12 deletions(-)
rename test/kconfig/base.cfg => common/boards/configs/base.config (100%)
rename test/kconfig/disable_size_check.kconf => common/boards/configs/disable_size_check.config (100%)
rename test/kconfig/disable_target_tools.kconf => common/boards/configs/disable_target_tools.config (100%)
rename test/kconfig/enable_self_test.kconf => common/boards/configs/enable_self_test.config (100%)
rename test/kconfig/enable_werror.kconf => common/boards/configs/enable_werror.config (100%)
rename test/kconfig/full.cfg => common/boards/configs/full.config (100%)
rename test/kconfig/virtio-pci.cfg => common/boards/configs/virtio-pci.config (100%)
diff --git a/.github/workflows/build-defconfigs.yml b/.github/workflows/build-defconfigs.yml
index 012852053e87..6690b9db25b8 100644
--- a/.github/workflows/build-defconfigs.yml
+++ b/.github/workflows/build-defconfigs.yml
@@ -39,6 +39,8 @@ jobs:
./test/generate-dummy-fw.sh
- ./MAKEALL -O build-${{matrix.arch}} -k test/kconfig/disable_size_check.kconf \
- -k test/kconfig/disable_target_tools.kconf \
- -k test/kconfig/enable_werror.kconf '${{matrix.config}}'
+ ./MAKEALL -O build-${{matrix.arch}} \
+ -k common/boards/configs/disable_size_check.config \
+ -k common/boards/configs/disable_target_tools.config \
+ -k common/boards/configs/enable_werror.config \
+ '${{matrix.config}}'
diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index 6eb38cc03e6b..21d189880941 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -55,8 +55,10 @@ jobs:
run: |
export ARCH=${{matrix.arch}}
- ./MAKEALL -O build-${{matrix.arch}} -k test/kconfig/enable_self_test.kconf \
- -k test/kconfig/disable_target_tools.kconf ${{matrix.defconfig}}
+ ./MAKEALL -O build-${{matrix.arch}} \
+ -k common/boards/configs/enable_self_test.config \
+ -k common/boards/configs/disable_target_tools.config \
+ ${{matrix.defconfig}}
if [ ${{matrix.arch}} = "riscv" ]; then
cp /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin build-${{matrix.arch}}
diff --git a/test/kconfig/base.cfg b/common/boards/configs/base.config
similarity index 100%
rename from test/kconfig/base.cfg
rename to common/boards/configs/base.config
diff --git a/test/kconfig/disable_size_check.kconf b/common/boards/configs/disable_size_check.config
similarity index 100%
rename from test/kconfig/disable_size_check.kconf
rename to common/boards/configs/disable_size_check.config
diff --git a/test/kconfig/disable_target_tools.kconf b/common/boards/configs/disable_target_tools.config
similarity index 100%
rename from test/kconfig/disable_target_tools.kconf
rename to common/boards/configs/disable_target_tools.config
diff --git a/test/kconfig/enable_self_test.kconf b/common/boards/configs/enable_self_test.config
similarity index 100%
rename from test/kconfig/enable_self_test.kconf
rename to common/boards/configs/enable_self_test.config
diff --git a/test/kconfig/enable_werror.kconf b/common/boards/configs/enable_werror.config
similarity index 100%
rename from test/kconfig/enable_werror.kconf
rename to common/boards/configs/enable_werror.config
diff --git a/test/kconfig/full.cfg b/common/boards/configs/full.config
similarity index 100%
rename from test/kconfig/full.cfg
rename to common/boards/configs/full.config
diff --git a/test/kconfig/virtio-pci.cfg b/common/boards/configs/virtio-pci.config
similarity index 100%
rename from test/kconfig/virtio-pci.cfg
rename to common/boards/configs/virtio-pci.config
diff --git a/scripts/container.sh b/scripts/container.sh
index dff6546c2cf6..6bfb070692f5 100755
--- a/scripts/container.sh
+++ b/scripts/container.sh
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-only
CONTAINER=${CONTAINER:-ghcr.io/barebox/barebox/barebox-ci:latest}
-export KCONFIG_ADD="test/kconfig/disable_target_tools.kconf $KCONFIG_ADD"
+export KCONFIG_ADD="common/boards/configs/disable_target_tools.config $KCONFIG_ADD"
while getopts "c:uh" opt; do
case "$opt" in
diff --git a/test/emulate.pl b/test/emulate.pl
index a4ca6b7aee6e..086fae0f7708 100755
--- a/test/emulate.pl
+++ b/test/emulate.pl
@@ -201,8 +201,8 @@ sub build {
}
}
- push @TUXMAKE_ARGS, "--kconfig-add=test/kconfig/base.cfg" if $kconfig_base || $kconfig_full;
- push @TUXMAKE_ARGS, "--kconfig-add=test/kconfig/full.cfg" if $kconfig_full;
+ push @TUXMAKE_ARGS, "--kconfig-add=common/boards/configs/base.config" if $kconfig_base || $kconfig_full;
+ push @TUXMAKE_ARGS, "--kconfig-add=common/boards/configs/full.config" if $kconfig_full;
for (@kconfig_add) {
push @TUXMAKE_ARGS, "--kconfig-add=$_";
@@ -511,19 +511,19 @@ Supported: null, podman-local, podman, docker, docker-local.
=item B<--no-kconfig-base>
-Don't apply test/kconfig/base.cfg. This may lead to more tests being
+Don't apply common/boards/configs/base.config. This may lead to more tests being
skipped.
=item B<--kconfig-full>
-Applies test/kconfig/full.cfg on top of base.cfg. This enables as much as
+Applies common/boards/configs/full.config on top of base.config. This enables as much as
possible to avoid skipping tests for disabled functionality.
=item B<--kconfig-add>=%s, B<-K>=%s
Extra kconfig fragments, merged on top of the defconfig and Kconfig
fragments described by the YAML. In tree configuration fragment
-(e.g. `test/kconfig/virtio-pci.config`), path to local file, URL,
+(e.g. `common/boards/configs/virtio-pci.config`), path to local file, URL,
`CONFIG_*=[y|m|n]`, or `# CONFIG_* is not set` are supported.
Can be specified multiple times, and will be merged in the order given.
diff --git a/test/x86/virtio@efi_defconfig.yaml b/test/x86/virtio@efi_defconfig.yaml
index 83340d19ddef..9ff4ff5a4e5a 100644
--- a/test/x86/virtio@efi_defconfig.yaml
+++ b/test/x86/virtio@efi_defconfig.yaml
@@ -17,7 +17,7 @@ targets:
runner:
tuxmake_arch: x86_64
kconfig_add:
- - test/kconfig/virtio-pci.cfg
+ - common/boards/configs/virtio-pci.config
- CONFIG_DRIVER_SERIAL_NS16550=y
- CONFIG_CONSOLE_ACTIVATE_FIRST=y # avoid duplicate output
images:
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/8] kconfig: merge_config.sh: sync with Linux v6.9
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 1/8] test: move common config fragments into common/boards/configs Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 3/8] kbuild: add support for merged defconfigs Ahmad Fatoum
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This gives us support for the new -s (strict mode) and -Q (disable
warnings) options. The latter will be used in the follow-up commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/kconfig/merge_config.sh | 40 +++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 63c8565206a4..902eb429b9db 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -28,6 +28,8 @@ usage() {
echo " -r list redundant entries when merging fragments"
echo " -y make builtin have precedence over modules"
echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
+ echo " -s strict mode. Fail if the fragment redefines any value."
+ echo " -Q disable warning messages for overridden options."
echo
echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
}
@@ -37,7 +39,9 @@ ALLTARGET=alldefconfig
WARNREDUN=false
BUILTIN=false
OUTPUT=.
+STRICT=false
CONFIG_PREFIX=${CONFIG_-CONFIG_}
+WARNOVERRIDE=echo
while true; do
case $1 in
@@ -75,6 +79,16 @@ while true; do
shift 2
continue
;;
+ "-s")
+ STRICT=true
+ shift
+ continue
+ ;;
+ "-Q")
+ WARNOVERRIDE=true
+ shift
+ continue
+ ;;
*)
break
;;
@@ -131,18 +145,21 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
BUILTIN_FLAG=false
if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then
- echo Previous value: $PREV_VAL
- echo New value: $NEW_VAL
- echo -y passed, will not demote y to m
- echo
+ ${WARNOVERRIDE} Previous value: $PREV_VAL
+ ${WARNOVERRIDE} New value: $NEW_VAL
+ ${WARNOVERRIDE} -y passed, will not demote y to m
+ ${WARNOVERRIDE}
BUILTIN_FLAG=true
elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
- echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
- echo Previous value: $PREV_VAL
- echo New value: $NEW_VAL
- echo
+ ${WARNOVERRIDE} Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
+ ${WARNOVERRIDE} Previous value: $PREV_VAL
+ ${WARNOVERRIDE} New value: $NEW_VAL
+ ${WARNOVERRIDE}
+ if [ "$STRICT" = "true" ]; then
+ STRICT_MODE_VIOLATED=true
+ fi
elif [ "$WARNREDUN" = "true" ]; then
- echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
+ ${WARNOVERRIDE} Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
fi
if [ "$BUILTIN_FLAG" = "false" ]; then
sed -i "/$CFG[ =]/d" $TMP_FILE
@@ -153,6 +170,11 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
cat $MERGE_FILE >> $TMP_FILE
done
+if [ "$STRICT_MODE_VIOLATED" = "true" ]; then
+ echo "The fragment redefined a value and strict mode had been passed."
+ exit 1
+fi
+
if [ "$RUNMAKE" = "false" ]; then
cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
echo "#"
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/8] kbuild: add support for merged defconfigs
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 1/8] test: move common config fragments into common/boards/configs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 2/8] kconfig: merge_config.sh: sync with Linux v6.9 Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 4/8] MIPS: make use of " Ahmad Fatoum
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We currently use scripts/kconfig/merge_config.sh only in MAKEALL.
Linux has been using it inside Kbuild as well to derive new defconfigs
from the existing ones that differ only by a few options, e.g. to enable
virtualization or to switch endianness.
This is useful for us in barebox as well to cut down on the number of
configs and to avoid bitrot in the less used ones, e.g. a lot of AT91
configs can probably be replaced with two lines in mach-at91/Makefile
each this way.
To support this, let's import scripts/Makefile.defconf from Linux, but
we do some barebox-specific changes on it:
- We include it globally, instead of each architecture including it
- We implement a global way for architecture Makefiles to register
their generated defconfigs, so they are shown in the help text
- We look in common/boards/configs/ for fragments if there is no
architecture-specific fragment with the same name to allow sharing
fragments for common features
As this adds configs that aren't located in the source tree,
scripts/list-defconfigs.sh is adjusted to parse the help text instead,
so CI is aware of the new targets.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 6 +++++-
scripts/Makefile.defconf | 37 +++++++++++++++++++++++++++++++++++++
scripts/list-defconfigs.sh | 20 ++++++++++----------
3 files changed, 52 insertions(+), 11 deletions(-)
create mode 100644 scripts/Makefile.defconf
diff --git a/Makefile b/Makefile
index 517b54bd9e6d..93d0b58341b7 100644
--- a/Makefile
+++ b/Makefile
@@ -535,6 +535,8 @@ ifdef config-build
# *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target
+include $(srctree)/scripts/Makefile.defconf
+
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
# KBUILD_DEFCONFIG may point out an alternative default configuration
# used for 'make defconfig'
@@ -1225,7 +1227,9 @@ PHONY += compile_commands.json
# ---------------------------------------------------------------------------
boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
-boards := $(sort $(notdir $(boards)))
+boards := $(sort $(notdir $(boards)) $(generated_configs))
+
+PHONY += $(generated_configs)
help:
@echo 'Cleaning targets:'
diff --git a/scripts/Makefile.defconf b/scripts/Makefile.defconf
new file mode 100644
index 000000000000..93c848bb5a12
--- /dev/null
+++ b/scripts/Makefile.defconf
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+# Configuration heplers
+
+# Creates 'merged defconfigs'
+# compared to the Linux versions, this also looks for global config fragments
+# in common/boards/configs/ if no global fragments exist.
+# ---------------------------------------------------------------------------
+# Usage:
+# $(call merge_into_defconfig,base_config,config_fragment1 config_fragment2 ...)
+#
+# Input config fragments without '.config' suffix
+define merge_into_defconfig
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
+ -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+ $(foreach config,$(2),$(firstword \
+ $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(config).config) \
+ $(wildcard $(srctree)/common/boards/configs/$(config).config) \
+ ))
+ +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+endef
+
+
+# Creates 'merged defconfigs without warning about overrides'
+# ---------------------------------------------------------------------------
+# Usage:
+# $(call merge_into_defconfig_override,base_config,config_fragment1 config_fragment2 ...)
+#
+# Input config fragments without '.config' suffix
+define merge_into_defconfig_override
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
+ -Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+ $(foreach config,$(2),$(firstword \
+ $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(config).config) \
+ $(wildcard $(srctree)/common/boards/configs/$(config).config) \
+ ))
+ +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+endef
diff --git a/scripts/list-defconfigs.sh b/scripts/list-defconfigs.sh
index eeae9fbfdc30..d7516425f8e3 100755
--- a/scripts/list-defconfigs.sh
+++ b/scripts/list-defconfigs.sh
@@ -2,14 +2,14 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Output json formatted defconfig list for Github Action consumption
+ARCH=${@:-$(for a in arch/*/; do basename $a; done)}
-ARCH=${@:-*}
-
-cd arch
-
-archs=$(for arch in $ARCH; do
- ls -1 $arch/configs | xargs -i printf '{ "arch": "%s", "config": "%s" }\n' \
- "$arch" "{}" | paste -sd ',' -
-done | paste -sd ',' -)
-
-echo '{ "include" : '" [ $archs ] }"
+echo '{ "include" : [ '
+for arch in $ARCH; do
+ make ARCH=$arch CROSS_COMPILE= help | \
+ awk '/_defconfig/ { print $1 }' | \
+ xargs -i printf '{ "arch": "%s", "config": "%s" }\n' \
+ "$arch" "{}" | \
+ paste -sd ',' -
+done | paste -sd ',' -
+echo '] }'
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/8] MIPS: make use of merged defconfigs
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (2 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 3/8] kbuild: add support for merged defconfigs Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-20 10:23 ` [PATCH] fixup! " Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y Ahmad Fatoum
` (4 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Denis Orlov, Ahmad Fatoum
QEmu's Malta emulation can be used in four flavors depending on
endianness and CPU register width. So far we only had two defconfigs and
expected users to adjust the config to arrive at the other two flavors
to cut down on duplication in the config files. Let's use the new merged
defconfigs mechanism instead to merge the configs on the fly.
Cc: Denis Orlov <denorl2009@gmail.com>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Documentation/boards/mips/qemu-malta.rst | 11 +++
arch/mips/Makefile | 8 ++
arch/mips/configs/le.config | 1 +
arch/mips/configs/mips64.config | 2 +
arch/mips/configs/qemu-malta64el_defconfig | 97 ----------------------
5 files changed, 22 insertions(+), 97 deletions(-)
create mode 100644 arch/mips/configs/le.config
create mode 100644 arch/mips/configs/mips64.config
delete mode 100644 arch/mips/configs/qemu-malta64el_defconfig
diff --git a/Documentation/boards/mips/qemu-malta.rst b/Documentation/boards/mips/qemu-malta.rst
index 44f671638d9d..b10a3965998c 100644
--- a/Documentation/boards/mips/qemu-malta.rst
+++ b/Documentation/boards/mips/qemu-malta.rst
@@ -1,6 +1,17 @@
QEMU Malta
==========
+Building barebox for Qemu Malta:
+
+.. code-block:: sh
+
+ export ARCH=mips
+ make ARCH=mips qemu-malta_defconfig # 32-bit, big-endian
+ make ARCH=mips qemu-maltael_defconfig # 32-bit, little-endian
+ make ARCH=mips qemu-malta64_defconfig # 64-bit, big-endian
+ make ARCH=mips qemu-malta64el_defconfig # 64-bit, little-endian
+
+
Big-endian mode
---------------
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 65a00379ab6e..be360c48a359 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -2,6 +2,14 @@
KBUILD_DEFCONFIG := qemu-malta_defconfig
+generated_configs += $(patsubst %, qemu-malta%_defconfig, el 64 64el)
+qemu-maltael_defconfigs:
+ $(call merge_into_defconfig,qemu-malta_defconfig,le)
+qemu-malta64_defconfig:
+ $(call merge_into_defconfig,qemu-malta_defconfig,mips64)
+qemu-malta64el_defconfig:
+ $(call merge_into_defconfig,qemu-malta_defconfig,mips64 le)
+
#
# Select the object file format to substitute into the linker script.
#
diff --git a/arch/mips/configs/le.config b/arch/mips/configs/le.config
new file mode 100644
index 000000000000..ee43fdb3b8f4
--- /dev/null
+++ b/arch/mips/configs/le.config
@@ -0,0 +1 @@
+CONFIG_CPU_LITTLE_ENDIAN=y
diff --git a/arch/mips/configs/mips64.config b/arch/mips/configs/mips64.config
new file mode 100644
index 000000000000..0e80be76cbc6
--- /dev/null
+++ b/arch/mips/configs/mips64.config
@@ -0,0 +1,2 @@
+CONFIG_CPU_MIPS64_R2=y
+CONFIG_64BIT=y
diff --git a/arch/mips/configs/qemu-malta64el_defconfig b/arch/mips/configs/qemu-malta64el_defconfig
deleted file mode 100644
index c1f7366d76d3..000000000000
--- a/arch/mips/configs/qemu-malta64el_defconfig
+++ /dev/null
@@ -1,97 +0,0 @@
-CONFIG_BOARD_QEMU_MALTA=y
-CONFIG_CPU_LITTLE_ENDIAN=y
-CONFIG_CPU_MIPS64_R2=y
-CONFIG_64BIT=y
-CONFIG_IMAGE_COMPRESSION_XZKERN=y
-CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x400000
-CONFIG_STACK_SIZE=0x7000
-CONFIG_EXPERIMENTAL=y
-CONFIG_BAUDRATE=38400
-CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-CONFIG_MENU=y
-CONFIG_BOOTM_SHOW_TYPE=y
-CONFIG_CONSOLE_ALLOW_COLOR=y
-CONFIG_PARTITION_DISK_EFI=y
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_CMD_DMESG=y
-CONFIG_LONGHELP=y
-CONFIG_CMD_IOMEM=y
-CONFIG_CMD_IMD=y
-CONFIG_CMD_MEMINFO=y
-CONFIG_CMD_GO=y
-CONFIG_CMD_LOADB=y
-CONFIG_CMD_LOADY=y
-CONFIG_CMD_RESET=y
-CONFIG_CMD_PARTITION=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_DEFAULTENV=y
-CONFIG_CMD_LOADENV=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_MD5SUM=y
-CONFIG_CMD_SHA1SUM=y
-CONFIG_CMD_SHA256SUM=y
-CONFIG_CMD_UNCOMPRESS=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MIITOOL=y
-CONFIG_CMD_PING=y
-CONFIG_CMD_TFTP=y
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_LOGIN=y
-CONFIG_CMD_MENU=y
-CONFIG_CMD_MENU_MANAGEMENT=y
-CONFIG_CMD_PASSWD=y
-CONFIG_CMD_FBTEST=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_TIMEOUT=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_FLASH=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_OF_NODE=y
-CONFIG_CMD_OF_PROPERTY=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_TIME=y
-CONFIG_NET=y
-CONFIG_NET_NFS=y
-CONFIG_NET_NETCONSOLE=y
-CONFIG_OFDEVICE=y
-CONFIG_OF_BAREBOX_DRIVERS=y
-CONFIG_VIRTIO_CONSOLE=y
-CONFIG_DRIVER_NET_E1000=y
-CONFIG_DRIVER_NET_RTL8139=y
-CONFIG_DRIVER_NET_VIRTIO=y
-# CONFIG_SPI is not set
-CONFIG_I2C=y
-CONFIG_I2C_GPIO=y
-CONFIG_MTD=y
-CONFIG_DRIVER_CFI=y
-# CONFIG_DRIVER_CFI_AMD is not set
-# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
-# CONFIG_DRIVER_CFI_BANK_WIDTH_2 is not set
-CONFIG_CFI_BUFFER_WRITE=y
-CONFIG_DISK=y
-CONFIG_VIRTIO_BLK=y
-CONFIG_VIDEO=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
-CONFIG_VIRTIO_INPUT=y
-CONFIG_HWRNG=y
-CONFIG_HW_RANDOM_VIRTIO=y
-CONFIG_GPIO_MALTA_FPGA_I2C=y
-CONFIG_PCI=y
-CONFIG_PCI_DEBUG=y
-CONFIG_SYSCON_REBOOT_MODE=y
-CONFIG_POWER_RESET_SYSCON=y
-CONFIG_VIRTIO_PCI=y
-CONFIG_FS_CRAMFS=y
-CONFIG_FS_EXT4=y
-CONFIG_FS_TFTP=y
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
-CONFIG_FS_FAT_LFN=y
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] fixup! MIPS: make use of merged defconfigs
2024-05-17 13:26 ` [PATCH 4/8] MIPS: make use of " Ahmad Fatoum
@ 2024-05-20 10:23 ` Ahmad Fatoum
0 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-20 10:23 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Fix a typo in the target name.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/mips/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index be360c48a359..67d355e0ad81 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -3,7 +3,7 @@
KBUILD_DEFCONFIG := qemu-malta_defconfig
generated_configs += $(patsubst %, qemu-malta%_defconfig, el 64 64el)
-qemu-maltael_defconfigs:
+qemu-maltael_defconfig:
$(call merge_into_defconfig,qemu-malta_defconfig,le)
qemu-malta64_defconfig:
$(call merge_into_defconfig,qemu-malta_defconfig,mips64)
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (3 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 4/8] MIPS: make use of " Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 6/8] net: fix build with CONFIG_SHELL_NONE Ahmad Fatoum
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
While sandbox defines arch_ctrlc() unconditionally, ctrlc() is not
defined when CONFIG_CONSOLE_NONE=y for all architectures, so we need the
inline stub on sandbox too to avoid a link error.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/stdio.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/stdio.h b/include/stdio.h
index b6ded805cc21..d53f29039376 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -60,13 +60,11 @@ static inline int vprintf(const char *fmt, va_list args)
return 0;
}
-#ifndef CONFIG_ARCH_HAS_CTRLC
/* test if ctrl-c was pressed */
static inline int ctrlc (void)
{
return 0;
}
-#endif /* CONFIG_ARCH_HAS_CTRLC */
#endif
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 6/8] net: fix build with CONFIG_SHELL_NONE
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (4 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar Ahmad Fatoum
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Some common networking code like fastboot over UDP calls ifup_all(0) to
bring up all interfaces. ifup_all(0) in turn runs commands to execute
interface discovery scripts and source network configurations.
This leads to a link error, because run_command is not defined in a
CONFIG_SHELL_NONE build as it lacks CONFIG_COMMAND_SUPPORT.
Fix this by adding inline stubs that fail for run_command and friends.
This way ifup_all(0) will either fail if there is a script that should
be run, but couldn't or just succeed if there are no applicable scripts
anyway.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/command.h | 8 ++++++++
net/Kconfig | 1 -
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/command.h b/include/command.h
index 9226756cc00b..26e06077b071 100644
--- a/include/command.h
+++ b/include/command.h
@@ -15,6 +15,7 @@
#include <linux/compiler_types.h>
#include <linux/stddef.h>
#include <string.h>
+#include <errno.h>
#ifndef __ASSEMBLY__
@@ -49,10 +50,17 @@ extern struct command * const __barebox_cmd_end[];
/* common/command.c */
+#ifdef CONFIG_COMMAND_SUPPORT
struct command *find_cmd(const char *cmd);
int execute_command(int argc, char **argv);
void barebox_cmd_usage(struct command *cmdtp);
int run_command(const char *cmd);
+#else
+static inline struct command *find_cmd(const char *cmd) { return NULL; }
+static inline int execute_command(int argc, char **argv) { return -ENOSYS; }
+static inline void barebox_cmd_usage(struct command *cmdtp) {}
+static inline int run_command(const char *cmd) { return -ENOSYS; }
+#endif
#define COMMAND_SUCCESS 0
#define COMMAND_ERROR 1
diff --git a/net/Kconfig b/net/Kconfig
index 07e623670e22..c13ee8bb43d8 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -40,7 +40,6 @@ config NET_RESOLV
config NET_IFUP
default y
- depends on !SHELL_NONE
bool
config NET_DHCP
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (5 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 6/8] net: fix build with CONFIG_SHELL_NONE Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 8/8] sandbox: add headless_defconfig Ahmad Fatoum
2024-05-21 6:20 ` [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Sascha Hauer
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The reboot_mode_add_globalvar initcall would run even without
CONFIG_GLOBALVAR if it didn't fail at link time, because it references
the global_device. Fix this by only registering the initcall if global
variable support is enabled.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/power/reset/reboot-mode.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 7f940a2d8843..b52e7ec0dc27 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -71,7 +71,7 @@ static int of_reboot_mode_fixup(struct device_node *root, void *ctx)
return 0;
}
-static int reboot_mode_add_globalvar(void)
+static __maybe_unused int reboot_mode_add_globalvar(void)
{
struct reboot_mode_driver *reboot = __boot_mode;
@@ -83,8 +83,9 @@ static int reboot_mode_add_globalvar(void)
return reboot_mode_add_param(&global_device, "system.reboot_mode.", reboot);
}
+#ifdef CONFIG_GLOBALVAR
late_initcall(reboot_mode_add_globalvar);
-
+#endif
static void reboot_mode_print(struct reboot_mode_driver *reboot,
const char *prefix, const u32 *arr)
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 8/8] sandbox: add headless_defconfig
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (6 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar Ahmad Fatoum
@ 2024-05-17 13:26 ` Ahmad Fatoum
2024-05-21 6:20 ` [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Sascha Hauer
8 siblings, 0 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2024-05-17 13:26 UTC (permalink / raw)
To: barebox; +Cc: Steffen Hemer, Ahmad Fatoum
Build with no console whatsoever is not a common configuration for
development, but is used in some verified boot scenarios. Some
configurations go even further and disable the shell altogether.
Add headless.config and noshell.config fragments that describes these
configurations and sandbox targets that makes use of them.
This will be automatically found by CI and built to ensure that we
don't inadvertently break CONFIG_CONSOLE_NONE and CONFIG_SHELL_NONE
without noticing.
Platforms with CONFIG_CONSOLE_NONE are also likely to disable the
DEFAULT_ENVIRONMENT, so this is added to headless_defconfig as well.
More options can be added to the configs as needed to increase CI's
build coverage.
Cc: Steffen Hemer <S.Hemer@phytec.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/Makefile | 8 ++++++++
common/boards/configs/headless.config | 3 +++
common/boards/configs/noshell.config | 2 ++
3 files changed, 13 insertions(+)
create mode 100644 common/boards/configs/headless.config
create mode 100644 common/boards/configs/noshell.config
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index c2906c0b1c0c..d5327d44e097 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -2,6 +2,14 @@
KBUILD_DEFCONFIG := sandbox_defconfig
+generated_configs += headless_defconfig noshell_defconfig lockdown_defconfig
+headless_defconfig:
+ $(call merge_into_defconfig,sandbox_defconfig,headless)
+noshell_defconfig:
+ $(call merge_into_defconfig,sandbox_defconfig,noshell)
+lockdown_defconfig:
+ $(call merge_into_defconfig,sandbox_defconfig,headless noshell)
+
KBUILD_CPPFLAGS += -D__SANDBOX__ -fno-strict-aliasing -fvisibility=hidden
diff --git a/common/boards/configs/headless.config b/common/boards/configs/headless.config
new file mode 100644
index 000000000000..f1eb1e6fa717
--- /dev/null
+++ b/common/boards/configs/headless.config
@@ -0,0 +1,3 @@
+CONFIG_CONSOLE_NONE=y
+# CONFIG_ENV_HANDLING is not set
+CONFIG_DEFAULT_ENVIRONMENT=y
diff --git a/common/boards/configs/noshell.config b/common/boards/configs/noshell.config
new file mode 100644
index 000000000000..4696a1b3f971
--- /dev/null
+++ b/common/boards/configs/noshell.config
@@ -0,0 +1,2 @@
+CONFIG_SHELL_NONE=y
+# CONFIG_DISABLE_INPUT is not set
--
2.39.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
` (7 preceding siblings ...)
2024-05-17 13:26 ` [PATCH 8/8] sandbox: add headless_defconfig Ahmad Fatoum
@ 2024-05-21 6:20 ` Sascha Hauer
8 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2024-05-21 6:20 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Fri, 17 May 2024 15:26:48 +0200, Ahmad Fatoum wrote:
> We currently use scripts/kconfig/merge_config.sh only in MAKEALL.
> Linux has been using it inside Kbuild as well to derive new defconfigs
> from the existing ones that differ only by a few options, e.g. to enable
> virtualization or to switch endianness.
>
> This is useful for us in barebox as well to cut down on the number of
> configs and to avoid bitrot in the less used ones, e.g. a lot of AT91
> configs can probably be replaced with two lines in mach-at91/Makefile
> each this way and e.g. x86 defconfig could have a virtio.defconfig for
> use with Qemu.
>
> [...]
Applied, thanks!
[1/8] test: move common config fragments into common/boards/configs
https://git.pengutronix.de/cgit/barebox/commit/?id=2f186d23e1d3 (link may not be stable)
[2/8] kconfig: merge_config.sh: sync with Linux v6.9
https://git.pengutronix.de/cgit/barebox/commit/?id=0097b2cd7b51 (link may not be stable)
[3/8] kbuild: add support for merged defconfigs
https://git.pengutronix.de/cgit/barebox/commit/?id=520af236cb7c (link may not be stable)
[4/8] MIPS: make use of merged defconfigs
https://git.pengutronix.de/cgit/barebox/commit/?id=fb1007c0343a (link may not be stable)
[5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y
https://git.pengutronix.de/cgit/barebox/commit/?id=c71726d70bf4 (link may not be stable)
[6/8] net: fix build with CONFIG_SHELL_NONE
https://git.pengutronix.de/cgit/barebox/commit/?id=bcccae97ac40 (link may not be stable)
[7/8] power: reset: reboot-mode: fix link error without globalvar
https://git.pengutronix.de/cgit/barebox/commit/?id=bf80cd13fa5c (link may not be stable)
[8/8] sandbox: add headless_defconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=15af24567132 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 11+ messages in thread