Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support
@ 2015-01-13 19:40 Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 1/7] dtc: fix project and download url Peter Seiderer
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

There are two different dtb files used for raspberry pi booting:
- overwrite the firmware provided videocore dtb configuration ([1])
- linux kernel dtb configuration and dtb overlays ([2])

Example for Raspberry Pi B+ and Adafruit PiTFT 320x240 TFT module with
capcacitive touchscreen ([3]).

The PiTFT module has 4 buttons which can connect gpio 17, 22, 23 or 27 to GND,
this means this gpios have to be configured to input with pull up termination
(input is '1' with switch open, input is '0' with switch closed).

Setting the gpio parameters can be done by direct register setting (see [4] for
example, similare code can be put into arch/arm/mach-bcm2708/bcm2708.c) or
by the modern way, overwrite the videocore dtb boot configuration.

For the example with the 4 buttons do the following:

- get the original videocore dts file:

	$ wget http://www.raspberrypi.org/documentation/configuration/images/dt-blob.dts

- apply the following patch:

--- a/dt-blob.dts 2015-01-11 17:32:56.730450241 +0100
+++ b/dt-blob.dts 2015-01-11 18:01:15.715903945 +0100
@@ -186,6 +186,10 @@
                   }; // pin
                   pin at p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
                   pin at p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
+                  pin at p17 { function = "input"; termination = "pull_up";}; // adafruit28 - button 4
+                  pin at p22 { function = "input"; termination = "pull_up";}; // adafruit28 - button 2
+                  pin at p23 { function = "input"; termination = "pull_up";}; // adafruit28 - button 1
+                  pin at p27 { function = "input"; termination = "pull_up";}; // adafruit28 - button 3
                   pin at p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
                   pin at p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
                   pin at p31 { function = "output"; termination = "pull_down"; }; // LAN NRESET

- compile to dtb file:

	$ host/usr/bin/dtc -I dts -O dtb -o dt-blob.bin dt-blob.dts

- copy the resulting dt-blob.bin to the Raspberry Pi boot partition, the videocore will use
  it automatically

After this steps you can use the 4 buttons, for example do the following on the target
(for the fist button):

	$ echo 23 > /sys/class/gpio/export
	$ while true; do echo -n "gpio-23: "; cat /sys/class/gpio/gpio23/value; sleep 2; done

The second use case is for the linux kernel dtb configuration using overlays, e.g.
enable spi when using a device tree enabled Raspberry Pi linux kernel ([5]):

- use the following adafruit28-spi0.dts file:
/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2708";

   fragment at 0 {
      target = <&spi0>;
      __overlay__ {
         status = "okay";
         spidev at 0{
            spi-max-frequency = <32000000>;
         };
         spidev at 1{
            spi-max-frequency = <32000000>;
         };
      };
   };
};

- compile to dtb overlay file

	$ host/usr/bin/dtc -@ -I dts -O dtb -o adafruit28-spi0.dtb adafruit28-spi0.dts

- copy the resulting adafruit28-spi0.dtb to the Raspberry Pi boot partition overlay directory and
  add the following line to the file config.txt on the boot partition:

	device_tree_overlay=overlays/adafruit28-spi0.dtb

This will enable the spi bus used for the PiTFT 320x240 TFT module (which is otherwise
disabled by default).

The same dtb overlay method is used for BeagleBone (see [6]).

[1] http://www.raspberrypi.org/documentation/configuration/pin-configuration.md
[2] https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md
[3] http://www.adafruit.com/products/1983
[4] https://github.com/adafruit/adafruit-rpi-fbtft/commit/b4a3d8e481eae0290d5f0d3327be5624b0077c54
[5] http://lists.busybox.net/pipermail/buildroot/2015-January/116919.html
[6] https://learn.adafruit.com/introduction-to-the-beaglebone-black-device-tree/device-tree-overlays

Peter Seiderer (7):
  dtc: fix project and download url
  dtc: rename patches to new convention
  dtc: bump version to 1.4.1
  dtc: add hash
  dtc: add host build
  dtc: add patches for raspberry pi overlay support
  linux: install dtc only in case package host dtc is not selected

 linux/linux.mk                                     |   3 +-
 package/Config.in.host                             |   1 +
 ...-extra_cflags.patch => 0002-extra-cflags.patch} |   2 +-
 .../0003-dtc-Dynamic-symbols-fixup-support.patch   | 581 +++++++++++++++++++++
 .../0004-dtc-v-takes-no-argument-drop-extra.patch  |  44 ++
 package/dtc/Config.in                              |   2 +-
 package/dtc/Config.in.host                         |   9 +
 package/dtc/dtc-separate-lib-install.patch         |  28 -
 package/dtc/dtc.hash                               |   2 +
 package/dtc/dtc.mk                                 |  27 +-
 10 files changed, 657 insertions(+), 42 deletions(-)
 rename package/dtc/{dtc-extra_cflags.patch => 0002-extra-cflags.patch} (92%)
 create mode 100644 package/dtc/0003-dtc-Dynamic-symbols-fixup-support.patch
 create mode 100644 package/dtc/0004-dtc-v-takes-no-argument-drop-extra.patch
 create mode 100644 package/dtc/Config.in.host
 delete mode 100644 package/dtc/dtc-separate-lib-install.patch
 create mode 100644 package/dtc/dtc.hash

-- 
2.1.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 1/7] dtc: fix project and download url
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 2/7] dtc: rename patches to new convention Peter Seiderer
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

This fix the error:

fatal: unable to connect to git.jdl.com:
git.jdl.com[0: 208.123.73.151]: errno=Connection refused

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
- split rename patches to extra patch (suggested by Thomas Petazzoni)
- add download failure log extract (borrowed from Fabio Porcedda
  suggested patch)
---
 package/dtc/Config.in | 2 +-
 package/dtc/dtc.mk    | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/dtc/Config.in b/package/dtc/Config.in
