diff mbox

[U-Boot,RFC,v2,04/13] Makefile: Support include files for .dts files

Message ID 1399306150-932-5-git-send-email-sjg@chromium.org
State RFC
Headers show

Commit Message

Simon Glass May 5, 2014, 4:09 p.m. UTC
Linux supports this, and if we are to have compatible device tree files,
U-Boot should also.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Add new patch to support include files for .dts files

 scripts/Makefile.lib | 1 +
 1 file changed, 1 insertion(+)

Comments

Stephen Warren May 5, 2014, 4:54 p.m. UTC | #1
On 05/05/2014 10:09 AM, Simon Glass wrote:
> Linux supports this, and if we are to have compatible device tree files,
> U-Boot should also.

> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib

>  # Modified for U-Boot
>  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
>  		 -I$(srctree)/arch/$(ARCH)/dts                           \
> +		 -I$(srctree)/include                                    \
>  		 -undef -D__DTS__

I don't think we should add the top-level include/ directory to the DT
include path. That is something I very specifically avoided in the
kernel Makefiles. If we did allow this, then DTs could start including
arbitrary U-Boot header files, rather than just header files intended to
be used in DT bindings, and that would then make the DT files used in
U-Boot not portable to the Linux kernel, or any standalone DT file
repository which may appear.

Instead, let's create a standalone root directory for the DT include
files, and add that to the DT header path. We can add this DT-specific
include path to the include patch for U-Boot C code if needed.

Perhaps we can create a top-level dt/include/ or device-tree/include
directory for this?
Masahiro Yamada May 7, 2014, 2:15 a.m. UTC | #2
Hi Simon, Stephen,

On Mon, 05 May 2014 10:54:52 -0600
Stephen Warren <swarren@wwwdotorg.org> wrote:

> On 05/05/2014 10:09 AM, Simon Glass wrote:
> > Linux supports this, and if we are to have compatible device tree files,
> > U-Boot should also.
> 
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> 
> >  # Modified for U-Boot
> >  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
> >  		 -I$(srctree)/arch/$(ARCH)/dts                           \
> > +		 -I$(srctree)/include                                    \
> >  		 -undef -D__DTS__
> 
> I don't think we should add the top-level include/ directory to the DT
> include path. That is something I very specifically avoided in the
> kernel Makefiles. If we did allow this, then DTs could start including
> arbitrary U-Boot header files, rather than just header files intended to
> be used in DT bindings, and that would then make the DT files used in
> U-Boot not portable to the Linux kernel, or any standalone DT file
> repository which may appear.
> 
> Instead, let's create a standalone root directory for the DT include
> files, and add that to the DT header path. We can add this DT-specific
> include path to the include patch for U-Boot C code if needed.
> 
> Perhaps we can create a top-level dt/include/ or device-tree/include
> directory for this?

I agree with Stephen.
I hesitate to add the top-level include/ to the path.

If we try to follow the Linux style,
we can add the include path "-I$(srctree)/arch/$(ARCH)/dts/include
and create symbolic links to include/dt-bindings.

Best Regards
Masahiro Yamada
Simon Glass May 7, 2014, 10:37 p.m. UTC | #3
Hi Stephen and Masahiro

On 6 May 2014 20:15, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:

> Hi Simon, Stephen,
>
> On Mon, 05 May 2014 10:54:52 -0600
> Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> > On 05/05/2014 10:09 AM, Simon Glass wrote:
> > > Linux supports this, and if we are to have compatible device tree
> files,
> > > U-Boot should also.
> >
> > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> >
> > >  # Modified for U-Boot
> > >  dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc
>    \
> > >              -I$(srctree)/arch/$(ARCH)/dts                           \
> > > +            -I$(srctree)/include                                    \
> > >              -undef -D__DTS__
> >
> > I don't think we should add the top-level include/ directory to the DT
> > include path. That is something I very specifically avoided in the
> > kernel Makefiles. If we did allow this, then DTs could start including
> > arbitrary U-Boot header files, rather than just header files intended to
> > be used in DT bindings, and that would then make the DT files used in
> > U-Boot not portable to the Linux kernel, or any standalone DT file
> > repository which may appear.
> >
> > Instead, let's create a standalone root directory for the DT include
> > files, and add that to the DT header path. We can add this DT-specific
> > include path to the include patch for U-Boot C code if needed.
> >
> > Perhaps we can create a top-level dt/include/ or device-tree/include
> > directory for this?
>
> I agree with Stephen.
> I hesitate to add the top-level include/ to the path.
>
> If we try to follow the Linux style,
> we can add the include path "-I$(srctree)/arch/$(ARCH)/dts/include
> and create symbolic links to include/dt-bindings.
>

Yes that's fine. So long as we can use include files it is OK with me.

Regards,
Simon
diff mbox

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a04439d..10358ba 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -153,6 +153,7 @@  ld_flags       = $(LDFLAGS) $(ldflags-y)
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 -I$(srctree)/arch/$(ARCH)/dts                           \
+		 -I$(srctree)/include                                    \
 		 -undef -D__DTS__
 
 # Finds the multi-part object the current object will be linked into