aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/Makefile
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-05-31 08:07:18 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-10 09:47:41 -0400
commit8bd6b2229bf98761465020467ec33547d05bff46 (patch)
tree7254aa39f6cede847ec67377f17cf58a04f02c7e /firmware/Makefile
parentf1485f3deb89e6ae10c4d34662ec9e692855ab5d (diff)
ihex: add ihex2fw tool for converting HEX files into firmware images
Not the straight conversion to binary which objcopy can do for us, but actually representing each record with its original {addr, length}, because some drivers need that information preserved. Fix up 'firmware_install' to be able to build $(hostprogs-y) too. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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 3742feeb066f..9e780a331e10 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -32,6 +32,9 @@ quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
32quiet_cmd_ihex = IHEX $@ 32quiet_cmd_ihex = IHEX $@
33 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@ 33 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
34 34
35quiet_cmd_ihex2fw = IHEX2FW $@
36 cmd_ihex2fw = $(objtree)/$(obj)/ihex2fw $< $@
37
35quiet_cmd_fwbin = MK_FW $@ 38quiet_cmd_fwbin = MK_FW $@
36 cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \ 39 cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \
37 FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \ 40 FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \
@@ -84,9 +87,18 @@ $(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
84$(patsubst %,$(obj)/%.gen.o, $(fw-shipped-y)): %.gen.o: % 87$(patsubst %,$(obj)/%.gen.o, $(fw-shipped-y)): %.gen.o: %
85$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/% 88$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
86 89
90# .ihex is used just as a simple way to hold binary files in a source tree
91# where binaries are frowned upon. They are directly converted with objcopy.
87$(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %) 92$(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %)
88 $(call cmd,ihex) 93 $(call cmd,ihex)
89 94
95# .HEX is also Intel HEX, but where the offset and length in each record
96# is actually meaningful, because the firmware has to be loaded in a certain
97# order rather than as a single binary blob. Thus, we convert them into our
98# more compact binary representation of ihex records (<linux/ihex.h>)
99$(obj)/%.fw: $(obj)/%.HEX $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %)
100 $(call cmd,ihex2fw)
101
90$(firmware-dirs): 102$(firmware-dirs):
91 $(call cmd,mkdir) 103 $(call cmd,mkdir)
92 104
@@ -101,3 +113,5 @@ targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \
101# Without this, built-in.o won't be created when it's empty, and the 113# Without this, built-in.o won't be created when it's empty, and the
102# final vmlinux link will fail. 114# final vmlinux link will fail.
103obj-n := dummy 115obj-n := dummy
116
117hostprogs-y := ihex2fw