From 8bd6b2229bf98761465020467ec33547d05bff46 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 31 May 2008 15:07:18 +0300 Subject: 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 --- firmware/Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'firmware/Makefile') diff --git a/firmware/Makefile b/firmware/Makefile index 3742feeb066..9e780a331e1 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 () +$(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 -- cgit v1.2.3