mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] Compile boards only when firmware is present
@ 2023-04-26  9:03 Sascha Hauer
  2023-04-26  9:03 ` [PATCH 1/3] Kconfig: source Kconfig.include earlier Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-04-26  9:03 UTC (permalink / raw)
  To: Barebox List

We have recently introduced ARM multi_*_defconfig files to compile
for multiple SoC families in a single config. Before these can
successfully be compiled a bunch of firmware files need to be present
in the source tree. This can be inconvenient for users as they have
to grab the firmware files from several sources before they can
compile these configs, even though they might be only interested
in a single board.

To solve this make the boards depending on a firmware file selectable
only when the firmware is actually present. With this the
multi_*_defconfigs can always be built. Boards with missing firmware
files will be skipped from compilation automatically.

The next step might be to introduce a Kconfig option (or use existing
COMPILE_TEST option) to provide dummy files for the missing firmware
files which could help for compile testing.

Sascha

Sascha Hauer (3):
  Kconfig: source Kconfig.include earlier
  ARM: Rockchip: make boards only selectable when firmware is present
  ARM: i.MX: make boards selectable only when firmware files are present

 Kconfig                        |  2 +
 arch/arm/mach-imx/Kconfig      | 74 ++++++++++++++++++++++------------
 arch/arm/mach-rockchip/Kconfig | 11 +++--
 firmware/Kconfig               | 21 ++++++++++
 lib/kasan/Kconfig              |  2 -
 5 files changed, 80 insertions(+), 30 deletions(-)

-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Kconfig: source Kconfig.include earlier
  2023-04-26  9:03 [PATCH 0/3] Compile boards only when firmware is present Sascha Hauer
@ 2023-04-26  9:03 ` Sascha Hauer
  2023-04-26  9:03 ` [PATCH 2/3] ARM: Rockchip: make boards only selectable when firmware is present Sascha Hauer
  2023-04-26  9:03 ` [PATCH 3/3] ARM: i.MX: make boards selectable only when firmware files are present Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-04-26  9:03 UTC (permalink / raw)
  To: Barebox List

kconfig.include is included where first needed. Include it at the top
so that all Kconfig files can use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Kconfig           | 2 ++
 lib/kasan/Kconfig | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Kconfig b/Kconfig
index 7e9b892129..49bd17c89f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -6,6 +6,8 @@
 #
 mainmenu "Barebox/$(ARCH) $(KERNELVERSION) Configuration"
 
+source "scripts/Kconfig.include"
+
 source "arch/$(SRCARCH)/Kconfig"
 
 source "common/Kconfig"