index 7b02dd2..39223f7 100644
--- a/package/dtc/Config.in
+++ b/package/dtc/Config.in
@@ -8,7 +8,7 @@ config BR2_PACKAGE_DTC
 	  Note that only the library is installed.
 	  If you want the programs, say 'y' here, and to "dtc programs", below.
 
-	  http://git.jdl.com/gitweb/?p=dtc.git  (no home page)
+	  https://git.kernel.org/cgit/utils/dtc/dtc.git
 
 if BR2_PACKAGE_DTC
 
diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
index 51b5b4e..6fd5064 100644
--- a/package/dtc/dtc.mk
+++ b/package/dtc/dtc.mk
@@ -4,8 +4,9 @@
 #
 ################################################################################
 
-DTC_VERSION = v1.4.0
-DTC_SITE = git://git.jdl.com/software/dtc.git
+DTC_VERSION = 1.4.0
+DTC_SOURCE = dtc-$(DTC_VERSION).tar.xz
+DTC_SITE = https://www.kernel.org/pub/software/utils/dtc
 DTC_LICENSE = GPLv2+/BSD-2c
 DTC_LICENSE_FILES = README.license GPL
 DTC_INSTALL_STAGING = YES
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 2/7] dtc: rename patches to new convention
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 1/7] dtc: fix project and download url Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 3/7] dtc: bump version to 1.4.1 Peter Seiderer
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 .../{dtc-separate-lib-install.patch => 0001-separate-lib-install.patch}   | 0
 package/dtc/{dtc-extra_cflags.patch => 0002-extra-cflags.patch}           | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename package/dtc/{dtc-separate-lib-install.patch => 0001-separate-lib-install.patch} (100%)
 rename package/dtc/{dtc-extra_cflags.patch => 0002-extra-cflags.patch} (100%)

diff --git a/package/dtc/dtc-separate-lib-install.patch b/package/dtc/0001-separate-lib-install.patch
similarity index 100%
rename from package/dtc/dtc-separate-lib-install.patch
rename to package/dtc/0001-separate-lib-install.patch
diff --git a/package/dtc/dtc-extra_cflags.patch b/package/dtc/0002-extra-cflags.patch
similarity index 100%
rename from package/dtc/dtc-extra_cflags.patch
rename to package/dtc/0002-extra-cflags.patch
-- 
2.1.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 3/7] dtc: bump version to 1.4.1
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 1/7] dtc: fix project and download url Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 2/7] dtc: rename patches to new convention Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 4/7] dtc: add hash Peter Seiderer
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

Patch 0001-separate-lib-install.patch is no longer needed,
original Makefile already contains separate install-lib target
(but build always complete default target).

Remove superfluous CFLAGS setting.

Adjust 0002-extra-cflags.patch.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
  - always use default build target, avoids build failure
    (suggested by Thomas Petazzoni)
  - no need for extra CFLAGS setting (suggested by Thomas Petazzoni)
  - split add hash to extra commit

Changes v1 -> v2:
  - delete additional invalid comment
---
 package/dtc/0001-separate-lib-install.patch | 28 ----------------------------
 package/dtc/0002-extra-cflags.patch         |  2 +-
 package/dtc/dtc.mk                          | 14 ++++----------
 3 files changed, 5 insertions(+), 39 deletions(-)
 delete mode 100644 package/dtc/0001-separate-lib-install.patch

diff --git a/package/dtc/0001-separate-lib-install.patch b/package/dtc/0001-separate-lib-install.patch
deleted file mode 100644
index c86d587..0000000
--- a/package/dtc/0001-separate-lib-install.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Makefile: add a rule to only install libfdt
-
-Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
-
----
-Patch not sent upstream.
-
-It's really specific to buildroot, and is probably not
-good (aka generic) enough to be pushed upstream.
-
-diff --git a/Makefile b/Makefile
-index 1169e6c..39e7190 100644
---- a/Makefile
-+++ b/Makefile
-@@ -160,10 +160,12 @@ endif
- # intermediate target and building them again "for real"
- .SECONDARY: $(DTC_GEN_SRCS) $(CONVERT_GEN_SRCS)
- 
--install: all $(SCRIPTS)
-+install: all $(SCRIPTS) libfdt_install
- 	@$(VECHO) INSTALL
- 	$(INSTALL) -d $(DESTDIR)$(BINDIR)
- 	$(INSTALL) $(BIN) $(SCRIPTS) $(DESTDIR)$(BINDIR)
-+
-+libfdt_install: libfdt
- 	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
- 	$(INSTALL) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
- 	ln -sf $(notdir $(LIBFDT_lib)) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname)
diff --git a/package/dtc/0002-extra-cflags.patch b/package/dtc/0002-extra-cflags.patch
index 51b7957..f070692 100644
--- a/package/dtc/0002-extra-cflags.patch
+++ b/package/dtc/0002-extra-cflags.patch
@@ -23,7 +23,7 @@ index 962f94eba661..bf6b317158cf 100644
  CPPFLAGS = -I libfdt -I .
 -WARNINGS = -Werror -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
 +WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
- 	-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls
+ 	-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
 -CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
 +CFLAGS ?= -g -Os
 +CFLAGS += -fPIC $(WARNINGS)
diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
index 6fd5064..c01fe7b 100644
--- a/package/dtc/dtc.mk
+++ b/package/dtc/dtc.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-DTC_VERSION = 1.4.0
+DTC_VERSION = 1.4.1
 DTC_SOURCE = dtc-$(DTC_VERSION).tar.xz
 DTC_SITE = https://www.kernel.org/pub/software/utils/dtc
 DTC_LICENSE = GPLv2+/BSD-2c
@@ -19,8 +19,6 @@ endef
 ifeq ($(BR2_PACKAGE_DTC_PROGRAMS),y)
 
 DTC_LICENSE += (for the library), GPLv2+ (for the executables)
