dtc: add host build
authorPeter Seiderer <ps.report@gmx.net>
Sat, 3 Oct 2015 19:44:12 +0000 (20:44 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 4 Oct 2015 18:17:35 +0000 (20:17 +0200)
Having a host variant of dtc is needed for example for U-Boot, which
uses the Device Tree for a number of platforms.

In addition, now that we have a proper host-dtc package, it is no
longer needed for the linux package to install the host dtc compiler:
users interested in having the host dtc compiler can simply enable
this package.

A Config.in.host option is added to build host-dtc, because the
initial reason why the host DTC built by the kernel was installed in
$(HOST_DIR)/usr/bin (commit 707d44d0a28906ebda49584dd5f55985406f0bde
from Thomas DS) was:

    Having dtc as a host tool can be useful for users that have a
    custom boot scenario where the device tree is not embedded in the
    kernel.

[Thomas:
  - rework the commit log.]
[Peter: keep the (renamed) linux version]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/Config.in.host
package/dtc/Config.in.host [new file with mode: 0644]
package/dtc/dtc.mk

index 1e047aadfd9332245c14ddd01f5850aa8fd20563..1f69687b30ac6eee0d5409a2447a890769dd37be 100644 (file)
@@ -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/faketime/Config.in.host"
diff --git a/package/dtc/Config.in.host b/package/dtc/Config.in.host
new file mode 100644 (file)
index 0000000..cbabf0a
--- /dev/null
@@ -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
index e094f7bf782fbca9ceeb689c8e1e18c919de8b02..f3b6f3b543fcf5537081da9a3147c74ca5d7ce3b 100644 (file)
@@ -44,4 +44,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=$(HOST_DIR)/usr
+endef
+
+define HOST_DTC_INSTALL_CMDS
+       $(MAKE) -C $(@D) PREFIX=$(HOST_DIR)/usr install-bin
+endef
+
 $(eval $(generic-package))
+$(eval $(host-generic-package))