diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-05-31 08:07:18 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-10 09:47:41 -0400 |
commit | 8bd6b2229bf98761465020467ec33547d05bff46 (patch) | |
tree | 7254aa39f6cede847ec67377f17cf58a04f02c7e /firmware/Makefile | |
parent | f1485f3deb89e6ae10c4d34662ec9e692855ab5d (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/Makefile | 14 |
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)/%,%,$@) | |||
32 | quiet_cmd_ihex = IHEX $@ | 32 | quiet_cmd_ihex = IHEX $@ |
33 | cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@ | 33 | cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@ |
34 | 34 | ||
35 | quiet_cmd_ihex2fw = IHEX2FW $@ | ||
36 | cmd_ihex2fw = $(objtree)/$(obj)/ihex2fw $< $@ | ||
37 | |||
35 | quiet_cmd_fwbin = MK_FW $@ | 38 | quiet_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. |
103 | obj-n := dummy | 115 | obj-n := dummy |
116 | |||
117 | hostprogs-y := ihex2fw | ||