-# Use default goal to build everything
-DTC_BUILD_GOAL =
 DTC_INSTALL_GOAL = install
 ifeq ($(BR2_PACKAGE_BASH),)
 DTC_POST_INSTALL_TARGET_HOOKS += DTC_POST_INSTALL_TARGET_RM_DTDIFF
@@ -28,21 +26,17 @@ endif
 
 else # $(BR2_PACKAGE_DTC_PROGRAMS) != y
 
-DTC_BUILD_GOAL = libfdt
-#?libfdt_install is our own install rule added by our patch
-DTC_INSTALL_GOAL = libfdt_install
+DTC_INSTALL_GOAL = install-lib
 
 endif # $(BR2_PACKAGE_DTC_PROGRAMS) != y
 
 define DTC_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS)    \
-	CFLAGS="$(TARGET_CFLAGS)"   \
-	$(MAKE) -C $(@D) PREFIX=/usr $(DTC_BUILD_GOAL)
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) PREFIX=/usr
 endef
 
 # For staging, only the library is needed
 define DTC_INSTALL_STAGING_CMDS
-	$(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr libfdt_install
+	$(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr install-lib
 endef
 
 define DTC_INSTALL_TARGET_CMDS
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 4/7] dtc: add hash
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (2 preceding siblings ...)
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 3/7] dtc: bump version to 1.4.1 Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 5/7] dtc: add host build Peter Seiderer
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 package/dtc/dtc.hash | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 package/dtc/dtc.hash

diff --git a/package/dtc/dtc.hash b/package/dtc/dtc.hash
new file mode 100644
index 0000000..8b3af33
--- /dev/null
+++ b/package/dtc/dtc.hash
@@ -0,0 +1,2 @@
+# from https://www.kernel.org/pub/software/utils/dtc/sha256sums.asc
+sha256 77992ad8eac7b68f553d0ba58e5b51604ac803d126196c99e3ae38aaae28bb94  dtc-1.4.1.tar.xz
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 5/7] dtc: add host build
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (3 preceding siblings ...)
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 4/7] dtc: add hash Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-18 16:51   ` Yann E. MORIN
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 6/7] dtc: add patches for raspberry pi overlay support Peter Seiderer
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
  - remove extra HOST_DTC_DEPENDENCIES (suggested by Thomas Petazzoni)
  - no need for extra CFLAGS setting (suggested by Thomas Petazzoni)

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         | 10 ++++++++++
 3 files changed, 20 insertions(+)
 create mode 100644 package/dtc/Config.in.host

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 c01fe7b..b0e2f28 100644
--- a/package/dtc/dtc.mk
+++ b/package/dtc/dtc.mk
@@ -43,4 +43,14 @@ define DTC_INSTALL_TARGET_CMDS
 	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
 endef
 
+# host build
+define HOST_DTC_BUILD_CMDS
+	$(HOST_CONFIGURE_OPTS) $(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))
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 6/7] dtc: add patches for raspberry pi overlay support
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (4 preceding siblings ...)
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 5/7] dtc: add host build Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 7/7] linux: install dtc only in case package host dtc is not selected Peter Seiderer
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

See [1] for documentation of raspberry pi kernel dt overlay support.

The following patches (see original download urls) where adjusted to dtc-1.4.1:

- 0003-dtc-Dynamic-symbols-fixup-support.patch
https://github.com/RobertCNelson/dtc/commit/dd6a0533e846e8d5e690a618fa35cc15a6103efb.patch

- 0004-dtc-v-takes-no-argument-drop-extra.patch
https://github.com/RobertCNelson/dtc/commit/f345d9e48c9e1169edf047de742da142cc5687bc.patch

[1] https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 .../0003-dtc-Dynamic-symbols-fixup-support.patch   | 581 +++++++++++++++++++++
 .../0004-dtc-v-takes-no-argument-drop-extra.patch  |  44 ++
 2 files changed, 625 insertions(+)
 create mode 100644 package/dtc/0003-dtc-Dynamic-symbols-fixup-support.patch
 create mode 100644 package/dtc/0004-dtc-v-takes-no-argument-drop-extra.patch

diff --git a/package/dtc/0003-dtc-Dynamic-symbols-fixup-support.patch b/package/dtc/0003-dtc-Dynamic-symbols-fixup-support.patch
new file mode 100644
index 0000000..125cd96
--- /dev/null
+++ b/package/dtc/0003-dtc-Dynamic-symbols-fixup-support.patch
@@ -0,0 +1,581 @@
+From 144952b04835af4ee235ea0735e6ba999eab559c Mon Sep 17 00:00:00 2001
+From: Pantelis Antoniou <panto@antoniou-consulting.com>
+Date: Fri, 4 Jan 2013 21:16:21 +0200
+Subject: [PATCH 3/4] dtc: Dynamic symbols & fixup support
+
+Enable the generation of symbol & fixup information for
+usage with dynamic DT loading.
+
+Passing the -@ option generates a __symbols__ node at the
+root node of the resulting blob for any node labels used.
+
+When using the /plugin/ tag all unresolved label references
+be tracked in the __fixups__ node, while all local phandle
+references will the tracked in the __local_fixups__ node.
+
+This is sufficient to implement a dynamic DT object loader.
+
+Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
+Signed-off-by: Stefan Agner <stefan@agner.ch>
+
+Adjusted to dtc-1.4.1:
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ Documentation/dts-format.txt |   7 +++
+ Documentation/manual.txt     |   8 +++
+ checks.c                     | 120 +++++++++++++++++++++++++++++++++++--
+ dtc-lexer.l                  |   5 ++
+ dtc-parser.y                 |  23 ++++++-
+ dtc.c                        |   9 ++-
+ dtc.h                        |  38 ++++++++++++
+ flattree.c                   | 139 +++++++++++++++++++++++++++++++++++++++++++
+ 8 files changed, 340 insertions(+), 9 deletions(-)
+
+diff --git a/Documentation/dts-format.txt b/Documentation/dts-format.txt
+index 41741df..4da515c 100644
+--- a/Documentation/dts-format.txt
++++ b/Documentation/dts-format.txt
+@@ -115,7 +115,14 @@ Version 1 DTS files have the overall layout:
+ 
+ * C style (/* ... */) and C++ style (// ...) comments are supported.
+ 
++Device Tree Objects
++-------------------
+ 
++Using the plugin tag enables dynamic tree objects.
++
++	/plugin/;
++
++For the full details please see Documentation/dt-object-internal.txt
+ 
+ 	-- David Gibson <david@gibson.dropbear.id.au>
+ 	-- Yoder Stuart <stuart.yoder@freescale.com>
+diff --git a/Documentation/manual.txt b/Documentation/manual.txt
+index 398de32..07321ff 100644
+--- a/Documentation/manual.txt
++++ b/Documentation/manual.txt
+@@ -131,6 +131,14 @@ Options:
+ 	By default the most recent version is generated.
+ 	Relevant for dtb and asm output only.
+ 
++    -@
++        Dynamic resolution mode. For non /plugin/ compilations generate
++	a __symbols__ node containing a list of all nodes with a label.
++	When /plugin/ is used, unresolved references are recorded in
++	a __fixups__ node, while local phandle references are recorded
++	in a __local_fixups__ node.
++	See Documentation/dt-object-internal.txt
++
+ 
+ The <output_version> defines what version of the "blob" format will be
+ generated.  Supported versions are 1, 2, 3, 16 and 17.  The default is
+diff --git a/checks.c b/checks.c
+index 3bf0fa4..078a50e 100644
+--- a/checks.c
++++ b/checks.c
+@@ -457,22 +457,93 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
+ 				     struct node *node, struct property *prop)
+ {
+ 	struct marker *m = prop->val.markers;
++	struct fixup *f, **fp;
++	struct fixup_entry *fe, **fep;
+ 	struct node *refnode;
+ 	cell_t phandle;
++	int has_phandle_refs;
++
++	has_phandle_refs = 0;
++	for_each_marker_of_type(m, REF_PHANDLE) {
++		has_phandle_refs = 1;
++		break;
++	}
++
++	if (!has_phandle_refs)
++		return;
+ 
+ 	for_each_marker_of_type(m, REF_PHANDLE) {
+ 		assert(m->offset + sizeof(cell_t) <= prop->val.len);
+ 
+ 		refnode = get_node_by_ref(dt, m->ref);
+-		if (! refnode) {
++		if (!refnode && !symbol_fixup_support) {
+ 			FAIL(c, "Reference to non-existent node or label \"%s\"\n",
+-			     m->ref);
++				m->ref);
+ 			continue;
+ 		}
+ 
+-		phandle = get_node_phandle(dt, refnode);
+-		*((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
++		if (!refnode) {
++			/* allocate fixup entry */
++			fe = xmalloc(sizeof(*fe));
++
++			fe->node = node;
++			fe->prop = prop;
++			fe->offset = m->offset;
++			fe->next = NULL;
++
++			/* search for an already existing fixup */
++			for_each_fixup(dt, f)
++				if (strcmp(f->ref, m->ref) == 0)
++					break;
++
++			/* no fixup found, add new */
++			if (f == NULL) {
++				f = xmalloc(sizeof(*f));
++				f->ref = m->ref;
++				f->entries = NULL;
++				f->next = NULL;
++
++				/* add it to the tree */
++				fp = &dt->fixups;
++				while (*fp)
++					fp = &(*fp)->next;
++				*fp = f;
++			}
++
++			/* and now append fixup entry */
++			fep = &f->entries;
++			while (*fep)
++				fep = &(*fep)->next;
++			*fep = fe;
++
++			/* mark the entry as unresolved */
++			phandle = 0xdeadbeef;
++		} else {
++			phandle = get_node_phandle(dt, refnode);
++
++			/* if it's a plugin, we need to record it */
++			if (symbol_fixup_support && dt->is_plugin) {
++
++				/* allocate a new local fixup entry */
++				fe = xmalloc(sizeof(*fe));
++
++				fe->node = node;
++				fe->prop = prop;
++				fe->offset = m->offset;
++				fe->next = NULL;
++
++				/* append it to the local fixups */
++				fep = &dt->local_fixups;
++				while (*fep)
++					fep = &(*fep)->next;
++				*fep = fe;
++			}
++		}
++
++		*((cell_t *)(prop->val.val + m->offset)) =
++			cpu_to_fdt32(phandle);
+ 	}
++
+ }
+ ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
+       &duplicate_node_names, &explicit_phandles);
+@@ -651,6 +722,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
+ }
+ TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
+ 
++static void check_auto_label_phandles(struct check *c, struct node *dt,
++				       struct node *node)
++{
++	struct label *l;
++	struct symbol *s, **sp;
++	int has_label;
++
++	if (!symbol_fixup_support)
++		return;
++
++	has_label = 0;
++	for_each_label(node->labels, l) {
++		has_label = 1;
++		break;
++	}
++
++	if (!has_label)
++		return;
++
++	/* force allocation of a phandle for this node */
++	(void)get_node_phandle(dt, node);
++
++	/* add the symbol */
++	for_each_label(node->labels, l) {
++
++		s = xmalloc(sizeof(*s));
++		s->label = l;
++		s->node = node;
++		s->next = NULL;
++
++		/* add it to the symbols list */
++		sp = &dt->symbols;
++		while (*sp)
++			sp = &((*sp)->next);
++		*sp = s;
++	}
++}
++NODE_WARNING(auto_label_phandles, NULL);
++
+ static struct check *check_table[] = {
+ 	&duplicate_node_names, &duplicate_property_names,
+ 	&node_name_chars, &node_name_format, &property_name_chars,
+@@ -669,6 +779,8 @@ static struct check *check_table[] = {
+ 	&avoid_default_addr_size,
+ 	&obsolete_chosen_interrupt_controller,
+ 
++	&auto_label_phandles,
++
+ 	&always_fail,
+ };
+ 
+diff --git a/dtc-lexer.l b/dtc-lexer.l
+index 0ee1caf..dd44ba2 100644
+--- a/dtc-lexer.l
++++ b/dtc-lexer.l
+@@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...);
+ 			return DT_V1;
+ 		}
+ 
++<*>"/plugin/"	{
++			DPRINT("Keyword: /plugin/\n");
++			return DT_PLUGIN;
++		}
++
+ <*>"/memreserve/"	{
+ 			DPRINT("Keyword: /memreserve/\n");
+ 			BEGIN_DEFAULT();
+diff --git a/dtc-parser.y b/dtc-parser.y
+index ea57e0a..687ccad 100644
+--- a/dtc-parser.y
++++ b/dtc-parser.y
+@@ -19,6 +19,7 @@
+  */
+ %{
+ #include <stdio.h>
++#include <inttypes.h>
+ 
+ #include "dtc.h"
+ #include "srcpos.h"
+@@ -52,9 +53,11 @@ extern bool treesource_error;
+ 	struct node *nodelist;
+ 	struct reserve_info *re;
+ 	uint64_t integer;
++	int is_plugin;
+ }
+ 
+ %token DT_V1
++%token DT_PLUGIN
+ %token DT_MEMRESERVE
+ %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
+ %token DT_BITS
+@@ -71,6 +74,7 @@ extern bool treesource_error;
+ 
+ %type <data> propdata
+ %type <data> propdataprefix
++%type <is_plugin> plugindecl
+ %type <re> memreserve
+ %type <re> memreserves
+ %type <array> arrayprefix
+@@ -101,10 +105,23 @@ extern bool treesource_error;
+ %%
+ 
+ sourcefile:
+-	  DT_V1 ';' memreserves devicetree
++	  DT_V1 ';' plugindecl memreserves devicetree
+ 		{
+-			the_boot_info = build_boot_info($3, $4,
+-							guess_boot_cpuid($4));
++			$5->is_plugin = $3;
++			$5->is_root = 1;
++			the_boot_info = build_boot_info($4, $5,
++							guess_boot_cpuid($5));
++		}
++	;
++
++plugindecl:
++	/* empty */
++		{
++			$$ = 0;
++		}
++	| DT_PLUGIN ';'
++		{
++			$$ = 1;
+ 		}
+ 	;
+ 
+diff --git a/dtc.c b/dtc.c
+index 8c4add6..f4d56e5 100644
+--- a/dtc.c
++++ b/dtc.c
+@@ -29,6 +29,7 @@ int reservenum;		/* Number of memory reservation slots */
+ int minsize;		/* Minimum blob size */
+ int padsize;		/* Additional padding to blob */
+ int phandle_format = PHANDLE_BOTH;	/* Use linux,phandle or phandle properties */
++int symbol_fixup_support = 0;
+ 
+ static void fill_fullpaths(struct node *tree, const char *prefix)
+ {
+@@ -51,7 +52,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
+ #define FDT_VERSION(version)	_FDT_VERSION(version)
+ #define _FDT_VERSION(version)	#version
+ static const char usage_synopsis[] = "dtc [options] <input file>";
+-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv:@";
+ static struct option const usage_long_opts[] = {
+ 	{"quiet",            no_argument, NULL, 'q'},
+ 	{"in-format",         a_argument, NULL, 'I'},
+@@ -69,6 +70,7 @@ static struct option const usage_long_opts[] = {
+ 	{"phandle",           a_argument, NULL, 'H'},
+ 	{"warning",           a_argument, NULL, 'W'},
+ 	{"error",             a_argument, NULL, 'E'},
++	{"symbols",           a_argument, NULL, '@'},
+ 	{"help",             no_argument, NULL, 'h'},
+ 	{"version",          no_argument, NULL, 'v'},
+ 	{NULL,               no_argument, NULL, 0x0},
+@@ -99,6 +101,7 @@ static const char * const usage_opts_help[] = {
+ 	 "\t\tboth   - Both \"linux,phandle\" and \"phandle\" properties",
+ 	"\n\tEnable/disable warnings (prefix with \"no-\")",
+ 	"\n\tEnable/disable errors (prefix with \"no-\")",
++	"\n\tSymbols and Fixups support",
+ 	"\n\tPrint this help and exit",
+ 	"\n\tPrint version and exit",
+ 	NULL,
+@@ -186,7 +189,9 @@ int main(int argc, char *argv[])
+ 		case 'E':
+ 			parse_checks_option(false, true, optarg);
+ 			break;
+-
++		case '@':
++			symbol_fixup_support = 1;
++			break;
+ 		case 'h':
+ 			usage(NULL);
+ 		default:
+diff --git a/dtc.h b/dtc.h
+index 56212c8..fe45748 100644
+--- a/dtc.h
++++ b/dtc.h
+@@ -54,6 +54,7 @@ extern int reservenum;		/* Number of memory reservation slots */
+ extern int minsize;		/* Minimum blob size */
+ extern int padsize;		/* Additional padding to blob */
+ extern int phandle_format;	/* Use linux,phandle or phandle properties */
++extern int symbol_fixup_support;/* enable symbols & fixup support */
+ 
+ #define PHANDLE_LEGACY	0x1
+ #define PHANDLE_EPAPR	0x2
+@@ -132,6 +133,25 @@ struct label {
+ 	struct label *next;
+ };
+ 
++struct fixup_entry {
++	int offset;
++	struct node *node;
++	struct property *prop;
++	struct fixup_entry *next;
++};
++
++struct fixup {
++	char *ref;
++	struct fixup_entry *entries;
++	struct fixup *next;
++};
++
++struct symbol {
++	struct label *label;
++	struct node *node;
++	struct symbol *next;
++};
++
+ struct property {
+ 	bool deleted;
+ 	char *name;
+@@ -158,6 +178,12 @@ struct node {
+ 	int addr_cells, size_cells;
+ 
+ 	struct label *labels;
++
++	int is_root;
++	int is_plugin;
++	struct fixup *fixups;
++	struct symbol *symbols;
++	struct fixup_entry *local_fixups;
+ };
+ 
+ #define for_each_label_withdel(l0, l) \
+@@ -181,6 +207,18 @@ struct node {
+ 	for_each_child_withdel(n, c) \
+ 		if (!(c)->deleted)
+ 
++#define for_each_fixup(n, f) \
++	for ((f) = (n)->fixups; (f); (f) = (f)->next)
++
++#define for_each_fixup_entry(f, fe) \
++	for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
++
++#define for_each_symbol(n, s) \
++	for ((s) = (n)->symbols; (s); (s) = (s)->next)
++
++#define for_each_local_fixup_entry(n, fe) \
++	for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
++
+ void add_label(struct label **labels, char *label);
+ void delete_labels(struct label **labels);
+ 
+diff --git a/flattree.c b/flattree.c
+index bd99fa2..7f3df74 100644
+--- a/flattree.c
++++ b/flattree.c
+@@ -262,6 +262,12 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
+ 	struct property *prop;
+ 	struct node *child;
+ 	bool seen_name_prop = false;
++	struct symbol *sym;
++	struct fixup *f;
++	struct fixup_entry *fe;
++	char *name, *s;
++	const char *fullpath;
++	int namesz, nameoff, vallen;
+ 
+ 	if (tree->deleted)
+ 		return;
+@@ -310,6 +316,139 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
+ 		flatten_tree(child, emit, etarget, strbuf, vi);
+ 	}
+ 
++	if (!symbol_fixup_support)
++		goto no_symbols;
++
++	/* add the symbol nodes (if any) */
++	if (tree->symbols) {
++
++		emit->beginnode(etarget, NULL);
++		emit->string(etarget, "__symbols__", 0);
++		emit->align(etarget, sizeof(cell_t));
++
++		for_each_symbol(tree, sym) {
++
++			vallen = strlen(sym->node->fullpath);
++
++			nameoff = stringtable_insert(strbuf, sym->label->label);
++
++			emit->property(etarget, NULL);
++			emit->cell(etarget, vallen + 1);
++			emit->cell(etarget, nameoff);
++
++			if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
++				emit->align(etarget, 8);
++
++			emit->string(etarget, sym->node->fullpath,
++					strlen(sym->node->fullpath));
++			emit->align(etarget, sizeof(cell_t));
++		}
++
++		emit->endnode(etarget, NULL);
++	}
++
++	/* add the fixup nodes */
++	if (tree->fixups) {
++
++		/* emit the external fixups */
++		emit->beginnode(etarget, NULL);
++		emit->string(etarget, "__fixups__", 0);
++		emit->align(etarget, sizeof(cell_t));
++
++		for_each_fixup(tree, f) {
++
++			namesz = 0;
++			for_each_fixup_entry(f, fe) {
++				fullpath = fe->node->fullpath;
++				if (fullpath[0] == '\0')
++					fullpath = "/";
++				namesz += strlen(fullpath) + 1;
++			      	namesz += strlen(fe->prop->name) + 1;
++				namesz += 32;	/* space for :<number> + '\0' */
++			}
++
++			name = xmalloc(namesz);
++
++			s = name;
++			for_each_fixup_entry(f, fe) {
++				fullpath = fe->node->fullpath;
++				if (fullpath[0] == '\0')
++					fullpath = "/";
++				snprintf(s, name + namesz - s, "%s:%s:%d",
++						fullpath,
++						fe->prop->name, fe->offset);
++				s += strlen(s) + 1;
++			}
++
++			nameoff = stringtable_insert(strbuf, f->ref);
++			vallen = s - name - 1;
++
++			emit->property(etarget, NULL);
++			emit->cell(etarget, vallen + 1);
++			emit->cell(etarget, nameoff);
++
++			if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
++				emit->align(etarget, 8);
++
++			emit->string(etarget, name, vallen);
++			emit->align(etarget, sizeof(cell_t));
++
++			free(name);
++		}
++
++		emit->endnode(etarget, tree->labels);
++	}
++
++	/* add the local fixup property */
++	if (tree->local_fixups) {
++
++		/* emit the external fixups */
++		emit->beginnode(etarget, NULL);
++		emit->string(etarget, "__local_fixups__", 0);
++		emit->align(etarget, sizeof(cell_t));
++
++		namesz = 0;
++		for_each_local_fixup_entry(tree, fe) {
++			fullpath = fe->node->fullpath;
++			if (fullpath[0] == '\0')
++				fullpath = "/";
++			namesz += strlen(fullpath) + 1;
++			namesz += strlen(fe->prop->name) + 1;
++			namesz += 32;	/* space for :<number> + '\0' */
++		}
++
++		name = xmalloc(namesz);
++
++		s = name;
++		for_each_local_fixup_entry(tree, fe) {
++			fullpath = fe->node->fullpath;
++			if (fullpath[0] == '\0')
++				fullpath = "/";
++			snprintf(s, name + namesz - s, "%s:%s:%d",
++					fullpath, fe->prop->name,
++					fe->offset);
++			s += strlen(s) + 1;
++		}
++
++		nameoff = stringtable_insert(strbuf, "fixup");
++		vallen = s - name - 1;
++
++		emit->property(etarget, NULL);
++		emit->cell(etarget, vallen + 1);
++		emit->cell(etarget, nameoff);
++
++		if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
++			emit->align(etarget, 8);
++
++		emit->string(etarget, name, vallen);
++		emit->align(etarget, sizeof(cell_t));
++
++		free(name);
++
++		emit->endnode(etarget, tree->labels);
++	}
++
++no_symbols:
+ 	emit->endnode(etarget, tree->labels);
+ }
+ 
+-- 
+2.1.2
+
diff --git a/package/dtc/0004-dtc-v-takes-no-argument-drop-extra.patch b/package/dtc/0004-dtc-v-takes-no-argument-drop-extra.patch
new file mode 100644
index 0000000..9bb3f48
--- /dev/null
+++ b/package/dtc/0004-dtc-v-takes-no-argument-drop-extra.patch
@@ -0,0 +1,44 @@
+From c01c20c475d1547ddb197f52ae1c725acc7b4e3e Mon Sep 17 00:00:00 2001
+From: Robert Nelson <robertcnelson@gmail.com>
+Date: Mon, 23 Sep 2013 11:05:12 -0500
+Subject: [PATCH 4/4] dtc: v takes no argument drop extra :
+
+$ git show dd6a0533
+... snip ...
+@@ -49,7 +50,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
+
+ /* Usage related data. */
+ static const char usage_synopsis[] = "dtc [options] <input file>";
+-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv:@";
+ static struct option const usage_long_opts[] = {
+        {"quiet",            no_argument, NULL, 'q'},
+        {"in-format",         a_argument, NULL, 'I'},
+
+  that patch is wrong, there should be no ":" after "v"
+
+Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
+Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
+
+Adjusted to dtc-1.4.1:
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ dtc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dtc.c b/dtc.c
+index f4d56e5..0cbb14c 100644
+--- a/dtc.c
++++ b/dtc.c
+@@ -52,7 +52,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
+ #define FDT_VERSION(version)	_FDT_VERSION(version)
+ #define _FDT_VERSION(version)	#version
+ static const char usage_synopsis[] = "dtc [options] <input file>";
+-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv:@";
++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
+ static struct option const usage_long_opts[] = {
+ 	{"quiet",            no_argument, NULL, 'q'},
+ 	{"in-format",         a_argument, NULL, 'I'},
+-- 
+2.1.2
+
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 7/7] linux: install dtc only in case package host dtc is not selected
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (5 preceding siblings ...)
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 6/7] dtc: add patches for raspberry pi overlay support Peter Seiderer
@ 2015-01-13 19:40 ` Peter Seiderer
  2015-01-14 19:49 ` [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Thomas Petazzoni
  2015-01-18 16:49 ` Yann E. MORIN
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-13 19:40 UTC (permalink / raw)
  To: buildroot

