diff options
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 | ||