diff mbox

[v2,3/4] dtc: add host build

Message ID 1421000166-24963-3-git-send-email-ps.report@gmx.net
State Changes Requested
Headers show

Commit Message

Peter Seiderer Jan. 11, 2015, 6:16 p.m. UTC
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v1 -> v2:
  - fix host build command (use native compiler instead of
    cross compiler)
---
 package/Config.in.host     |  1 +
 package/dtc/Config.in.host |  9 +++++++++
 package/dtc/dtc.mk         | 14 ++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 package/dtc/Config.in.host

Comments

Thomas Petazzoni Jan. 12, 2015, 8:42 p.m. UTC | #1
Dear Peter Seiderer,

On Sun, 11 Jan 2015 19:16:05 +0100, Peter Seiderer wrote:

> diff --git a/package/dtc/Config.in.host b/package/dtc/Config.in.host
> new file mode 100644
> index 0000000..cbabf0a
> --- /dev/null
> +++ b/package/dtc/Config.in.host
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_HOST_DTC
> +	bool "host dtc"
> +	help
> +	  The Device Tree Compiler, dtc, takes as input a device-tree in
> +	  a given format and outputs a device-tree in another format.
> +
> +	  Install host tools: dtc, convert-dtsv0, fdtdump, fdtget and fdtput.
> +
> +	  https://git.kernel.org/cgit/utils/dtc/dtc.git

I'd like to understand a bit more how this is going to be used exactly,
to see whether there is really a need for a menuconfig option for this
host package. Most host packages are merely build dependencies for
another package, and as such, don't need to appear in menuconfig.

How is host dtc going to be used in your use case?

> +# host build
> +HOST_DTC_DEPENDENCIES = host-bison host-flex

Not really needed, those dependencies are automatically inherited from
DTC_DEPENDENCIES.

> +define HOST_DTC_BUILD_CMDS
> +	$(HOST_CONFIGURE_OPTS)    \
> +	CFLAGS="$(HOST_CFLAGS)"   \

Not needed, this definition of CFLAGS is already in
$(HOST_CONFIGURE_OPTS).

Otherwise, looks good.

Thanks,

Thomas Petazzoni
Peter Seiderer Jan. 12, 2015, 10:31 p.m. UTC | #2
Hello Thomas,

> Gesendet: Montag, 12. Januar 2015 um 21:42 Uhr
> Von: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
> An: "Peter Seiderer" <ps.report@gmx.net>
> Cc: buildroot@busybox.net
> Betreff: Re: [Buildroot] [PATCH v2 3/4] dtc: add host build
>
> Dear Peter Seiderer,
> 
> On Sun, 11 Jan 2015 19:16:05 +0100, Peter Seiderer wrote:
> 
> > diff --git a/package/dtc/Config.in.host b/package/dtc/Config.in.host
> > new file mode 100644
> > index 0000000..cbabf0a
> > --- /dev/null
> > +++ b/package/dtc/Config.in.host
> > @@ -0,0 +1,9 @@
> > +config BR2_PACKAGE_HOST_DTC
> > +	bool "host dtc"
> > +	help
> > +	  The Device Tree Compiler, dtc, takes as input a device-tree in
> > +	  a given format and outputs a device-tree in another format.
> > +
> > +	  Install host tools: dtc, convert-dtsv0, fdtdump, fdtget and fdtput.
> > +
> > +	  https://git.kernel.org/cgit/utils/dtc/dtc.git
> 
> I'd like to understand a bit more how this is going to be used exactly,
> to see whether there is really a need for a menuconfig option for this
> host package. Most host packages are merely build dependencies for
> another package, and as such, don't need to appear in menuconfig.
> 
> How is host dtc going to be used in your use case?

With the host dtc tools I can build/rebuild (and debug) the needed
dtb files for my Raspberry Pi. With the overlay extension (see next
patch in the series) it is possible do deploy extra overlays
e.g. enable i2c/spi etc. when using Yann's rpi update [1].

I can give a complete example soon, now I have my rpi tft display
runnnig, needed to adjust the videocore dtb to enable the
4 buttons (set gpio pins to pull_up, see [2] for description)
and enable spi with an dtb overlay (see [3] for description)...

[1] http://lists.busybox.net/pipermail/buildroot/2015-January/116918.html
[2] http://www.raspberrypi.org/documentation/configuration/pin-configuration.md
[3] https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md

The videcore dbt adjusting could be done with the kernel-tree provided dtc,
the overlay support needs a patched dtc...

> 
> > +# host build
> > +HOST_DTC_DEPENDENCIES = host-bison host-flex
> 
> Not really needed, those dependencies are automatically inherited from
> DTC_DEPENDENCIES.

O.k. thats fine, will remove...
> 
> > +define HOST_DTC_BUILD_CMDS
> > +	$(HOST_CONFIGURE_OPTS)    \
> > +	CFLAGS="$(HOST_CFLAGS)"   \
> 
> Not needed, this definition of CFLAGS is already in
> $(HOST_CONFIGURE_OPTS).
> 

O.k., will remove...

Regards,
Peter

> Otherwise, looks good.
> 
> Thanks,
> 
> Thomas Petazzoni
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
>
diff mbox

Patch

diff --git a/package/Config.in.host b/package/Config.in.host
index 94981ad..6a63e57 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -5,6 +5,7 @@  menu "Host utilities"
 	source "package/dfu-util/Config.in.host"
 	source "package/dos2unix/Config.in.host"
 	source "package/dosfstools/Config.in.host"
+	source "package/dtc/Config.in.host"
 	source "package/e2fsprogs/Config.in.host"
 	source "package/e2tools/Config.in.host"
 	source "package/genext2fs/Config.in.host"
diff --git a/package/dtc/Config.in.host b/package/dtc/Config.in.host
new file mode 100644
index 0000000..cbabf0a
--- /dev/null
+++ b/package/dtc/Config.in.host
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_HOST_DTC
+	bool "host dtc"
+	help
+	  The Device Tree Compiler, dtc, takes as input a device-tree in
+	  a given format and outputs a device-tree in another format.
+
+	  Install host tools: dtc, convert-dtsv0, fdtdump, fdtget and fdtput.
+
+	  https://git.kernel.org/cgit/utils/dtc/dtc.git
diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
index c96f881..f1c5baa 100644
--- a/package/dtc/dtc.mk
+++ b/package/dtc/dtc.mk
@@ -48,4 +48,18 @@  define DTC_INSTALL_TARGET_CMDS
 	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
 endef
 
+# host build
+HOST_DTC_DEPENDENCIES = host-bison host-flex
+
+define HOST_DTC_BUILD_CMDS
+	$(HOST_CONFIGURE_OPTS)    \
+	CFLAGS="$(HOST_CFLAGS)"   \
+	$(MAKE) -C $(@D) PREFIX=/usr
+endef
+
+define HOST_DTC_INSTALL_CMDS
+	$(MAKE) -C $(@D) DESTDIR=$(HOST_DIR) PREFIX=/usr install-bin
+endef
+
 $(eval $(generic-package))
+$(eval $(host-generic-package))