Suggested by Matthew Weber (see [1]) to avoid double installation
of host dtc.

[1] http://lists.busybox.net/pipermail/buildroot/2015-January/117121.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 linux/linux.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux/linux.mk b/linux/linux.mk
index 8256641..de15650 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -284,13 +284,14 @@ endef
 endif
 
 
+ifeq ($BR2_PACKAGE_HOST_DTC,)
 define LINUX_INSTALL_HOST_TOOLS
 	# Installing dtc (device tree compiler) as host tool, if selected
 	if grep -q "CONFIG_DTC=y" $(@D)/.config; then 	\
 		$(INSTALL) -D -m 0755 $(@D)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/dtc ;	\
 	fi
 endef
-
+endif
 
 define LINUX_INSTALL_IMAGES_CMDS
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (6 preceding siblings ...)
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 7/7] linux: install dtc only in case package host dtc is not selected Peter Seiderer
@ 2015-01-14 19:49 ` Thomas Petazzoni
  2015-01-18 16:49 ` Yann E. MORIN
  8 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2015-01-14 19:49 UTC (permalink / raw)
  To: buildroot

Dear Peter Seiderer,

On Tue, 13 Jan 2015 20:40:00 +0100, Peter Seiderer wrote:

> Peter Seiderer (7):
>   dtc: fix project and download url
>   dtc: rename patches to new convention
>   dtc: bump version to 1.4.1
>   dtc: add hash

