summaryrefslogtreecommitdiff
path: root/scripts/Makefile.spl
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-04 11:58:10 -0600
committerSimon Glass <sjg@chromium.org>2016-07-14 20:40:24 -0600
commitdbbe2e6401fc8539f456cab7ef1dd38f9495591d (patch)
tree4c9a6f88ab086ee49aa05ae5113d624be6b8a32d /scripts/Makefile.spl
parent69f2ed7746c8944b2865c3838c36d97908305586 (diff)
dm: Makefile: Build of-platdata files when the feature is enabled
Update the Makefile to call dtoc to create the C header and source files, then build these into the image. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts/Makefile.spl')
-rw-r--r--scripts/Makefile.spl39
1 files changed, 36 insertions, 3 deletions
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 2b5c9954d3..324b03fb22 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -45,6 +45,7 @@ LDFLAGS_FINAL += --gc-sections
# FIX ME
cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
$(NOSTDINC_FLAGS)
+c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
@@ -76,6 +77,9 @@ endif
u-boot-spl-init := $(head-y)
u-boot-spl-main := $(libs-y)
+ifdef CONFIG_SPL_OF_PLATDATA
+u-boot-spl-platdata := $(obj)/dts/dt-platdata.o
+endif
# Linker Script
ifdef CONFIG_SPL_LDSCRIPT
@@ -207,6 +211,32 @@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
$(obj)/$(SPL_BIN).cfg: include/config.h FORCE
$(call if_changed,cpp_cfg)
+pythonpath = PYTHONPATH=tools
+
+quiet_cmd_dtocc = DTOC C $@
+cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata
+
+quiet_cmd_dtoch = DTOC H $@
+cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct
+
+quiet_cmd_plat = PLAT $@
+cmd_plat = $(CC) $(c_flags) -c $< -o $@
+
+$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c include/generated/dt-structs.h
+ $(call if_changed,plat)
+
+PHONY += dts_dir
+dts_dir:
+ $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
+
+include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc
+ $(call if_changed,dtoch)
+
+$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc
+ $(call if_changed,dtocc)
+
+dtoc: #$(objtree)/tools/_libfdt.so
+
ifdef CONFIG_SAMSUNG
ifdef CONFIG_VAR_SIZE_SPL
VAR_SIZE_PARAM = --vs
@@ -246,16 +276,19 @@ $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
quiet_cmd_u-boot-spl ?= LD $@
cmd_u-boot-spl ?= (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
$(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \
- $(patsubst $(obj)/%,%,$(u-boot-spl-main)) --end-group \
+ $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
+ $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \
+ --end-group \
$(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN))
-$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE
+$(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \
+ $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE
$(call if_changed,u-boot-spl)
$(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ;
PHONY += $(u-boot-spl-dirs)
-$(u-boot-spl-dirs):
+$(u-boot-spl-dirs): $(u-boot-spl-platdata)
$(Q)$(MAKE) $(build)=$@
quiet_cmd_cpp_lds = LDS $@