mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Felix Singer <felixsinger@posteo.net>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs
Date: Sun, 12 Jan 2025 09:34:28 +0100	[thread overview]
Message-ID: <20250112083432.320215-10-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250112083432.320215-1-a.fatoum@pengutronix.de>

Instead of having one option per architecture, let's give the existing
BOARD_GENERIC_DT option a prompt and make architecture specific options,
if any, depend on it instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/devicetree/index.rst      |  4 ++--
 Documentation/user/barebox.rst          |  6 +++---
 arch/Kconfig                            | 18 ++++++++++++++++++
 arch/arm/Kconfig                        |  6 +++---
 arch/arm/configs/multi_v5_v6_defconfig  |  2 +-
 arch/arm/configs/rockchip_v7a_defconfig |  2 +-
 arch/arm/configs/rockchip_v8_defconfig  |  2 +-
 arch/arm/configs/rpi_defconfig          |  2 +-
 arch/arm/configs/stm32mp_defconfig      |  2 +-
 arch/riscv/Kconfig                      | 10 +---------
 arch/riscv/Kconfig.socs                 |  2 +-
 arch/riscv/configs/rv64i_defconfig      |  2 +-
 12 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/Documentation/devicetree/index.rst b/Documentation/devicetree/index.rst
index f85ce6608d14..cd9270da1d21 100644
--- a/Documentation/devicetree/index.rst
+++ b/Documentation/devicetree/index.rst
@@ -120,7 +120,7 @@ from the `Device-Tree Compiler`_ project.
 .. _Device-Tree Compiler: https://git.kernel.org/pub/scm/utils/dtc/dtc.git
 
 These utilities are built as part of the barebox build process. Additionally,
-libfdt is compiled once more as part of the ``CONFIG_BOARD_ARM_GENERIC_DT``
+libfdt is compiled once more as part of the ``CONFIG_BOARD_GENERIC_DT``
 if selected.
 
 Steps to update ``scripts/dtc``:
@@ -129,7 +129,7 @@ Steps to update ``scripts/dtc``:
   directory of your barebox ``git-checkout``.
 * Run ``scripts/dtc/update-dtc-source.sh`` from the top-level barebox directory.
 * Wait till ``dtc`` build, test, install and commit conclude.
-* Compile-test with ``CONFIG_BOARD_ARM_GENERIC_DT=y``.
+* Compile-test with ``CONFIG_BOARD_GENERIC_DT=y``.
 * If ``scripts/dtc/Makefile`` or barebox include file changes are necessary,
   apply them manually in a commit preceding the ``dtc`` update.
 
diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 43e5a631ba1a..c6969ae3de1d 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -204,9 +204,9 @@ Bringing barebox to a board for the first time is highly board specific, see you
 board documentation for initial bringup.
 
 For ARM and RISC-V, the barebox build can additionally generate a generic DT image
-(enable ``CONFIG_BOARD_ARM_GENERIC_DT`` or ``CONFIG_BOARD_RISCV_GENERIC_DT``,
-respectively). The resulting ``images/barebox-dt-2nd.img`` can be booted just
-like a Linux kernel that is passed an external device tree. For example:
+(enable ``CONFIG_BOARD_GENERIC_DT``). The resulting ``images/barebox-dt-2nd.img``
+can be booted just like a Linux kernel that is passed an external device tree.
+For example:
 
 .. code-block:: console
 
diff --git a/arch/Kconfig b/arch/Kconfig
index f6ac75eafd11..e1c08bcd7b99 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -29,3 +29,21 @@ config ARCH_LINUX_NAME
 config ARCH_MKIMAGE_NAME
 	string
 	default "invalid"
+
+config HAVE_ARCH_BOARD_GENERIC_DT
+	bool
+
+menu "General architecture-dependent options"
+
+config BOARD_GENERIC_DT
+	depends on HAVE_ARCH_BOARD_GENERIC_DT
+	bool "Build generic device tree 2nd stage image"
+	default y
+	help
+	  This enables compilation of a generic image that can be started 2nd
+	  stage from qemu, barebox, or other bootloaders. It picks up a device
+	  tree passed by the Linux kernel's boot convention for the given
+	  architecture and thus can be used anywhere that a Kernel image could be used.
+	  The image will be called images/barebox-dt-2nd.img
+
+endmenu
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index df730b96b815..1bf30a126dc5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
 	select RELOCATABLE
 	select PBL_RELOCATABLE
 	select USE_COMPRESSED_DTB
+	select HAVE_ARCH_BOARD_GENERIC_DT if OFDEVICE
 	default y
 
 config ARCH_LINUX_NAME
@@ -269,15 +270,14 @@ source "arch/arm/mach-zynqmp/Kconfig"
 
 config BOARD_ARM_VIRT
 	bool
-	select BOARD_ARM_GENERIC_DT
+	select BOARD_GENERIC_DT
 	select BOARD_QEMU_VIRT
 	select OF_OVERLAY
 
 config BOARD_ARM_GENERIC_DT
-	select BOARD_GENERIC_DT
+	def_bool BOARD_GENERIC_DT
 	select ARM_AMBA
 	depends on OFDEVICE
-	bool "Build generic ARM device tree 2nd stage image"
 	help
 	  This enables compilation of a generic image that can be started 2nd
 	  stage from barebox or from qemu. It picks up a device tree passed
