summaryrefslogtreecommitdiff
path: root/include/image.mk
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-07-16 11:12:52 +0000
committerJonas Gorski <jogo@openwrt.org>2015-07-16 11:12:52 +0000
commite7b5dd0e1dd5eacd13bee7bc5da2eeea8882e668 (patch)
tree7f7e9009fc616c2818777e5f10b70e67ac1e3b16 /include/image.mk
parent491cfb06d0d2c32178d97adc0f84536a385af22d (diff)
downloadmtk-20170518-e7b5dd0e1dd5eacd13bee7bc5da2eeea8882e668.zip
mtk-20170518-e7b5dd0e1dd5eacd13bee7bc5da2eeea8882e668.tar.gz
mtk-20170518-e7b5dd0e1dd5eacd13bee7bc5da2eeea8882e668.tar.bz2
image.mk: add a BuildDTB define
Add a Image/BuildDTB command that takes the path to an dts file and applies the CPP using the default include directories, then uses dtc to compile the dts as the specified output file. Additional CPP and DTC flags can be supplied as additional arguments. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 46389
Diffstat (limited to 'include/image.mk')
-rw-r--r--include/image.mk16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/image.mk b/include/image.mk
index 6767e76..a20e090 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -126,6 +126,22 @@ define Image/BuildKernel/MkFIT
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb
endef
+# $(1) source dts file
+# $(2) target dtb file
+# $(3) extra CPP flags
+# $(4) extra DTC flags
+define Image/BuildDTB
+ $(CPP) -nostdinc -x assembler-with-cpp \
+ -I$(LINUX_DIR)/arch/$(ARCH)/boot/dts \
+ -I$(LINUX_DIR)/arch/$(ARCH)/boot/dts/include \
+ -undef -D__DTS__ $(3) \
+ -o $(2).tmp $(1)
+ $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
+ -i$(dir $(1)) $(4) \
+ -o $(2) $(2).tmp
+ $(RM) $(2).tmp
+endef
+
define Image/mkfs/jffs2/sub
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 $(3) --pad -e $(patsubst %k,%KiB,$(1)) -o $(KDIR)/root.jffs2-$(2) -d $(TARGET_DIR) -v 2>&1 1>/dev/null | awk '/^.+$$$$/'
$(call add_jffs2_mark,$(KDIR)/root.jffs2-$(2))