summaryrefslogtreecommitdiff
path: root/firmware/Makefile
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-05-31 15:07:18 +0300
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-10 14:47:41 +0100
commit8bd6b2229bf98761465020467ec33547d05bff46 (patch)
tree7254aa39f6cede847ec67377f17cf58a04f02c7e /firmware/Makefile
parentf1485f3deb89e6ae10c4d34662ec9e692855ab5d (diff)
downloadlwn-8bd6b2229bf98761465020467ec33547d05bff46.tar.gz
lwn-8bd6b2229bf98761465020467ec33547d05bff46.zip
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)/%,%,$@)
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