I've applied those four initial patches.

>   dtc: add host build
>   dtc: add patches for raspberry pi overlay support
>   linux: install dtc only in case package host dtc is not selected

I'm not quite decided about those ones yet.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support
  2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
                   ` (7 preceding siblings ...)
  2015-01-14 19:49 ` [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Thomas Petazzoni
@ 2015-01-18 16:49 ` Yann E. MORIN
  2015-01-18 21:50   ` Peter Seiderer
  8 siblings, 1 reply; 13+ messages in thread
From: Yann E. MORIN @ 2015-01-18 16:49 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2015-01-13 20:40 +0100, Peter Seiderer spake thusly:
> There are two different dtb files used for raspberry pi booting:
> - overwrite the firmware provided videocore dtb configuration ([1])
> - linux kernel dtb configuration and dtb overlays ([2])

Well, I haven't yet tried to use overlays, but from what I understood,
DTB overlays can be handled seamlessly from the RPi bootloader:

    device_tree_overlay=path/to-overlay.dtb

So, is it really required that we do patch dtc for overlay support?

Instead, I would very much prefer we stick to what upstream dtc provide,
and when overlay support has been merged in there, we can bump our dtc
version (or backport just the overlay support if bumping is not
practical).

It would be very unmaintainable to bundle overlay support in Buildroot,
if upstream eventually decide to not support them, or decide to support
them in a very different way. We can not afford this, I'm afraid.

In the meantime, and that's unfortunate, we won't support overlays in
dtc... :-(

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 5/7] dtc: add host build
  2015-01-13 19:40 ` [Buildroot] [PATCH v3 5/7] dtc: add host build Peter Seiderer
@ 2015-01-18 16:51   ` Yann E. MORIN
  2015-01-18 21:52     ` Peter Seiderer
  0 siblings, 1 reply; 13+ messages in thread
From: Yann E. MORIN @ 2015-01-18 16:51 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2015-01-13 20:40 +0100, Peter Seiderer spake thusly:
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
[--SNIP--]
> diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
> index c01fe7b..b0e2f28 100644
> --- a/package/dtc/dtc.mk
> +++ b/package/dtc/dtc.mk
> @@ -43,4 +43,14 @@ define DTC_INSTALL_TARGET_CMDS
>  	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
>  endef
>  
> +# host build
> +define HOST_DTC_BUILD_CMDS
> +	$(HOST_CONFIGURE_OPTS) $(MAKE) -C $(@D) PREFIX=/usr

This is a host tool, you should set PREFIX=$(HOST_DIR)/usr  ...

> +endef
> +
> +define HOST_DTC_INSTALL_CMDS
> +	$(MAKE) -C $(@D) DESTDIR=$(HOST_DIR) PREFIX=/usr install-bin

... ditto, and not set a DESTDIR.

Regards,
Yann E. MORIN.

> +endef
> +
>  $(eval $(generic-package))
> +$(eval $(host-generic-package))
> -- 
> 2.1.2
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support
  2015-01-18 16:49 ` Yann E. MORIN
@ 2015-01-18 21:50   ` Peter Seiderer
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-18 21:50 UTC (permalink / raw)
  To: buildroot

Hello Yann,

> Gesendet: Sonntag, 18. Januar 2015 um 17:49 Uhr
> Von: "Yann E. MORIN" <yann.morin.1998@free.fr>
> An: "Peter Seiderer" <ps.report@gmx.net>
> Cc: buildroot at busybox.net, "Fabio Porcedda" <fabio.porcedda@gmail.com>, "Jeremy Kerr" <jk@ozlabs.org>, "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>, "Matthew Weber" <matthew.weber@rockwellcollins.com>
> Betreff: Re: [PATCH v3 0/7] dtc: update and add raspberry pi overlay support
>
> Peter, All,
> 
> On 2015-01-13 20:40 +0100, Peter Seiderer spake thusly:
> > There are two different dtb files used for raspberry pi booting:
> > - overwrite the firmware provided videocore dtb configuration ([1])
> > - linux kernel dtb configuration and dtb overlays ([2])
> 
> Well, I haven't yet tried to use overlays, but from what I understood,
> DTB overlays can be handled seamlessly from the RPi bootloader:
> 
>     device_tree_overlay=path/to-overlay.dtb
> 

Yes thats the way you 'activate' a given overlay...

> So, is it really required that we do patch dtc for overlay support?
> 

Yes, you have to patch the dtc tool to be able to generate a suitable overlay dtb file...

> Instead, I would very much prefer we stick to what upstream dtc provide,
> and when overlay support has been merged in there, we can bump our dtc
> version (or backport just the overlay support if bumping is not
> practical).

This means no overlay dtb file generation until 'official' support (do not know if
the patches where ever suggested upstream)?

> 
> It would be very unmaintainable to bundle overlay support in Buildroot,
> if upstream eventually decide to not support them, or decide to support
> them in a very different way. We can not afford this, I'm afraid.
> 

If this happens the 'patch' support could be dropped easily...

> In the meantime, and that's unfortunate, we won't support overlays in
> dtc... :-(
>

Though people have to find the right patches again and again...

But I understand the point that patch care in buildroot is not easy...

Regards,
Peter

> Regards,
> Yann E. MORIN.
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v3 5/7] dtc: add host build
  2015-01-18 16:51   ` Yann E. MORIN
@ 2015-01-18 21:52     ` Peter Seiderer
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Seiderer @ 2015-01-18 21:52 UTC (permalink / raw)
  To: buildroot

Hello Yann,

> Gesendet: Sonntag, 18. Januar 2015 um 17:51 Uhr
> Von: "Yann E. MORIN" <yann.morin.1998@free.fr>
> An: "Peter Seiderer" <ps.report@gmx.net>
> Cc: buildroot at busybox.net, "Fabio Porcedda" <fabio.porcedda@gmail.com>, "Jeremy Kerr" <jk@ozlabs.org>, "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>, "Matthew Weber" <matthew.weber@rockwellcollins.com>
> Betreff: Re: [PATCH v3 5/7] dtc: add host build
>
> Peter, All,
> 
> On 2015-01-13 20:40 +0100, Peter Seiderer spake thusly:
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> [--SNIP--]
> > diff --git a/package/dtc/dtc.mk b/package/dtc/dtc.mk
> > index c01fe7b..b0e2f28 100644
> > --- a/package/dtc/dtc.mk
> > +++ b/package/dtc/dtc.mk
> > @@ -43,4 +43,14 @@ define DTC_INSTALL_TARGET_CMDS
> >  	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
> >  endef
> >  
> > +# host build
> > +define HOST_DTC_BUILD_CMDS
> > +	$(HOST_CONFIGURE_OPTS) $(MAKE) -C $(@D) PREFIX=/usr
> 
> This is a host tool, you should set PREFIX=$(HOST_DIR)/usr  ...
> 

O.k. (was copy/paste from the target build command), will fix on next
patch iteration...

> > +endef
> > +
> > +define HOST_DTC_INSTALL_CMDS
> > +	$(MAKE) -C $(@D) DESTDIR=$(HOST_DIR) PREFIX=/usr install-bin
> 
> ... ditto, and not set a DESTDIR.
>

O.k, will fix, thanks for review...

Regards,
Peter
 
> Regards,
> Yann E. MORIN.
> 
> > +endef
> > +
> >  $(eval $(generic-package))
> > +$(eval $(host-generic-package))
> > -- 
> > 2.1.2
> > 
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-01-18 21:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-13 19:40 [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 1/7] dtc: fix project and download url Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 2/7] dtc: rename patches to new convention Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 3/7] dtc: bump version to 1.4.1 Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 4/7] dtc: add hash Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 5/7] dtc: add host build Peter Seiderer
2015-01-18 16:51   ` Yann E. MORIN
2015-01-18 21:52     ` Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 6/7] dtc: add patches for raspberry pi overlay support Peter Seiderer
2015-01-13 19:40 ` [Buildroot] [PATCH v3 7/7] linux: install dtc only in case package host dtc is not selected Peter Seiderer
2015-01-14 19:49 ` [Buildroot] [PATCH v3 0/7] dtc: update and add raspberry pi overlay support Thomas Petazzoni
2015-01-18 16:49 ` Yann E. MORIN
2015-01-18 21:50   ` Peter Seiderer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox