* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
@ 2012-03-23 14:37 Thomas De Schampheleire
2012-03-23 14:51 ` Thomas Petazzoni
0 siblings, 1 reply; 11+ messages in thread
From: Thomas De Schampheleire @ 2012-03-23 14:37 UTC (permalink / raw)
To: buildroot
The dtc is taken from the Linux kernel sources and simply copied to the host
directory.
Having dtc as a separate host tool can be useful for users that have a custom
boot scenario where the device tree is not embedded in the kernel.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
v2: remove old parameters to GENTARGETS call, sorry.
v3: rename Config.in.host and depend on Linux (comments Arnout)
package/Config.in.host | 1 +
package/dtc/Config.in.host | 8 ++++++++
package/dtc/dtc.mk | 14 ++++++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/package/Config.in.host b/package/Config.in.host
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -1,5 +1,6 @@
menu "Host utilities"
+source "package/dtc/Config.in.host"
source "package/lpc3250loader/Config.in.host"
source "package/openocd/Config.in.host"
source "package/sam-ba/Config.in.host"
diff --git a/package/dtc/Config.in.host b/package/dtc/Config.in.host
new file mode 100644
--- /dev/null
+++ b/package/dtc/Config.in.host
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_DTC
+ bool "Device Tree Compiler (dtc)"
+ depends on BR2_LINUX_KERNEL
+ help
+ Device Tree Compiler for flattened-device trees.
+
+comment "The dtc device tree compiler depends on the Linux kernel sources."
+ depends on !BR2_LINUX_KERNEL
diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
new file mode 100644
--- /dev/null
+++ b/package/dtc/dtc.mk
@@ -0,0 +1,14 @@
+#############################################################
+#
+# dtc
+#
+#############################################################
+
+HOST_DTC_SOURCE =
+HOST_DTC_DEPENDENCIES = linux
+
+define HOST_DTC_INSTALL_CMDS
+ $(INSTALL) -D -m 0755 $(LINUX_DIR)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/dtc
+endef
+
+$(eval $(call GENTARGETS,host))
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 14:37 [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool Thomas De Schampheleire
@ 2012-03-23 14:51 ` Thomas Petazzoni
2012-03-23 15:01 ` Thomas De Schampheleire
2012-03-23 15:05 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 2 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2012-03-23 14:51 UTC (permalink / raw)
To: buildroot
Le Fri, 23 Mar 2012 15:37:34 +0100,
Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
> +HOST_DTC_SOURCE =
> +HOST_DTC_DEPENDENCIES = linux
> +
> +define HOST_DTC_INSTALL_CMDS
> + $(INSTALL) -D -m 0755 $(LINUX_DIR)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/dtc
> +endef
The problem is that this DTC binary is only built if CONFIG_DTC is
selected in the kernel configuration. So if the selected kernel does
not have this option enabled, the installation step of this package is
going to fail.
I am not sure what to do here. Just let the user figure this out? Check
the kernel .config to see if CONFIG_DTC is enabled, and if it isn't
while this package is selected, error out with a nice explanation for
the user? Simply ignore the installation if the dtc binary was not
built?
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 14:51 ` Thomas Petazzoni
@ 2012-03-23 15:01 ` Thomas De Schampheleire
2012-03-23 15:09 ` Thomas Petazzoni
2012-03-23 15:05 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 11+ messages in thread
From: Thomas De Schampheleire @ 2012-03-23 15:01 UTC (permalink / raw)
To: buildroot
On Fri, Mar 23, 2012 at 3:51 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Le Fri, 23 Mar 2012 15:37:34 +0100,
> Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
>
>> +HOST_DTC_SOURCE =
>> +HOST_DTC_DEPENDENCIES = linux
>> +
>> +define HOST_DTC_INSTALL_CMDS
>> + ? ?$(INSTALL) -D -m 0755 $(LINUX_DIR)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/dtc
>> +endef
>
> The problem is that this DTC binary is only built if CONFIG_DTC is
> selected in the kernel configuration. So if the selected kernel does
> not have this option enabled, the installation step of this package is
> going to fail.
>
> I am not sure what to do here. Just let the user figure this out? Check
> the kernel .config to see if CONFIG_DTC is enabled, and if it isn't
> while this package is selected, error out with a nice explanation for
> the user? Simply ignore the installation if the dtc binary was not
> built?
I hadn't though about this case.
One could question whether it is a valid case that someone selects dtc
in buildroot but not in the kernel.
Probably the nicest way is to not use dtc from the linux kernel
sources but download the dtc sources explicitly. I thought this was a
bit overkill, and I'm not sure if there can be inconsistencies between
these sources and the kernel ones.
Best regards,
Thomas
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 15:01 ` Thomas De Schampheleire
@ 2012-03-23 15:09 ` Thomas Petazzoni
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2012-03-23 15:09 UTC (permalink / raw)
To: buildroot
Le Fri, 23 Mar 2012 16:01:16 +0100,
Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
> I hadn't though about this case.
> One could question whether it is a valid case that someone selects dtc
> in buildroot but not in the kernel.
>
> Probably the nicest way is to not use dtc from the linux kernel
> sources but download the dtc sources explicitly. I thought this was a
> bit overkill, and I'm not sure if there can be inconsistencies between
> these sources and the kernel ones.
I have no strong opinion here. You can just keep what you've done and:
* Add an explanation in the help text about this fact
* Add something like the following to your installation code:
if ! grep -q ^CONFIG_DTC=y $(LINUX_DIR)/.config ; then
echo "Cannot install the Device Tree Compiler since you have
not enabled CONFIG_DTC=y in your kernel configuration.
Aborting".
exit 1
fi
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 14:51 ` Thomas Petazzoni
2012-03-23 15:01 ` Thomas De Schampheleire
@ 2012-03-23 15:05 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-23 15:32 ` Thomas Petazzoni
1 sibling, 1 reply; 11+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-23 15:05 UTC (permalink / raw)
To: buildroot
On 15:51 Fri 23 Mar , Thomas Petazzoni wrote:
> Le Fri, 23 Mar 2012 15:37:34 +0100,
> Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
>
> > +HOST_DTC_SOURCE =
> > +HOST_DTC_DEPENDENCIES = linux
> > +
> > +define HOST_DTC_INSTALL_CMDS
> > + $(INSTALL) -D -m 0755 $(LINUX_DIR)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/dtc
> > +endef
>
> The problem is that this DTC binary is only built if CONFIG_DTC is
> selected in the kernel configuration. So if the selected kernel does
> not have this option enabled, the installation step of this package is
> going to fail.
>
> I am not sure what to do here. Just let the user figure this out? Check
> the kernel .config to see if CONFIG_DTC is enabled, and if it isn't
> while this package is selected, error out with a nice explanation for
> the user? Simply ignore the installation if the dtc binary was not
> built?
dtc is always provuded with the kernel so why do you need it?
Best Regards,
J.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 15:05 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-23 15:32 ` Thomas Petazzoni
2012-03-23 15:37 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2012-03-23 15:32 UTC (permalink / raw)
To: buildroot
Le Fri, 23 Mar 2012 16:05:18 +0100,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a ?crit :
> dtc is always provuded with the kernel so why do you need it?
The sources are always available, but it is *built* only if CONFIG_DTC
is selected. So unconditionally installing scripts/dtc/dtc will not
work if the kernel was configured !CONFIG_DTC.
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 15:32 ` Thomas Petazzoni
@ 2012-03-23 15:37 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-23 15:54 ` Thomas Petazzoni
0 siblings, 1 reply; 11+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-23 15:37 UTC (permalink / raw)
To: buildroot
On 16:32 Fri 23 Mar , Thomas Petazzoni wrote:
> Le Fri, 23 Mar 2012 16:05:18 +0100,
> Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a ?crit :
>
> > dtc is always provuded with the kernel so why do you need it?
>
> The sources are always available, but it is *built* only if CONFIG_DTC
> is selected. So unconditionally installing scripts/dtc/dtc will not
> work if the kernel was configured !CONFIG_DTC.
but the source is up-to-date for the kernel you use
we get this discussion on the kernel we do only expect the dtc that is
provided byt the kernel that you compile to be used. If you use other verison
we do not garanty it will work.
Best Regards,
J.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 15:37 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-23 15:54 ` Thomas Petazzoni
2012-03-23 16:27 ` Alexandre Pereira da Silva
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2012-03-23 15:54 UTC (permalink / raw)
To: buildroot
Le Fri, 23 Mar 2012 16:37:27 +0100,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a ?crit :
> but the source is up-to-date for the kernel you use
>
> we get this discussion on the kernel we do only expect the dtc that is
> provided byt the kernel that you compile to be used. If you use other verison
> we do not garanty it will work.
Ok, that's good to know, thanks!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 15:54 ` Thomas Petazzoni
@ 2012-03-23 16:27 ` Alexandre Pereira da Silva
2012-03-26 7:15 ` Thomas De Schampheleire
0 siblings, 1 reply; 11+ messages in thread
From: Alexandre Pereira da Silva @ 2012-03-23 16:27 UTC (permalink / raw)
To: buildroot
On Fri, Mar 23, 2012 at 12:54 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Le Fri, 23 Mar 2012 16:37:27 +0100,
> Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a ?crit :
>
>> but the source is up-to-date for the kernel you use
>>
>> we get this discussion on the kernel we do only expect the dtc that is
>> provided byt the kernel that you compile to be used. If you use other verison
>> we do not garanty it will work.
>
> Ok, that's good to know, thanks!
Why not move this into the linux.mk package?
If the user has selected DTC support, just copy from the built kernel.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool
2012-03-23 16:27 ` Alexandre Pereira da Silva
@ 2012-03-26 7:15 ` Thomas De Schampheleire
2012-03-26 7:55 ` Arnout Vandecappelle
0 siblings, 1 reply; 11+ messages in thread
From: Thomas De Schampheleire @ 2012-03-26 7:15 UTC (permalink / raw)
To: buildroot
On Fri, Mar 23, 2012 at 5:27 PM, Alexandre Pereira da Silva
<aletes.xgr@gmail.com> wrote:
> On Fri, Mar 23, 2012 at 12:54 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> Le Fri, 23 Mar 2012 16:37:27 +0100,
>> Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> a ?crit :
>>
>>> but the source is up-to-date for the kernel you use
>>>
>>> we get this discussion on the kernel we do only expect the dtc that is
>>> provided byt the kernel that you compile to be used. If you use other verison
>>> we do not garanty it will work.
>>
>> Ok, that's good to know, thanks!
>
> Why not move this into the linux.mk package?
> If the user has selected DTC support, just copy from the built kernel.
This sounds like a fine proposal to me...
Does anyone have objections against it?
Thanks,
Thomas
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-03-26 7:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-23 14:37 [Buildroot] [PATCH v3] Add dtc (device tree compiler) as host tool Thomas De Schampheleire
2012-03-23 14:51 ` Thomas Petazzoni
2012-03-23 15:01 ` Thomas De Schampheleire
2012-03-23 15:09 ` Thomas Petazzoni
2012-03-23 15:05 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-23 15:32 ` Thomas Petazzoni
2012-03-23 15:37 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-23 15:54 ` Thomas Petazzoni
2012-03-23 16:27 ` Alexandre Pereira da Silva
2012-03-26 7:15 ` Thomas De Schampheleire
2012-03-26 7:55 ` Arnout Vandecappelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox