summaryrefslogtreecommitdiffstats
path: root/firmware/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/Makefile')
-rw-r--r--firmware/Makefile14
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/Makefile b/firmware/Makefile
index 3742fee..9e780a3 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -32,6 +32,9 @@ quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
quiet_cmd_ihex = IHEX $@
cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
+quiet_cmd_ihex2fw = IHEX2FW $@
+ cmd_ihex2fw = $(objtree)/$(obj)/ihex2fw $< $@
+
quiet_cmd_fwbin = MK_FW $@
cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \
FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \
@@ -84,9 +87,18 @@ $(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
$(patsubst %,$(obj)/%.gen.o, $(fw-shipped-y)): %.gen.o: %
$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
+# .ihex is used just as a simple way to hold binary files in a source tree
+# where binaries are frowned upon. They are directly converted with objcopy.
$(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %)
$(call cmd,ihex)
+# .HEX is also Intel HEX, but where the offset and length in each record
+# is actually meaningful, because the firmware has to be loaded in a certain
+# order rather than as a single binary blob. Thus, we convert them into our
+# more compact binary representation of ihex records (<linux/ihex.h>)
+$(obj)/%.fw: $(obj)/%.HEX $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %)
+ $(call cmd,ihex2fw)
+
$(firmware-dirs):
$(call cmd,mkdir)
@@ -101,3 +113,5 @@ targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \
# Without this, built-in.o won't be created when it's empty, and the
# final vmlinux link will fail.
obj-n := dummy
+
+hostprogs-y := ihex2fw
OpenPOWER on IntegriCloud