diff --git a/arch/arm/configs/multi_v5_v6_defconfig b/arch/arm/configs/multi_v5_v6_defconfig
index d668ad6a8c22..7748ec43b0ce 100644
--- a/arch/arm/configs/multi_v5_v6_defconfig
+++ b/arch/arm/configs/multi_v5_v6_defconfig
@@ -8,7 +8,7 @@ CONFIG_MACH_PCA100=y
 CONFIG_MACH_PCM038=y
 CONFIG_IMX_IIM=y
 CONFIG_IMX_IIM_FUSE_BLOW=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
diff --git a/arch/arm/configs/rockchip_v7a_defconfig b/arch/arm/configs/rockchip_v7a_defconfig
index 5dc41bff3556..378ceb0e43f4 100644
--- a/arch/arm/configs/rockchip_v7a_defconfig
+++ b/arch/arm/configs/rockchip_v7a_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARCH_ROCKCHIP=y
 CONFIG_CACHE_L2X0=y
 CONFIG_MACH_RADXA_ROCK=y
 CONFIG_MACH_PHYTEC_SOM_RK3288=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/configs/rockchip_v8_defconfig b/arch/arm/configs/rockchip_v8_defconfig
index 6dbfd9a49c7f..83799ac492e7 100644
--- a/arch/arm/configs/rockchip_v8_defconfig
+++ b/arch/arm/configs/rockchip_v8_defconfig
@@ -7,7 +7,7 @@ CONFIG_MACH_PROTONIC_MECSBC=y
 CONFIG_MACH_RADXA_ROCK3=y
 CONFIG_MACH_RADXA_ROCK5=y
 CONFIG_MACH_RADXA_CM3=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_64BIT=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_PSCI_CLIENT=y
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 500c92a8218e..b280704ff187 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -3,7 +3,7 @@ CONFIG_MACH_RPI=y
 CONFIG_MACH_RPI2=y
 CONFIG_MACH_RPI3=y
 CONFIG_MACH_RPI_CM3=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 6ca11e5c2d7a..41e6540c55a2 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -7,7 +7,7 @@ CONFIG_MACH_STM32MP15X_EV1=y
 CONFIG_MACH_PROTONIC_STM32MP1=y
 CONFIG_MACH_PROTONIC_STM32MP13=y
 CONFIG_MACH_PHYTEC_PHYCORE_STM32MP1=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index ad724565d7bb..be2146b3facb 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -17,6 +17,7 @@ config RISCV
 	select HAS_KALLSYMS
 	select RISCV_TIMER if RISCV_SBI
 	select HW_HAS_PCI
+	select HAVE_ARCH_BOARD_GENERIC_DT
 
 config ARCH_LINUX_NAME
 	string
@@ -71,15 +72,6 @@ config 64BIT
 	select ARCH_DMA_ADDR_T_64BIT
 	select PHYS_ADDR_T_64BIT
 
-config BOARD_RISCV_GENERIC_DT
-	select BOARD_GENERIC_DT
-	bool "Build generic RISC-V device tree 2nd stage image"
-	help
-	  This enables compilation of a generic image that can be started 2nd
-	  stage from barebox or from qemu. It picks up a device tree passed
-	  in a1 like the Kernel does, so it could be used anywhere where a Kernel
-	  image could be used. The image will be called images/barebox-dt-2nd.img
-
 menu "RISC-V specific settings"
 
 config RISCV_OPTIMZED_STRING_FUNCTIONS
diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index cef9cd52300c..ccda688faf6d 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -18,7 +18,7 @@ config BOARD_ERIZO_GENERIC
 config SOC_VIRT
 	bool "QEMU Virt Machine"
 	select RISCV_S_MODE
-	select BOARD_RISCV_GENERIC_DT
+	select BOARD_GENERIC_DT
 	select HAS_CACHE
 	select HAS_DEBUG_LL
 	help
diff --git a/arch/riscv/configs/rv64i_defconfig b/arch/riscv/configs/rv64i_defconfig
index 53c367c5e415..7f18ec08f37a 100644
--- a/arch/riscv/configs/rv64i_defconfig
+++ b/arch/riscv/configs/rv64i_defconfig
@@ -7,7 +7,7 @@ CONFIG_BOARD_ALLWINNER_D1=y
 CONFIG_BOARD_BEAGLEV=y
 CONFIG_BOARD_BEAGLEV_BETA=y
 CONFIG_BOARD_HIFIVE=y
-CONFIG_BOARD_RISCV_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
 CONFIG_RISCV_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_STACK_SIZE=0x20000
 CONFIG_MALLOC_SIZE=0x0
-- 
2.39.5




  parent reply	other threads:[~2025-01-12  8:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-12  8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 02/13] treewide: collect the name of all board device trees Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 03/13] kbuild: collect available device trees in dtbs-list Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 04/13] scripts: add new scripts_dtc target Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 06/13] kbuild: improve make help description Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 07/13] kbuild: allow dependency on any file in images/ Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig Ahmad Fatoum
2025-01-12  8:34 ` Ahmad Fatoum [this message]
2025-01-12  8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-17  8:32   ` Sascha Hauer
2025-01-17  9:03     ` Ahmad Fatoum
2025-01-20  7:19       ` Sascha Hauer
2025-01-12  8:34 ` [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 12/13] MAKEALL: add support for building arbitrary targets Ahmad Fatoum
2025-01-12  8:34 ` [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit Ahmad Fatoum
2025-01-14  8:18 ` [PATCH 00/13] images: add barebox FIT image target Sascha Hauer
2025-01-21  8:07 ` (subset) " Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250112083432.320215-10-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=felixsinger@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox