All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Warren <TWarren@nvidia.com>
To: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@ti.com>,
	Devicetree Discuss <devicetree-discuss@lists.ozlabs.org>,
	"u-boot-review@google.com" <u-boot-review@google.com>,
	Jerry Van Baren <vanbaren@cideas.com>
Subject: Re: [PATCH] fdt: Enhance dts/Makefile to be all things to all men
Date: Tue, 28 May 2013 12:53:34 -0700	[thread overview]
Message-ID: <5FBF8E85CA34454794F0F7ECBA79798F37AE348984@HQMAIL04.nvidia.com> (raw)
In-Reply-To: <1369769778-12455-1-git-send-email-sjg@chromium.org>

Simon,

> -----Original Message-----
> From: Simon Glass [mailto:sjg@chromium.org]
> Sent: Tuesday, May 28, 2013 12:36 PM
> To: U-Boot Mailing List
> Cc: Tom Rini; Stephen Warren; Devicetree Discuss; u-boot-
> review@google.com; Simon Glass; Tom Warren; Jerry Van Baren
> Subject: [PATCH] fdt: Enhance dts/Makefile to be all things to all men
> 
> There are a few partially conflicting requirements in compiling the device
> tree, since U-Boot relies on whatever is installed on the build machine.
> 
> Some versions of dtc support -i, and this is often better than using #include
> since you get correct line number information in errors. Unfortunately this
> version must be installed manually in current Linux distributions.
> 
> Some device tree files use the word 'linux' which gets replaced with '1' by
> many version of gcc, including version 4.7. So undefine this.
> 
> When an device tree file has an error we want to direct the user to the right
> file and line number. So instead of piping the file into dts through stdin, put it
> in a real file so that we get a fairly sensible error message from dts. Then
> print out the original file details to help further.
> 
> This is based on a commit from Tom Warren. It would help if people can test
> it in different environments.
> 
> Signed-off-by: Tom Warren <twarren@nvidia.com>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Works for me for all Tegra builds, so:

Tested-by: Tom Warren <twarren@nvidia.com>

Tom
> ---
>  dts/Makefile | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/dts/Makefile b/dts/Makefile index 03e163e..1f6fabb 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -37,11 +37,29 @@ $(if $(CONFIG_ARCH_DEVICE_TREE),,\  $(error Your
> architecture does not have device tree support enabled. \  Please define
> CONFIG_ARCH_DEVICE_TREE))
> 
> +# Provide a list of include directories for dtc DTS_INCS-y := -i
> +$(SRCTREE)/arch/$(ARCH)/dts
> +
> +DTS_INCS-y += -i $(SRCTREE)/board/$(VENDOR)/dts
> +
> +DTS_INCS-$(CONFIG_CHROMEOS) += -i $(SRCTREE)/cros/dts
> +
> +# Check if our dtc includes the -i option DTS_FLAGS := $(shell if ! dtc
> +-i 2>&1 | grep -q "invalid option"; then \
> +		echo $(DTS_INCS-y); fi)
> +
>  # We preprocess the device tree file provide a useful define -DTS_CPPFLAGS
> := -x assembler-with-cpp \
> +# Undefine 'linux' since it might be used in device tree files
> +DTS_CPPFLAGS := -x assembler-with-cpp -Ulinux \
>  		-
> DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVIC
> E_TREE).dtsi\" \
>  		-
> DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TR
> EE).dts\" \
> -		-I$(SRCTREE)/board/$(VENDOR)/dts -
> I$(SRCTREE)/arch/$(ARCH)/dts
> +		-D__ASSEMBLY__ -I$(OBJTREE)/include -I$(SRCTREE)/include
> \
> +		-I$(OBJTREE)/include2 \
> +		-I$(SRCTREE)/board/$(VENDOR)/dts -
> I$(SRCTREE)/arch/$(ARCH)/dts \
> +		-include $(OBJTREE)/include/config.h
> +
> +DTS_TMP := $(OBJTREE)/include/generated/$(DEVICE_TREE).dts.in
> +DTS_SRC := board/$(VENDOR)/dts/$(DEVICE_TREE).dts
> 
>  all:	$(obj).depend $(LIB)
> 
> @@ -50,13 +68,19 @@ all:	$(obj).depend $(LIB)
>  # the filename.
>  DT_BIN	:= $(obj)dt.dtb
> 
> -$(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
> +DTC_CMD := $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DTS_FLAGS)
> +$(DTS_TMP)
> +
> +$(DT_BIN): $(TOPDIR)/$(DTS_SRC)
>  	rc=$$( \
> -		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
> -		{ { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
> +		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - > $(DTS_TMP); \
> +		{ { $(DTC_CMD)  2>&1 ; \
>  		    echo $$? >&3 ; } | \
>  		  grep -v '^DTC: dts->dtb  on file' ; \
>  	        } 3>&1 1>&2 ) ; \
> +	if [ $$rc != 0 ]; then \
> +		echo "Source file is $(DTS_SRC)"; \
> +		echo "Compiler: $(DTC_CMD)"; \
> +	fi; \
>  	exit $$rc
> 
>  process_lds = \
> --
> 1.8.2.1
--
nvpublic

WARNING: multiple messages have this Message-ID (diff)
From: Tom Warren <TWarren@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: Enhance dts/Makefile to be all things to all men
Date: Tue, 28 May 2013 12:53:34 -0700	[thread overview]
Message-ID: <5FBF8E85CA34454794F0F7ECBA79798F37AE348984@HQMAIL04.nvidia.com> (raw)
In-Reply-To: <1369769778-12455-1-git-send-email-sjg@chromium.org>

Simon,

> -----Original Message-----
> From: Simon Glass [mailto:sjg at chromium.org]
> Sent: Tuesday, May 28, 2013 12:36 PM
> To: U-Boot Mailing List
> Cc: Tom Rini; Stephen Warren; Devicetree Discuss; u-boot-
> review at google.com; Simon Glass; Tom Warren; Jerry Van Baren
> Subject: [PATCH] fdt: Enhance dts/Makefile to be all things to all men
> 
> There are a few partially conflicting requirements in compiling the device
> tree, since U-Boot relies on whatever is installed on the build machine.
> 
> Some versions of dtc support -i, and this is often better than using #include
> since you get correct line number information in errors. Unfortunately this
> version must be installed manually in current Linux distributions.
> 
> Some device tree files use the word 'linux' which gets replaced with '1' by
> many version of gcc, including version 4.7. So undefine this.
> 
> When an device tree file has an error we want to direct the user to the right
> file and line number. So instead of piping the file into dts through stdin, put it
> in a real file so that we get a fairly sensible error message from dts. Then
> print out the original file details to help further.
> 
> This is based on a commit from Tom Warren. It would help if people can test
> it in different environments.
> 
> Signed-off-by: Tom Warren <twarren@nvidia.com>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Works for me for all Tegra builds, so:

Tested-by: Tom Warren <twarren@nvidia.com>

Tom
> ---
>  dts/Makefile | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/dts/Makefile b/dts/Makefile index 03e163e..1f6fabb 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -37,11 +37,29 @@ $(if $(CONFIG_ARCH_DEVICE_TREE),,\  $(error Your
> architecture does not have device tree support enabled. \  Please define
> CONFIG_ARCH_DEVICE_TREE))
> 
> +# Provide a list of include directories for dtc DTS_INCS-y := -i
> +$(SRCTREE)/arch/$(ARCH)/dts
> +
> +DTS_INCS-y += -i $(SRCTREE)/board/$(VENDOR)/dts
> +
> +DTS_INCS-$(CONFIG_CHROMEOS) += -i $(SRCTREE)/cros/dts
> +
> +# Check if our dtc includes the -i option DTS_FLAGS := $(shell if ! dtc
> +-i 2>&1 | grep -q "invalid option"; then \
> +		echo $(DTS_INCS-y); fi)
> +
>  # We preprocess the device tree file provide a useful define -DTS_CPPFLAGS
> := -x assembler-with-cpp \
> +# Undefine 'linux' since it might be used in device tree files
> +DTS_CPPFLAGS := -x assembler-with-cpp -Ulinux \
>  		-
> DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVIC
> E_TREE).dtsi\" \
>  		-
> DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TR
> EE).dts\" \
> -		-I$(SRCTREE)/board/$(VENDOR)/dts -
> I$(SRCTREE)/arch/$(ARCH)/dts
> +		-D__ASSEMBLY__ -I$(OBJTREE)/include -I$(SRCTREE)/include
> \
> +		-I$(OBJTREE)/include2 \
> +		-I$(SRCTREE)/board/$(VENDOR)/dts -
> I$(SRCTREE)/arch/$(ARCH)/dts \
> +		-include $(OBJTREE)/include/config.h
> +
> +DTS_TMP := $(OBJTREE)/include/generated/$(DEVICE_TREE).dts.in
> +DTS_SRC := board/$(VENDOR)/dts/$(DEVICE_TREE).dts
> 
>  all:	$(obj).depend $(LIB)
> 
> @@ -50,13 +68,19 @@ all:	$(obj).depend $(LIB)
>  # the filename.
>  DT_BIN	:= $(obj)dt.dtb
> 
> -$(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
> +DTC_CMD := $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DTS_FLAGS)
> +$(DTS_TMP)
> +
> +$(DT_BIN): $(TOPDIR)/$(DTS_SRC)
>  	rc=$$( \
> -		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
> -		{ { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
> +		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - > $(DTS_TMP); \
> +		{ { $(DTC_CMD)  2>&1 ; \
>  		    echo $$? >&3 ; } | \
>  		  grep -v '^DTC: dts->dtb  on file' ; \
>  	        } 3>&1 1>&2 ) ; \
> +	if [ $$rc != 0 ]; then \
> +		echo "Source file is $(DTS_SRC)"; \
> +		echo "Compiler: $(DTC_CMD)"; \
> +	fi; \
>  	exit $$rc
> 
>  process_lds = \
> --
> 1.8.2.1
--
nvpublic

  reply	other threads:[~2013-05-28 19:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 19:36 [PATCH] fdt: Enhance dts/Makefile to be all things to all men Simon Glass
2013-05-28 19:36 ` [U-Boot] " Simon Glass
2013-05-28 19:53 ` Tom Warren [this message]
2013-05-28 19:53   ` Tom Warren
     [not found] ` <1369769778-12455-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2013-05-28 20:57   ` Stephen Warren
2013-05-28 20:57     ` [U-Boot] " Stephen Warren
     [not found]     ` <51A51A50.4050308-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-29 15:59       ` Simon Glass
2013-05-29 15:59         ` [U-Boot] " Simon Glass
     [not found]         ` <CAPnjgZ04BKhQtpJct9tvN8rW5Wae+6fxxOOQDnEkmgrr-mAfwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-29 16:40           ` Stephen Warren
2013-05-29 16:40             ` [U-Boot] " Stephen Warren
     [not found]             ` <51A62F8D.9010208-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-29 21:31               ` Wolfgang Denk
2013-05-29 21:31                 ` Wolfgang Denk
     [not found]                 ` <20130529213145.698353831A5-C2Gvrrd9BC/j/ljBK/0BTg@public.gmane.org>
2013-05-29 22:18                   ` Stephen Warren
2013-05-29 22:18                     ` Stephen Warren
     [not found]                     ` <51A67EC1.2000208-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-29 22:36                       ` Wolfgang Denk
2013-05-29 22:36                         ` Wolfgang Denk
     [not found]                         ` <20130529223621.8B147383069-C2Gvrrd9BC/j/ljBK/0BTg@public.gmane.org>
2013-05-29 23:07                           ` Stephen Warren
2013-05-29 23:07                             ` Stephen Warren
     [not found]                             ` <51A68A4C.4060505-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-30  4:46                               ` Simon Glass
2013-05-30  4:46                                 ` Simon Glass
     [not found]                                 ` <CAPnjgZ2_dR90CDtihSun3Yu7_i8TVpxn85XMFQRmzNJeRzDSmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-30  5:11                                   ` Stephen Warren
2013-05-30  5:11                                     ` Stephen Warren
     [not found]                                     ` <51A6DF7C.30903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-30  5:33                                       ` Simon Glass
2013-05-30  5:33                                         ` Simon Glass
2013-05-30  7:56                                       ` Wolfgang Denk
2013-05-30  7:56                                         ` Wolfgang Denk
2013-05-30 17:38                                         ` Stephen Warren
2013-05-30 17:38                                           ` [U-Boot] " Stephen Warren
2013-05-30  7:49                               ` Wolfgang Denk
2013-05-30  7:49                                 ` Wolfgang Denk
2013-05-28 21:08   ` Wolfgang Denk
2013-05-28 21:08     ` Wolfgang Denk
2013-05-29 16:00     ` Simon Glass
2013-05-29 16:00       ` [U-Boot] " Simon Glass
     [not found]       ` <CAPnjgZ2a+qrsPWTz5Y=48m_LCRqAikY0-seJudW8AY5asdwmxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-29 21:02         ` Wolfgang Denk
2013-05-29 21:02           ` Wolfgang Denk
     [not found]     ` <20130528210829.850203831A2-C2Gvrrd9BC/j/ljBK/0BTg@public.gmane.org>
2013-05-29 17:02       ` Stephen Warren
2013-05-29 17:02         ` Stephen Warren
     [not found]         ` <51A634B5.5060309-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-29 21:33           ` Wolfgang Denk
2013-05-29 21:33             ` Wolfgang Denk
     [not found]             ` <20130529213347.821AE3831A5-C2Gvrrd9BC/j/ljBK/0BTg@public.gmane.org>
2013-05-29 22:52               ` Stephen Warren
2013-05-29 22:52                 ` Stephen Warren
     [not found]                 ` <51A6869F.1020004-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-30  7:05                   ` Wolfgang Denk
2013-05-30  7:05                     ` Wolfgang Denk

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=5FBF8E85CA34454794F0F7ECBA79798F37AE348984@HQMAIL04.nvidia.com \
    --to=twarren@nvidia.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=sjg@chromium.org \
    --cc=trini@ti.com \
    --cc=u-boot-review@google.com \
    --cc=u-boot@lists.denx.de \
    --cc=vanbaren@cideas.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.