summaryrefslogtreecommitdiffstats
path: root/package/dtc
diff options
context:
space:
mode:
Diffstat (limited to 'package/dtc')
-rw-r--r--package/dtc/Config.in33
-rw-r--r--package/dtc/dtc-extra_cflags.patch28
-rw-r--r--package/dtc/dtc-separate-lib-install.patch28
-rw-r--r--package/dtc/dtc.mk56
4 files changed, 145 insertions, 0 deletions
diff --git a/package/dtc/Config.in b/package/dtc/Config.in
new file mode 100644
index 000000000..fac6ab2ea
--- /dev/null
+++ b/package/dtc/Config.in
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_DTC
+ bool "dtc (libfdt)"
+ help
+ The Device Tree Compiler, dtc, takes as input a device-tree in
+ a given format and outputs a device-tree in another format.
+
+ 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)
+
+if BR2_PACKAGE_DTC
+
+config BR2_PACKAGE_DTC_PROGRAMS
+ bool "dtc programs"
+ help
+ Say 'y' here if you also want the programs on the target:
+ - convert-dtsv0 convert from version 0 to version 1
+ - dtc the device tree compiler
+ - dtdiff compare two device trees (needs bash)
+ - fdtdump print a readable version of a flat device tree
+ - fdtget read values from device tree
+ - fdtput write a property value to a device tree
+
+ Note: dtdiff requires bash, so if bash is not selected, dtdiff will
+ be removed from the target file system. Enable bash if you
+ need dtdiff on the target.
+
+comment "dtdiff will not be installed: it requires bash"
+ depends on BR2_PACKAGE_DTC_PROGRAMS
+ depends on !BR2_PACKAGE_BASH
+
+endif
diff --git a/package/dtc/dtc-extra_cflags.patch b/package/dtc/dtc-extra_cflags.patch
new file mode 100644
index 000000000..3ce699b5d
--- /dev/null
+++ b/package/dtc/dtc-extra_cflags.patch
@@ -0,0 +1,28 @@
+Makefile: append the CFLAGS to existing ones
+
+Allow the user to pass custom CFLAGS (eg. optimisation flags).
+
+Do not use EXTRA_CFLAGS, append to existing CFLAGS with += (Arnout)
+
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Cc: Arnout Vandecappelle <arnout@mind.be>
+
+---
+Patch not sent upstream.
+
+Although not specific to buildroot, I am not sure this is the best
+way to handle user-supplied CFLAGS.
+
+diff -durN dtc-e4b497f367a3b2ae99cc52089a14a221b13a76ef.orig/Makefile dtc-e4b497f367a3b2ae99cc52089a14a221b13a76ef/Makefile
+--- dtc-e4b497f367a3b2ae99cc52089a14a221b13a76ef.orig/Makefile 2012-10-22 22:02:47.541240846 +0200
++++ dtc-e4b497f367a3b2ae99cc52089a14a221b13a76ef/Makefile 2012-10-22 22:03:21.151047833 +0200
+@@ -18,7 +18,8 @@
+ CPPFLAGS = -I libfdt -I .
+ WARNINGS = -Werror -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
+ -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls
+-CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
++CFLAGS ?= -g -Os
++CFLAGS += -fPIC $(WARNINGS)
+
+ BISON = bison
+ LEX = flex
diff --git a/package/dtc/dtc-separate-lib-install.patch b/package/dtc/dtc-separate-lib-install.patch
new file mode 100644
index 000000000..c86d587a1
--- /dev/null
+++ b/package/dtc/dtc-separate-lib-install.patch
@@ -0,0 +1,28 @@
+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/dtc.mk b/package/dtc/dtc.mk
new file mode 100644
index 000000000..76ff3617c
--- /dev/null
+++ b/package/dtc/dtc.mk
@@ -0,0 +1,56 @@
+#############################################################
+#
+# dtc
+#
+#############################################################
+
+DTC_VERSION = e4b497f367a3b2ae99cc52089a14a221b13a76ef
+DTC_SITE = git://git.jdl.com/software/dtc.git
+DTC_LICENSE = GPLv2+/BSD-2c
+DTC_LICENSE_FILES = README.license GPL
+DTC_INSTALL_STAGING = YES
+
+define DTC_POST_INSTALL_TARGET_RM_DTDIFF
+ rm -f $(TARGET_DIR)/usr/bin/dtdiff
+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
+DTC_CLEAN_GOAL = clean
+ifeq ($(BR2_PACKAGE_BASH),)
+DTC_POST_INSTALL_TARGET_HOOKS += DTC_POST_INSTALL_TARGET_RM_DTDIFF
+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_CLEAN_GOAL = libfdt_clean
+
+endif # $(BR2_PACKAGE_DTC_PROGRAMS) != y
+
+define DTC_BUILD_CMDS
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ $(MAKE) -C $(@D) PREFIX=/usr $(DTC_BUILD_GOAL)
+endef
+
+# For staging, only the library is needed
+define DTC_INSTALL_STAGING_CMDS
+ $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr libfdt_install
+endef
+
+define DTC_INSTALL_TARGET_CMDS
+ $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
+endef
+
+define DTC_CLEAN_CMDS
+ $(MAKE) -C $(@D) $(DTC_CLEAN_GOAL)
+endef
+
+$(eval $(generic-package))