diff mbox series

[09/19] powerpc: boot: Build devicetrees when CONFIG_MPC831x=y

Message ID 20250102-mpc83xx-v1-9-86f78ba2a7af@posteo.net (mailing list archive)
State Changes Requested
Headers show
Series powerpc: MPC83xx cleanup and LANCOM NWAPP2 board | expand

Commit Message

J. Neuschäfer via B4 Relay Jan. 2, 2025, 6:31 p.m. UTC
From: "J. Neuschäfer" <j.ne@posteo.net>

In order to produce useful FIT images, the kernel needs to know which
devicetrees to build. To that end, follow the same approach as other
architectures, and enable devicetrees per platform.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
---

I've only enabled MPC831x devicetrees, because that's the hardware I have.
---
 arch/powerpc/boot/dts/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Christophe Leroy Jan. 6, 2025, 1:55 p.m. UTC | #1
Le 02/01/2025 à 19:31, J. Neuschäfer via B4 Relay a écrit :
> [Vous ne recevez pas souvent de courriers de devnull+j.ne.posteo.net@kernel.org. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> From: "J. Neuschäfer" <j.ne@posteo.net>
> 
> In order to produce useful FIT images, the kernel needs to know which
> devicetrees to build. To that end, follow the same approach as other
> architectures, and enable devicetrees per platform.

Why do you need that ? Why not just use CONFIG_EXTRA_TARGETS for that ?

> 
> Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> ---
> 
> I've only enabled MPC831x devicetrees, because that's the hardware I have.
> ---
>   arch/powerpc/boot/dts/Makefile | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
> index 0cd0d8558b475cfe342f36f4b78240ef88dd2e37..6aee895d5baaa2c978d4b1c82a6d198d9e166ea2 100644
> --- a/arch/powerpc/boot/dts/Makefile
> +++ b/arch/powerpc/boot/dts/Makefile
> @@ -3,3 +3,8 @@
>   subdir-y += fsl
> 
>   dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
> +
> +dtb-$(CONFIG_MPC831x) += \
> +       kmeter1.dtb \
> +       mpc8313erdb.dtb \
> +       mpc8315erdb.dtb

How will it know which one of the three to put in the FIT image ? Or do 
you want all three in the FIT image ? In that case how do you select 
which one to use at boot ?

> 
> --
> 2.45.2
> 
>
J. Neuschäfer Jan. 7, 2025, 11:24 p.m. UTC | #2
On Mon, Jan 06, 2025 at 02:55:22PM +0100, Christophe Leroy wrote:
> Le 02/01/2025 à 19:31, J. Neuschäfer via B4 Relay a écrit :
> > [Vous ne recevez pas souvent de courriers de devnull+j.ne.posteo.net@kernel.org. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> > 
> > From: "J. Neuschäfer" <j.ne@posteo.net>
> > 
> > In order to produce useful FIT images, the kernel needs to know which
> > devicetrees to build. To that end, follow the same approach as other
> > architectures, and enable devicetrees per platform.
> 
> Why do you need that ?

The FIT infrastructure uses the dtbs-y variable and the dtbs-list file
built from it in order to obtain a list of DTBs to include.

Having roughly the right DTBs included by setting a simple config
option to =y is pretty convenient.

> Why not just use CONFIG_EXTRA_TARGETS for that ?

To be honest, I didn't know about CONFIG_EXTRA_TARGETS until now.
But I also don't quite understand it:

  ()  Additional default image types

I don't need an additional image type. I want additional device trees,
if anything.

One thing I specifically wanted to avoid by using FIT is having to add
more per-board bootwrapper logic to arch/powerpc/boot/Makefile.

> > 
> > Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> > ---
> > 
> > I've only enabled MPC831x devicetrees, because that's the hardware I have.
> > ---
> >   arch/powerpc/boot/dts/Makefile | 5 +++++
> >   1 file changed, 5 insertions(+)
> > 
> > diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
> > index 0cd0d8558b475cfe342f36f4b78240ef88dd2e37..6aee895d5baaa2c978d4b1c82a6d198d9e166ea2 100644
> > --- a/arch/powerpc/boot/dts/Makefile
> > +++ b/arch/powerpc/boot/dts/Makefile
> > @@ -3,3 +3,8 @@
> >   subdir-y += fsl
> > 
> >   dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
> > +
> > +dtb-$(CONFIG_MPC831x) += \
> > +       kmeter1.dtb \
> > +       mpc8313erdb.dtb \
> > +       mpc8315erdb.dtb
> 
> How will it know which one of the three to put in the FIT image ?
> Or do you want all three in the FIT image ?

It includes all of them, which is an acceptable outcome.

> In that case how do you select which one to use at boot ?

The bootloader (most likely U-Boot) is expected to know the compatible
string of the board and select the right devicetree based on it.


Best regards,
J. Neuschäfer
diff mbox series

Patch

diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
index 0cd0d8558b475cfe342f36f4b78240ef88dd2e37..6aee895d5baaa2c978d4b1c82a6d198d9e166ea2 100644
--- a/arch/powerpc/boot/dts/Makefile
+++ b/arch/powerpc/boot/dts/Makefile
@@ -3,3 +3,8 @@ 
 subdir-y += fsl
 
 dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
+
+dtb-$(CONFIG_MPC831x) += \
+	kmeter1.dtb \
+	mpc8313erdb.dtb \
+	mpc8315erdb.dtb