aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-13 00:23:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-13 00:23:38 -0400
commit1700ff823b27b6572cf4c3cec66d279baa1a5d30 (patch)
tree74542164e5df783004f90fa972837294729a324d /firmware
parent8841c8b3c4c4d9a9f2a6d30b463ad8d2c6e2f0ea (diff)
parent699c659b49b5c7cf601fe454683841df16495c3e (diff)
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek: "Kbuild changes for v3.16-rc1: - cross-compilation fix so that cc-option is testing the right compiler - Fix for make defconfig all - Using relative paths to the object and source directory where possible, plus fixes for the fallout of the change - several cleanups in the Makefiles and scripts The powerpc fix is from today, because it was only discovered recently. The rest has been in linux-next for some time" * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: powerpc: Avoid circular dependency with zImage.% kbuild: create include/config directory in scripts/kconfig/Makefile kbuild: do not create include/linux directory Makefile: Fix unrecognized cross-compiler command line options kbuild: do not add "selinux" to subdir- twice um: Fix for relative objtree when generating x86 headers kbuild: Use relative path when building in a subdir of the source tree kbuild: Use relative path when building in the source tree kbuild: Use relative path for $(objtree) firmware: Use $(quote) in the Makefile firmware: Simplify directory creation kbuild: trivial - fix comment block indent kbuild: trivial - remove trailing spaces kbuild: support simultaneous "make %config" and "make all" kbuild: move extra gcc checks to scripts/Makefile.extrawarn
Diffstat (limited to 'firmware')
-rw-r--r--firmware/Makefile34
1 files changed, 7 insertions, 27 deletions
diff --git a/firmware/Makefile b/firmware/Makefile
index cbb09ce9730a..5747417069ca 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -4,10 +4,10 @@
4 4
5# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a 5# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
6# leading /, it's relative to $(srctree). 6# leading /, it's relative to $(srctree).
7fwdir := $(subst ",,$(CONFIG_EXTRA_FIRMWARE_DIR)) 7fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR))
8fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) 8fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
9 9
10fw-external-y := $(subst ",,$(CONFIG_EXTRA_FIRMWARE)) 10fw-external-y := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))
11 11
12# There are three cases to care about: 12# There are three cases to care about:
13# 1. Building kernel with CONFIG_FIRMWARE_IN_KERNEL=y -- $(fw-shipped-y) should 13# 1. Building kernel with CONFIG_FIRMWARE_IN_KERNEL=y -- $(fw-shipped-y) should
@@ -138,12 +138,6 @@ fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin
138 138
139fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-) 139fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
140 140
141# Directories which we _might_ need to create, so we have a rule for them.
142firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
143
144quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
145 cmd_mkdir = mkdir -p $@
146
147quiet_cmd_ihex = IHEX $@ 141quiet_cmd_ihex = IHEX $@
148 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@ 142 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
149 143
@@ -184,21 +178,10 @@ wordsize_deps := $(wildcard include/config/64bit.h include/config/32bit.h \
184 include/config/superh32.h include/config/superh64.h \ 178 include/config/superh32.h include/config/superh64.h \
185 include/config/x86_32.h include/config/x86_64.h) 179 include/config/x86_32.h include/config/x86_64.h)
186 180
187# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. 181$(patsubst %,$(obj)/%.gen.S, $(fw-shipped-y)): %: $(wordsize_deps)
188# It'll end up depending on these targets, so make them a PHONY rule which
189# depends on _all_ the directories in $(firmware-dirs), and it'll work out OK.
190PHONY += $(objtree)/$$(%) $(objtree)/$(obj)/$$(%)
191$(objtree)/$$(%) $(objtree)/$(obj)/$$(%): $(firmware-dirs)
192 @true
193
194# For the $$(dir %) trick, where we need % to be expanded first.
195.SECONDEXPANSION:
196
197$(patsubst %,$(obj)/%.gen.S, $(fw-shipped-y)): %: $(wordsize_deps) \
198 | $(objtree)/$$(dir %)
199 $(call cmd,fwbin,$(patsubst %.gen.S,%,$@)) 182 $(call cmd,fwbin,$(patsubst %.gen.S,%,$@))
200$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \ 183$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
201 include/config/extra/firmware/dir.h | $(objtree)/$$(dir %) 184 include/config/extra/firmware/dir.h
202 $(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@)) 185 $(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@))
203 186
204# The .o files depend on the binaries directly; the .S files don't. 187# The .o files depend on the binaries directly; the .S files don't.
@@ -207,7 +190,7 @@ $(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
207 190
208# .ihex is used just as a simple way to hold binary files in a source tree 191# .ihex is used just as a simple way to hold binary files in a source tree
209# where binaries are frowned upon. They are directly converted with objcopy. 192# where binaries are frowned upon. They are directly converted with objcopy.
210$(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %) 193$(obj)/%: $(obj)/%.ihex
211 $(call cmd,ihex) 194 $(call cmd,ihex)
212 195
213# Don't depend on ihex2fw if we're installing and it already exists. 196# Don't depend on ihex2fw if we're installing and it already exists.
@@ -226,16 +209,13 @@ endif
226# is actually meaningful, because the firmware has to be loaded in a certain 209# is actually meaningful, because the firmware has to be loaded in a certain
227# order rather than as a single binary blob. Thus, we convert them into our 210# order rather than as a single binary blob. Thus, we convert them into our
228# more compact binary representation of ihex records (<linux/ihex.h>) 211# more compact binary representation of ihex records (<linux/ihex.h>)
229$(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) 212$(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep)
230 $(call cmd,ihex2fw) 213 $(call cmd,ihex2fw)
231 214
232# .H16 is our own modified form of Intel HEX, with 16-bit length for records. 215# .H16 is our own modified form of Intel HEX, with 16-bit length for records.
233$(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %) 216$(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep)
234 $(call cmd,h16tofw) 217 $(call cmd,h16tofw)
235 218
236$(firmware-dirs):
237 $(call cmd,mkdir)
238
239obj-y += $(patsubst %,%.gen.o, $(fw-external-y)) 219obj-y += $(patsubst %,%.gen.o, $(fw-external-y))
240obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y)) 220obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y))
241 221