aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--docs/firmware/fw_payload.md8
-rw-r--r--firmware/external_deps.mk1
-rw-r--r--firmware/objects.mk5
4 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 11e1634..6ff0b2c 100644
--- a/Makefile
+++ b/Makefile
@@ -79,6 +79,7 @@ include $(firmware-object-mks)
lib-objs-path-y=$(foreach obj,$(lib-objs-y),$(build_dir)/lib/$(obj))
ifdef PLATFORM
platform-objs-path-y=$(foreach obj,$(platform-objs-y),$(build_dir)/$(platform_subdir)/$(obj))
+platform-dtb-path-y=$(foreach obj,$(platform-dtb-y),$(build_dir)/$(platform_subdir)/$(obj))
platform-common-objs-path-y=$(foreach obj,$(platform-common-objs-y),$(build_dir)/platform/common/$(obj))
firmware-bins-path-y=$(foreach bin,$(firmware-bins-y),$(build_dir)/$(platform_subdir)/firmware/$(bin))
endif
@@ -154,6 +155,9 @@ else
OBJCOPY ?= objcopy
endif
+DTC = dtc
+DTCFLAGS = -O dtb
+
# Setup functions for compilation
define dynamic_flags
-I$(shell dirname $(2)) -D__OBJNAME__=$(subst -,_,$(shell basename $(1) .o))
@@ -212,10 +216,14 @@ compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
compile_objcopy = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
echo " OBJCOPY $(subst $(build_dir)/,,$(1))"; \
$(OBJCOPY) -S -O binary $(2) $(1)
+compile_dts = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
+ echo " DTC $(subst $(build_dir)/,,$(1))"; \
+ $(DTC) $(DTCFLAGS) -o $(1) $(2)
targets-y = $(build_dir)/lib/libsbi.a
ifdef PLATFORM
targets-y += $(build_dir)/$(platform_subdir)/lib/libplatsbi.a
+targets-y += $(platform-dtb-path-y)
endif
targets-y += $(firmware-bins-path-y)
@@ -265,6 +273,9 @@ $(build_dir)/$(platform_subdir)/%.dep: $(src_dir)/%.S
$(build_dir)/$(platform_subdir)/%.o: $(src_dir)/%.S
$(call compile_as,$@,$<)
+$(build_dir)/%.dtb: $(src_dir)/%.dts
+ $(call compile_dts,$@,$<)
+
# Rule for "make docs"
$(build_dir)/docs/latex/refman.pdf: $(build_dir)/docs/latex/refman.tex
$(CMD_PREFIX)mkdir -p $(build_dir)/docs
diff --git a/docs/firmware/fw_payload.md b/docs/firmware/fw_payload.md
index 0e705a2..3a8a14d 100644
--- a/docs/firmware/fw_payload.md
+++ b/docs/firmware/fw_payload.md
@@ -57,6 +57,14 @@ device tree file is specified by the platform (c.f. *FW_PAYLOAD_FDT*),
then the firmware will expect the FDT to be passed as an argument by
the prior booting stage.
+* **FW_PAYLOAD_FDT** - Path to an internal flattened device tree
+binary file defined by the platform code. The file name must match the
+DTB file name specified in the platform *objects.mk* file with the
+*platform-dtb-y* entry. This option results in *FW_PAYLOAD_FDT_PATH* to
+be automatically set. Specifying *FW_PAYLOAD_FDT_PATH* on the `make`
+command line disables *FW_PAYLOAD_FDT* and the command line specified
+device tree binary file is used for building the final firmware.
+
* **FW_PAYLOAD_FDT_ADDR** - Address where the FDT passed by the prior
booting stage or specified by the *FW_PAYLOAD_FDT_PATH* parameter and
embedded in the *.text* section will be placed before executing the
diff --git a/firmware/external_deps.mk b/firmware/external_deps.mk
index 3a0847e..c2e9e90 100644
--- a/firmware/external_deps.mk
+++ b/firmware/external_deps.mk
@@ -8,3 +8,4 @@
#
$(build_dir)/$(platform_subdir)/firmware/fw_payload.o: $(FW_PAYLOAD_PATH_FINAL)
+$(build_dir)/$(platform_subdir)/firmware/fw_payload.o: $(FW_PAYLOAD_FDT_PATH)
diff --git a/firmware/objects.mk b/firmware/objects.mk
index b579ba6..1c7cc69 100644
--- a/firmware/objects.mk
+++ b/firmware/objects.mk
@@ -39,6 +39,11 @@ ifdef FW_PAYLOAD_ALIGN
firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_ALIGN=$(FW_PAYLOAD_ALIGN)
endif
+ifndef FW_PAYLOAD_FDT_PATH
+ifdef FW_PAYLOAD_FDT
+FW_PAYLOAD_FDT_PATH=$(build_dir)/$(platform_subdir)/$(FW_PAYLOAD_FDT)
+endif
+endif
ifdef FW_PAYLOAD_FDT_PATH
firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_FDT_PATH=$(FW_PAYLOAD_FDT_PATH)
endif