diff options
-rw-r--r-- | firmware/Makefile | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/firmware/Makefile b/firmware/Makefile index 9fe86041f86e..da75a6fbc6ba 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -146,15 +146,27 @@ $(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/% | |||
146 | $(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %) | 146 | $(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %) |
147 | $(call cmd,ihex) | 147 | $(call cmd,ihex) |
148 | 148 | ||
149 | # Don't depend on ihex2fw if we're installing and it already exists. | ||
150 | # Putting it after | in the dependencies doesn't seem sufficient when | ||
151 | # we're installing after a cross-compile, because ihex2fw has dependencies | ||
152 | # on stuff like /usr/lib/gcc/ppc64-redhat-linux/4.3.0/include/stddef.h and | ||
153 | # thus wants to be rebuilt. Which it can't be, if the prebuilt kernel tree | ||
154 | # is exported read-only for someone to run 'make install'. | ||
155 | ifeq ($(INSTALL):$(wildcard $(obj)/ihex2fw),install:$(obj)/ihex2fw) | ||
156 | ihex2fw_dep := | ||
157 | else | ||
158 | ihex2fw_dep := $(obj)/ihex2fw | ||
159 | endif | ||
160 | |||
149 | # .HEX is also Intel HEX, but where the offset and length in each record | 161 | # .HEX is also Intel HEX, but where the offset and length in each record |
150 | # is actually meaningful, because the firmware has to be loaded in a certain | 162 | # is actually meaningful, because the firmware has to be loaded in a certain |
151 | # order rather than as a single binary blob. Thus, we convert them into our | 163 | # order rather than as a single binary blob. Thus, we convert them into our |
152 | # more compact binary representation of ihex records (<linux/ihex.h>) | 164 | # more compact binary representation of ihex records (<linux/ihex.h>) |
153 | $(obj)/%.fw: $(obj)/%.HEX $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %) | 165 | $(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) |
154 | $(call cmd,ihex2fw) | 166 | $(call cmd,ihex2fw) |
155 | 167 | ||
156 | # .H16 is our own modified form of Intel HEX, with 16-bit length for records. | 168 | # .H16 is our own modified form of Intel HEX, with 16-bit length for records. |
157 | $(obj)/%.fw: $(obj)/%.H16 $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %) | 169 | $(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) |
158 | $(call cmd,h16tofw) | 170 | $(call cmd,h16tofw) |
159 | 171 | ||
160 | $(firmware-dirs): | 172 | $(firmware-dirs): |