diff --git a/lib/kasan/Kconfig b/lib/kasan/Kconfig
index 46fc4f263b..e96638304c 100644
--- a/lib/kasan/Kconfig
+++ b/lib/kasan/Kconfig
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-source "scripts/Kconfig.include"
-
 config HAVE_ARCH_KASAN
 	bool
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ARM: Rockchip: make boards only selectable when firmware is present
  2023-04-26  9:03 [PATCH 0/3] Compile boards only when firmware is present Sascha Hauer
  2023-04-26  9:03 ` [PATCH 1/3] Kconfig: source Kconfig.include earlier Sascha Hauer
@ 2023-04-26  9:03 ` Sascha Hauer
  2023-04-26  9:03 ` [PATCH 3/3] ARM: i.MX: make boards selectable only when firmware files are present Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-04-26  9:03 UTC (permalink / raw)
  To: Barebox List

The RK356x based boards need a sdram-init.bin file in the board
directory. Make the boards selectable only when the file is present
to avoid failing compilation when the file is missing.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-rockchip/Kconfig | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 0bce83ecee..7acbd87473 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -69,30 +69,35 @@ if 64BIT
 
 config MACH_RK3568_EVB
 	select ARCH_RK3568
+	depends on $(success,test -e $(srctree)/arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin)
 	bool "RK3568 EVB"
 	help
 	  Say Y here if you are using a RK3568 EVB
 
 config MACH_RK3568_BPI_R2PRO
 	select ARCH_RK3568
+	depends on $(success,test -e $(srctree)/arch/arm/boards/rockchip-rk3568-bpi-r2pro/sdram-init.bin)
 	bool "RK3568 BPI R2PRO"
 	help
 	  Say Y here if you are using a RK3568 Bananpi R2 Pro
 
 config MACH_PINE64_QUARTZ64
 	select ARCH_RK3568
+	depends on $(success,test -e $(srctree)/arch/arm/boards/pine64-quartz64/sdram-init.bin)
 	bool "Pine64 Quartz64"
 	help
 	  Say Y here if you are using a Pine64 Quartz64
 
 config MACH_RADXA_ROCK3
-       select ARCH_RK3568
-       bool "Radxa ROCK3"
-       help
+	select ARCH_RK3568
+	depends on $(success,test -e $(srctree)/arch/arm/boards/radxa-rock3/sdram-init.bin)
+	bool "Radxa ROCK3"
+	help
 	  Say Y here if you are using a Radxa ROCK3
 
 config MACH_RADXA_CM3
 	select ARCH_RK3568
+	depends on $(success,test -e $(srctree)/arch/arm/boards/radxa-cm3/sdram-init.bin)
 	bool "Radxa CM3"
 	help
 	  Say Y here if you are using a Radxa CM3
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ARM: i.MX: make boards selectable only when firmware files are present
  2023-04-26  9:03 [PATCH 0/3] Compile boards only when firmware is present Sascha Hauer
  2023-04-26  9:03 ` [PATCH 1/3] Kconfig: source Kconfig.include earlier Sascha Hauer
  2023-04-26  9:03 ` [PATCH 2/3] ARM: Rockchip: make boards only selectable when firmware is present Sascha Hauer
@ 2023-04-26  9:03 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-04-26  9:03 UTC (permalink / raw)
  To: Barebox List

Some i.MX boards need firmware files in the source tree. Make the boards
depending on firmware files selectable only when the firmware is there
to avoid failing compilation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/Kconfig | 74 ++++++++++++++++++++++++++-------------
 firmware/Kconfig          | 21 +++++++++++
 2 files changed, 70 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ef0e5fc561..e10e84faa7 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -555,11 +555,35 @@ if 64BIT
 
 comment "i.MX8M boards"
 
+if !FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+comment "LPDDR4 firmware files missing, some boards are not selectable"
+endif
+
+if !FIRMWARE_IMX_DDR4_PMU_TRAIN
+comment "DDR4 firmware files missing, some boards are not selectable"
+endif
+
+if !FIRMWARE_IMX8MM_ATF
+comment "i.MX8MM TF-A files missing, i.MX8MM boards are disabled"
+endif
+
+if !FIRMWARE_IMX8MQ_ATF
+comment "i.MX8MQ TF-A files missing, i.MX8MQ boards are disabled"
+endif
+
+if !FIRMWARE_IMX8MN_ATF
+comment "i.MX8MN TF-A files missing, i.MX8MN boards are disabled"
+endif
+
+if !FIRMWARE_IMX8MP_ATF
+comment "i.MX8MP TF-A files missing, i.MX8MP boards are disabled"
+endif
+
 config MACH_INNOCOMM_WB15
 	bool "InnoComm WB15 (i.MX8MM) EVK"
 	select ARCH_IMX8MM
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MM_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MM_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -570,8 +594,8 @@ config MACH_INNOCOMM_WB15
 config MACH_MNT_REFORM
 	bool "MNT Reform"
 	select ARCH_IMX8MQ
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MQ_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MQ_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select I2C_IMX_EARLY
@@ -579,8 +603,8 @@ config MACH_MNT_REFORM
 config MACH_NXP_IMX8MM_EVK
 	bool "NXP i.MX8MM EVK Board"
 	select ARCH_IMX8MM
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MM_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MM_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -590,9 +614,9 @@ config MACH_NXP_IMX8MM_EVK
 config MACH_NXP_IMX8MN_EVK
 	bool "NXP i.MX8MN EVK Board"
 	select ARCH_IMX8MN
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX_DDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MN_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX_DDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MN_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -601,8 +625,8 @@ config MACH_NXP_IMX8MN_EVK
 config MACH_NXP_IMX8MP_EVK
 	bool "NXP i.MX8MP EVK Board"
 	select ARCH_IMX8MP
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MP_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MP_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -611,24 +635,24 @@ config MACH_NXP_IMX8MP_EVK
 config MACH_NXP_IMX8MQ_EVK
 	bool "NXP i.MX8MQ EVK Board"
 	select ARCH_IMX8MQ
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MQ_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MQ_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 
 config MACH_PHYTEC_SOM_IMX8MQ
 	bool "Phytec i.MX8M SOM"
 	select ARCH_IMX8MQ
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MQ_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MQ_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 
 config MACH_POLYHEX_DEBIX
 	bool "Polyhex DEBIX Model-A/B (i.MX8MP) Board"
 	select ARCH_IMX8MP
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MP_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MP_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -637,8 +661,8 @@ config MACH_POLYHEX_DEBIX
 config MACH_PROTONIC_IMX8M
 	bool "Protonic-Holland i.MX8Mx based boards"
 	select ARCH_IMX8MM
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MM_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MM_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -647,8 +671,8 @@ config MACH_PROTONIC_IMX8M
 config MACH_TQ_MBA8MPXL
 	bool "TQ i.MX8MP Dual/Quad on MBa8MPxL Board"
 	select ARCH_IMX8MP
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MP_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MP_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -657,8 +681,8 @@ config MACH_TQ_MBA8MPXL
 config MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP
 	bool "Variscite DT8MCustomBoard with DART-MX8M-PLUS"
 	select ARCH_IMX8MP
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MP_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MP_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select IMX8M_DRAM
@@ -667,8 +691,8 @@ config MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP
 config MACH_ZII_IMX8MQ_DEV
 	bool "ZII i.MX8MQ based devices"
 	select ARCH_IMX8MQ
-	select FIRMWARE_IMX_LPDDR4_PMU_TRAIN
-	select FIRMWARE_IMX8MQ_ATF
+	depends on FIRMWARE_IMX_LPDDR4_PMU_TRAIN
+	depends on FIRMWARE_IMX8MQ_ATF
 	select ARM_SMCCC
 	select MCI_IMX_ESDHC_PBL
 	select MACH_ZII_COMMON
diff --git a/firmware/Kconfig b/firmware/Kconfig
index a12a8f3044..0f76a836af 100644
--- a/firmware/Kconfig
+++ b/firmware/Kconfig
@@ -8,33 +8,54 @@ config EXTRA_FIRMWARE_DIR
 
 config FIRMWARE_IMX_LPDDR4_PMU_TRAIN
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/lpddr4_pmu_train_1d_dmem.bin)
+	depends on $(success,test -e $(srctree)/firmware/lpddr4_pmu_train_1d_imem.bin)
+	depends on $(success,test -e $(srctree)/firmware/lpddr4_pmu_train_2d_dmem.bin)
+	depends on $(success,test -e $(srctree)/firmware/lpddr4_pmu_train_2d_imem.bin)
 
 config FIRMWARE_IMX_DDR4_PMU_TRAIN
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/ddr4_dmem_1d.bin)
+	depends on $(success,test -e $(srctree)/firmware/ddr4_dmem_2d.bin)
+	depends on $(success,test -e $(srctree)/firmware/ddr4_imem_1d.bin)
+	depends on $(success,test -e $(srctree)/firmware/ddr4_imem_2d.bin)
 
 config FIRMWARE_IMX8MM_ATF
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/imx8mm-bl31.bin)
 
 config FIRMWARE_IMX8MN_ATF
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/imx8mn-bl31.bin)
 
 config FIRMWARE_IMX8MP_ATF
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/imx8mp-bl31.bin)
 
 config FIRMWARE_IMX8MQ_ATF
 	bool
+	default y
+	depends on $(success,test -e $(srctree)/firmware/imx8mq-bl31.bin)
 
 config FIRMWARE_IMX8MM_OPTEE
 	bool "install OP-TEE on i.MX8MM boards"
 	depends on FIRMWARE_IMX8MM_ATF && PBL_OPTEE
+	depends on $(success,test -e $(srctree)/firmware/imx8mm-bl32.bin)
 
 config FIRMWARE_IMX8MN_OPTEE
 	bool "install OP-TEE on i.MX8MN boards"
 	depends on FIRMWARE_IMX8MN_ATF && PBL_OPTEE
+	depends on $(success,test -e $(srctree)/firmware/imx8mn-bl32.bin)
 
 config FIRMWARE_IMX8MP_OPTEE
 	bool "install OP-TEE on i.MX8MP boards"
 	depends on FIRMWARE_IMX8MP_ATF && PBL_OPTEE
+	depends on $(success,test -e $(srctree)/firmware/imx8mp-bl32.bin)
 
 config FIRMWARE_CCBV2_OPTEE
 	bool
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-26  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26  9:03 [PATCH 0/3] Compile boards only when firmware is present Sascha Hauer
2023-04-26  9:03 ` [PATCH 1/3] Kconfig: source Kconfig.include earlier Sascha Hauer
2023-04-26  9:03 ` [PATCH 2/3] ARM: Rockchip: make boards only selectable when firmware is present Sascha Hauer
2023-04-26  9:03 ` [PATCH 3/3] ARM: i.MX: make boards selectable only when firmware files are present Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox