Commit ffe29ebc070104b529abcdc589eb87f3e5d85fa4
Committed by
Tom Rini
1 parent
cb6e7b0db9
Exists in
v2017.01-smarct4x
and in
37 other branches
kbuild: sync top Makefile with Linux 3.18-rc1
Since Linux 3.15, relative path feature and related fixes, cleanups have been merged to the top Makefile. The relative path feature looks stable enough, so let's import it to U-Boot along with various cleanups. Commits imported from Linux (some need adjustment) are: [1] commit 7e1c04779efd by Michal Marek kbuild: Use relative path for $(objtree) [2] commit 890676c65d69 by Michal Marek kbuild: Use relative path when building in the source tree [3] commit 9da0763bdd82 by Michal Marek kbuild: Use relative path when building in a subdir of the source tree [4] commit c2e28dc975ea by Michal Marek kbuild: Print the name of the build directory [5] commit 066b7ed95580 by Michal Marek kbuild: Do not print the build directory with make -s [6] commit 3f1d9a6cec01 by Michal Marek kbuild: make -s should be used with kernelrelease/kernelversion/image_name [7] commit 7ff525712acf by Masahiro Yamada kbuild: fake the "Entering directory ..." message more simply [8] commit 745a254322c8 by Masahiro Yamada kbuild: use $(Q) for sub-make target [9] commit aa55c8e2f7a3 by Masahiro Yamada kbuild: handle C=... and M=... after entering into build directory [10] commit ab7474ea5361 by Borislav Petkov Kbuild: Ignore GREP_OPTIONS env variable To use relative path feature, tools/Makefile and scripts/Makefile.autoconf must be tweaked. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Showing 3 changed files with 102 additions and 93 deletions Inline Diff
Makefile
1 | # | ||
2 | # (C) Copyright 2000-2013 | ||
3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
4 | # | ||
5 | # SPDX-License-Identifier: GPL-2.0+ | ||
6 | # | ||
7 | |||
8 | VERSION = 2014 | 1 | VERSION = 2014 |
9 | PATCHLEVEL = 10 | 2 | PATCHLEVEL = 10 |
10 | SUBLEVEL = | 3 | SUBLEVEL = |
11 | EXTRAVERSION = | 4 | EXTRAVERSION = |
12 | NAME = | 5 | NAME = |
13 | 6 | ||
14 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
15 | # To see a list of typical targets execute "make help" | 8 | # To see a list of typical targets execute "make help" |
16 | # More info can be located in ./README | 9 | # More info can be located in ./README |
17 | # Comments in this file are targeted only to the developer, do not | 10 | # Comments in this file are targeted only to the developer, do not |
18 | # expect to learn how to build the kernel reading this file. | 11 | # expect to learn how to build the kernel reading this file. |
19 | 12 | ||
20 | # Do not: | 13 | # Do not use make's built-in rules and variables |
21 | # o use make's built-in rules and variables | 14 | # (this increases performance and avoids hard-to-debug behaviour); |
22 | # (this increases performance and avoids hard-to-debug behaviour); | 15 | MAKEFLAGS += -rR |
23 | # o print "Entering directory ..."; | ||
24 | MAKEFLAGS += -rR --no-print-directory | ||
25 | 16 | ||
26 | # Avoid funny character set dependencies | 17 | # Avoid funny character set dependencies |
27 | unexport LC_ALL | 18 | unexport LC_ALL |
28 | LC_COLLATE=C | 19 | LC_COLLATE=C |
29 | LC_NUMERIC=C | 20 | LC_NUMERIC=C |
30 | export LC_COLLATE LC_NUMERIC | 21 | export LC_COLLATE LC_NUMERIC |
31 | 22 | ||
23 | # Avoid interference with shell env settings | ||
24 | unexport GREP_OPTIONS | ||
25 | |||
32 | # We are using a recursive build, so we need to do a little thinking | 26 | # We are using a recursive build, so we need to do a little thinking |
33 | # to get the ordering right. | 27 | # to get the ordering right. |
34 | # | 28 | # |
35 | # Most importantly: sub-Makefiles should only ever modify files in | 29 | # Most importantly: sub-Makefiles should only ever modify files in |
36 | # their own directory. If in some directory we have a dependency on | 30 | # their own directory. If in some directory we have a dependency on |
37 | # a file in another dir (which doesn't happen often, but it's often | 31 | # a file in another dir (which doesn't happen often, but it's often |
38 | # unavoidable when linking the built-in.o targets which finally | 32 | # unavoidable when linking the built-in.o targets which finally |
39 | # turn into vmlinux), we will call a sub make in that other dir, and | 33 | # turn into vmlinux), we will call a sub make in that other dir, and |
40 | # after that we are sure that everything which is in that other dir | 34 | # after that we are sure that everything which is in that other dir |
41 | # is now up to date. | 35 | # is now up to date. |
42 | # | 36 | # |
43 | # The only cases where we need to modify files which have global | 37 | # The only cases where we need to modify files which have global |
44 | # effects are thus separated out and done before the recursive | 38 | # effects are thus separated out and done before the recursive |
45 | # descending is started. They are now explicitly listed as the | 39 | # descending is started. They are now explicitly listed as the |
46 | # prepare rule. | 40 | # prepare rule. |
47 | 41 | ||
42 | # Beautify output | ||
43 | # --------------------------------------------------------------------------- | ||
44 | # | ||
45 | # Normally, we echo the whole command before executing it. By making | ||
46 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | ||
47 | # $(quiet) to choose other forms of output instead, e.g. | ||
48 | # | ||
49 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | ||
50 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
51 | # | ||
52 | # If $(quiet) is empty, the whole command will be printed. | ||
53 | # If it is set to "quiet_", only the short version will be printed. | ||
54 | # If it is set to "silent_", nothing will be printed at all, since | ||
55 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | ||
56 | # | ||
57 | # A simple variant is to prefix commands with $(Q) - that's useful | ||
58 | # for commands that shall be hidden in non-verbose mode. | ||
59 | # | ||
60 | # $(Q)ln $@ :< | ||
61 | # | ||
62 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | ||
63 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | ||
64 | # | ||
48 | # To put more focus on warnings, be less verbose as default | 65 | # To put more focus on warnings, be less verbose as default |
49 | # Use 'make V=1' to see the full commands | 66 | # Use 'make V=1' to see the full commands |
50 | 67 | ||
51 | ifeq ("$(origin V)", "command line") | 68 | ifeq ("$(origin V)", "command line") |
52 | KBUILD_VERBOSE = $(V) | 69 | KBUILD_VERBOSE = $(V) |
53 | endif | 70 | endif |
54 | ifndef KBUILD_VERBOSE | 71 | ifndef KBUILD_VERBOSE |
55 | KBUILD_VERBOSE = 0 | 72 | KBUILD_VERBOSE = 0 |
56 | endif | 73 | endif |
57 | 74 | ||
58 | # Call a source code checker (by default, "sparse") as part of the | 75 | ifeq ($(KBUILD_VERBOSE),1) |
59 | # C compilation. | 76 | quiet = |
60 | # | 77 | Q = |
61 | # Use 'make C=1' to enable checking of only re-compiled files. | 78 | else |
62 | # Use 'make C=2' to enable checking of *all* source files, regardless | 79 | quiet=quiet_ |
63 | # of whether they are re-compiled or not. | 80 | Q = @ |
64 | # | 81 | endif |
65 | # See the file "Documentation/sparse.txt" for more details, including | ||
66 | # where to get the "sparse" utility. | ||
67 | 82 | ||
68 | ifeq ("$(origin C)", "command line") | 83 | # If the user is running make -s (silent mode), suppress echoing of |
69 | KBUILD_CHECKSRC = $(C) | 84 | # commands |
85 | |||
86 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 | ||
87 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) | ||
88 | quiet=silent_ | ||
70 | endif | 89 | endif |
71 | ifndef KBUILD_CHECKSRC | 90 | else # make-3.8x |
72 | KBUILD_CHECKSRC = 0 | 91 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) |
92 | quiet=silent_ | ||
73 | endif | 93 | endif |
74 | |||
75 | # Use make M=dir to specify directory of external module to build | ||
76 | # Old syntax make ... SUBDIRS=$PWD is still supported | ||
77 | # Setting the environment variable KBUILD_EXTMOD take precedence | ||
78 | ifdef SUBDIRS | ||
79 | KBUILD_EXTMOD ?= $(SUBDIRS) | ||
80 | endif | 94 | endif |
81 | 95 | ||
82 | ifeq ("$(origin M)", "command line") | 96 | export quiet Q KBUILD_VERBOSE |
83 | KBUILD_EXTMOD := $(M) | ||
84 | endif | ||
85 | 97 | ||
86 | # kbuild supports saving output files in a separate directory. | 98 | # kbuild supports saving output files in a separate directory. |
87 | # To locate output files in a separate directory two syntaxes are supported. | 99 | # To locate output files in a separate directory two syntaxes are supported. |
88 | # In both cases the working directory must be the root of the kernel src. | 100 | # In both cases the working directory must be the root of the kernel src. |
89 | # 1) O= | 101 | # 1) O= |
90 | # Use "make O=dir/to/store/output/files/" | 102 | # Use "make O=dir/to/store/output/files/" |
91 | # | 103 | # |
92 | # 2) Set KBUILD_OUTPUT | 104 | # 2) Set KBUILD_OUTPUT |
93 | # Set the environment variable KBUILD_OUTPUT to point to the directory | 105 | # Set the environment variable KBUILD_OUTPUT to point to the directory |
94 | # where the output files shall be placed. | 106 | # where the output files shall be placed. |
95 | # export KBUILD_OUTPUT=dir/to/store/output/files/ | 107 | # export KBUILD_OUTPUT=dir/to/store/output/files/ |
96 | # make | 108 | # make |
97 | # | 109 | # |
98 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment | 110 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment |
99 | # variable. | 111 | # variable. |
100 | 112 | ||
101 | |||
102 | # KBUILD_SRC is set on invocation of make in OBJ directory | 113 | # KBUILD_SRC is set on invocation of make in OBJ directory |
103 | # KBUILD_SRC is not intended to be used by the regular user (for now) | 114 | # KBUILD_SRC is not intended to be used by the regular user (for now) |
104 | ifeq ($(KBUILD_SRC),) | 115 | ifeq ($(KBUILD_SRC),) |
105 | 116 | ||
106 | # OK, Make called in directory where kernel src resides | 117 | # OK, Make called in directory where kernel src resides |
107 | # Do we want to locate output files in a separate directory? | 118 | # Do we want to locate output files in a separate directory? |
108 | ifeq ("$(origin O)", "command line") | 119 | ifeq ("$(origin O)", "command line") |
109 | KBUILD_OUTPUT := $(O) | 120 | KBUILD_OUTPUT := $(O) |
110 | endif | 121 | endif |
111 | 122 | ||
112 | # That's our default target when none is given on the command line | 123 | # That's our default target when none is given on the command line |
113 | PHONY := _all | 124 | PHONY := _all |
114 | _all: | 125 | _all: |
115 | 126 | ||
116 | # Cancel implicit rules on top Makefile | 127 | # Cancel implicit rules on top Makefile |
117 | $(CURDIR)/Makefile Makefile: ; | 128 | $(CURDIR)/Makefile Makefile: ; |
118 | 129 | ||
119 | ifneq ($(KBUILD_OUTPUT),) | 130 | ifneq ($(KBUILD_OUTPUT),) |
120 | # Invoke a second make in the output directory, passing relevant variables | 131 | # Invoke a second make in the output directory, passing relevant variables |
121 | # check that the output directory actually exists | 132 | # check that the output directory actually exists |
122 | saved-output := $(KBUILD_OUTPUT) | 133 | saved-output := $(KBUILD_OUTPUT) |
123 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ | 134 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ |
124 | && /bin/pwd) | 135 | && /bin/pwd) |
125 | $(if $(KBUILD_OUTPUT),, \ | 136 | $(if $(KBUILD_OUTPUT),, \ |
126 | $(error failed to create output directory "$(saved-output)")) | 137 | $(error failed to create output directory "$(saved-output)")) |
127 | 138 | ||
128 | PHONY += $(MAKECMDGOALS) sub-make | 139 | PHONY += $(MAKECMDGOALS) sub-make |
129 | 140 | ||
130 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make | 141 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make |
131 | @: | 142 | @: |
132 | 143 | ||
133 | sub-make: FORCE | 144 | sub-make: FORCE |
134 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | 145 | $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ |
135 | KBUILD_SRC=$(CURDIR) \ | 146 | -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) |
136 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ | ||
137 | $(filter-out _all sub-make,$(MAKECMDGOALS)) | ||
138 | 147 | ||
139 | # Leave processing to above invocation of make | 148 | # Leave processing to above invocation of make |
140 | skip-makefile := 1 | 149 | skip-makefile := 1 |
141 | endif # ifneq ($(KBUILD_OUTPUT),) | 150 | endif # ifneq ($(KBUILD_OUTPUT),) |
142 | endif # ifeq ($(KBUILD_SRC),) | 151 | endif # ifeq ($(KBUILD_SRC),) |
143 | 152 | ||
144 | # We process the rest of the Makefile if this is the final invocation of make | 153 | # We process the rest of the Makefile if this is the final invocation of make |
145 | ifeq ($(skip-makefile),) | 154 | ifeq ($(skip-makefile),) |
146 | 155 | ||
156 | # Do not print "Entering directory ...", | ||
157 | # but we want to display it when entering to the output directory | ||
158 | # so that IDEs/editors are able to understand relative filenames. | ||
159 | MAKEFLAGS += --no-print-directory | ||
160 | |||
161 | # Call a source code checker (by default, "sparse") as part of the | ||
162 | # C compilation. | ||
163 | # | ||
164 | # Use 'make C=1' to enable checking of only re-compiled files. | ||
165 | # Use 'make C=2' to enable checking of *all* source files, regardless | ||
166 | # of whether they are re-compiled or not. | ||
167 | # | ||
168 | # See the file "Documentation/sparse.txt" for more details, including | ||
169 | # where to get the "sparse" utility. | ||
170 | |||
171 | ifeq ("$(origin C)", "command line") | ||
172 | KBUILD_CHECKSRC = $(C) | ||
173 | endif | ||
174 | ifndef KBUILD_CHECKSRC | ||
175 | KBUILD_CHECKSRC = 0 | ||
176 | endif | ||
177 | |||
178 | # Use make M=dir to specify directory of external module to build | ||
179 | # Old syntax make ... SUBDIRS=$PWD is still supported | ||
180 | # Setting the environment variable KBUILD_EXTMOD take precedence | ||
181 | ifdef SUBDIRS | ||
182 | KBUILD_EXTMOD ?= $(SUBDIRS) | ||
183 | endif | ||
184 | |||
185 | ifeq ("$(origin M)", "command line") | ||
186 | KBUILD_EXTMOD := $(M) | ||
187 | endif | ||
188 | |||
147 | # If building an external module we do not care about the all: rule | 189 | # If building an external module we do not care about the all: rule |
148 | # but instead _all depend on modules | 190 | # but instead _all depend on modules |
149 | PHONY += all | 191 | PHONY += all |
150 | ifeq ($(KBUILD_EXTMOD),) | 192 | ifeq ($(KBUILD_EXTMOD),) |
151 | _all: all | 193 | _all: all |
152 | else | 194 | else |
153 | _all: modules | 195 | _all: modules |
154 | endif | 196 | endif |
155 | 197 | ||
156 | srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) | 198 | ifeq ($(KBUILD_SRC),) |
157 | objtree := $(CURDIR) | 199 | # building in the source tree |
200 | srctree := . | ||
201 | else | ||
202 | ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) | ||
203 | # building in a subdirectory of the source tree | ||
204 | srctree := .. | ||
205 | else | ||
206 | srctree := $(KBUILD_SRC) | ||
207 | endif | ||
208 | endif | ||
209 | objtree := . | ||
158 | src := $(srctree) | 210 | src := $(srctree) |
159 | obj := $(objtree) | 211 | obj := $(objtree) |
160 | 212 | ||
161 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) | 213 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) |
162 | 214 | ||
163 | export srctree objtree VPATH | 215 | export srctree objtree VPATH |
164 | 216 | ||
165 | # Make sure CDPATH settings don't interfere | 217 | # Make sure CDPATH settings don't interfere |
166 | unexport CDPATH | 218 | unexport CDPATH |
167 | 219 | ||
168 | ######################################################################### | 220 | ######################################################################### |
169 | 221 | ||
170 | HOSTARCH := $(shell uname -m | \ | 222 | HOSTARCH := $(shell uname -m | \ |
171 | sed -e s/i.86/x86/ \ | 223 | sed -e s/i.86/x86/ \ |
172 | -e s/sun4u/sparc64/ \ | 224 | -e s/sun4u/sparc64/ \ |
173 | -e s/arm.*/arm/ \ | 225 | -e s/arm.*/arm/ \ |
174 | -e s/sa110/arm/ \ | 226 | -e s/sa110/arm/ \ |
175 | -e s/ppc64/powerpc/ \ | 227 | -e s/ppc64/powerpc/ \ |
176 | -e s/ppc/powerpc/ \ | 228 | -e s/ppc/powerpc/ \ |
177 | -e s/macppc/powerpc/\ | 229 | -e s/macppc/powerpc/\ |
178 | -e s/sh.*/sh/) | 230 | -e s/sh.*/sh/) |
179 | 231 | ||
180 | HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ | 232 | HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ |
181 | sed -e 's/\(cygwin\).*/cygwin/') | 233 | sed -e 's/\(cygwin\).*/cygwin/') |
182 | 234 | ||
183 | export HOSTARCH HOSTOS | 235 | export HOSTARCH HOSTOS |
184 | 236 | ||
185 | ######################################################################### | 237 | ######################################################################### |
186 | 238 | ||
187 | # set default to nothing for native builds | 239 | # set default to nothing for native builds |
188 | ifeq ($(HOSTARCH),$(ARCH)) | 240 | ifeq ($(HOSTARCH),$(ARCH)) |
189 | CROSS_COMPILE ?= | 241 | CROSS_COMPILE ?= |
190 | endif | 242 | endif |
191 | 243 | ||
192 | KCONFIG_CONFIG ?= .config | 244 | KCONFIG_CONFIG ?= .config |
193 | export KCONFIG_CONFIG | 245 | export KCONFIG_CONFIG |
194 | 246 | ||
195 | # SHELL used by kbuild | 247 | # SHELL used by kbuild |
196 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | 248 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
197 | else if [ -x /bin/bash ]; then echo /bin/bash; \ | 249 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
198 | else echo sh; fi ; fi) | 250 | else echo sh; fi ; fi) |
199 | 251 | ||
200 | HOSTCC = cc | 252 | HOSTCC = cc |
201 | HOSTCXX = c++ | 253 | HOSTCXX = c++ |
202 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer | 254 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer |
203 | HOSTCXXFLAGS = -O2 | 255 | HOSTCXXFLAGS = -O2 |
204 | 256 | ||
205 | ifeq ($(HOSTOS),cygwin) | 257 | ifeq ($(HOSTOS),cygwin) |
206 | HOSTCFLAGS += -ansi | 258 | HOSTCFLAGS += -ansi |
207 | endif | 259 | endif |
208 | 260 | ||
209 | # Mac OS X / Darwin's C preprocessor is Apple specific. It | 261 | # Mac OS X / Darwin's C preprocessor is Apple specific. It |
210 | # generates numerous errors and warnings. We want to bypass it | 262 | # generates numerous errors and warnings. We want to bypass it |
211 | # and use GNU C's cpp. To do this we pass the -traditional-cpp | 263 | # and use GNU C's cpp. To do this we pass the -traditional-cpp |
212 | # option to the compiler. Note that the -traditional-cpp flag | 264 | # option to the compiler. Note that the -traditional-cpp flag |
213 | # DOES NOT have the same semantics as GNU C's flag, all it does | 265 | # DOES NOT have the same semantics as GNU C's flag, all it does |
214 | # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. | 266 | # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. |
215 | # | 267 | # |
216 | # Apple's linker is similar, thanks to the new 2 stage linking | 268 | # Apple's linker is similar, thanks to the new 2 stage linking |
217 | # multiple symbol definitions are treated as errors, hence the | 269 | # multiple symbol definitions are treated as errors, hence the |
218 | # -multiply_defined suppress option to turn off this error. | 270 | # -multiply_defined suppress option to turn off this error. |
219 | # | 271 | # |
220 | ifeq ($(HOSTOS),darwin) | 272 | ifeq ($(HOSTOS),darwin) |
221 | # get major and minor product version (e.g. '10' and '6' for Snow Leopard) | 273 | # get major and minor product version (e.g. '10' and '6' for Snow Leopard) |
222 | DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') | 274 | DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') |
223 | DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') | 275 | DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') |
224 | 276 | ||
225 | os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ | 277 | os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ |
226 | $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) | 278 | $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) |
227 | 279 | ||
228 | # Snow Leopards build environment has no longer restrictions as described above | 280 | # Snow Leopards build environment has no longer restrictions as described above |
229 | HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") | 281 | HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") |
230 | HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") | 282 | HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") |
231 | HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") | 283 | HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") |
232 | endif | 284 | endif |
233 | 285 | ||
234 | # Decide whether to build built-in, modular, or both. | 286 | # Decide whether to build built-in, modular, or both. |
235 | # Normally, just do built-in. | 287 | # Normally, just do built-in. |
236 | 288 | ||
237 | KBUILD_MODULES := | 289 | KBUILD_MODULES := |
238 | KBUILD_BUILTIN := 1 | 290 | KBUILD_BUILTIN := 1 |
239 | 291 | ||
240 | # If we have only "make modules", don't compile built-in objects. | 292 | # If we have only "make modules", don't compile built-in objects. |
241 | # When we're building modules with modversions, we need to consider | 293 | # When we're building modules with modversions, we need to consider |
242 | # the built-in objects during the descend as well, in order to | 294 | # the built-in objects during the descend as well, in order to |
243 | # make sure the checksums are up to date before we record them. | 295 | # make sure the checksums are up to date before we record them. |
244 | 296 | ||
245 | ifeq ($(MAKECMDGOALS),modules) | 297 | ifeq ($(MAKECMDGOALS),modules) |
246 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | 298 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) |
247 | endif | 299 | endif |
248 | 300 | ||
249 | # If we have "make <whatever> modules", compile modules | 301 | # If we have "make <whatever> modules", compile modules |
250 | # in addition to whatever we do anyway. | 302 | # in addition to whatever we do anyway. |
251 | # Just "make" or "make all" shall build modules as well | 303 | # Just "make" or "make all" shall build modules as well |
252 | 304 | ||
253 | # U-Boot does not need modules | 305 | # U-Boot does not need modules |
254 | #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | 306 | #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) |
255 | # KBUILD_MODULES := 1 | 307 | # KBUILD_MODULES := 1 |
256 | #endif | 308 | #endif |
257 | 309 | ||
258 | #ifeq ($(MAKECMDGOALS),) | 310 | #ifeq ($(MAKECMDGOALS),) |
259 | # KBUILD_MODULES := 1 | 311 | # KBUILD_MODULES := 1 |
260 | #endif | 312 | #endif |
261 | 313 | ||
262 | export KBUILD_MODULES KBUILD_BUILTIN | 314 | export KBUILD_MODULES KBUILD_BUILTIN |
263 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 315 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
264 | 316 | ||
265 | # Beautify output | ||
266 | # --------------------------------------------------------------------------- | ||
267 | # | ||
268 | # Normally, we echo the whole command before executing it. By making | ||
269 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | ||
270 | # $(quiet) to choose other forms of output instead, e.g. | ||
271 | # | ||
272 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | ||
273 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
274 | # | ||
275 | # If $(quiet) is empty, the whole command will be printed. | ||
276 | # If it is set to "quiet_", only the short version will be printed. | ||
277 | # If it is set to "silent_", nothing will be printed at all, since | ||
278 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | ||
279 | # | ||
280 | # A simple variant is to prefix commands with $(Q) - that's useful | ||
281 | # for commands that shall be hidden in non-verbose mode. | ||
282 | # | ||
283 | # $(Q)ln $@ :< | ||
284 | # | ||
285 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | ||
286 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | ||
287 | |||
288 | ifeq ($(KBUILD_VERBOSE),1) | ||
289 | quiet = | ||
290 | Q = | ||
291 | else | ||
292 | quiet=quiet_ | ||
293 | Q = @ | ||
294 | endif | ||
295 | |||
296 | # If the user is running make -s (silent mode), suppress echoing of | ||
297 | # commands | ||
298 | |||
299 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 | ||
300 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) | ||
301 | quiet=silent_ | ||
302 | endif | ||
303 | else # make-3.8x | ||
304 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) | ||
305 | quiet=silent_ | ||
306 | endif | ||
307 | endif | ||
308 | |||
309 | export quiet Q KBUILD_VERBOSE | ||
310 | |||
311 | # Look for make include files relative to root of kernel src | 317 | # Look for make include files relative to root of kernel src |
312 | MAKEFLAGS += --include-dir=$(srctree) | 318 | MAKEFLAGS += --include-dir=$(srctree) |
313 | 319 | ||
314 | # We need some generic definitions (do not try to remake the file). | 320 | # We need some generic definitions (do not try to remake the file). |
315 | $(srctree)/scripts/Kbuild.include: ; | 321 | $(srctree)/scripts/Kbuild.include: ; |
316 | include $(srctree)/scripts/Kbuild.include | 322 | include $(srctree)/scripts/Kbuild.include |
317 | 323 | ||
318 | # Make variables (CC, etc...) | 324 | # Make variables (CC, etc...) |
319 | 325 | ||
320 | AS = $(CROSS_COMPILE)as | 326 | AS = $(CROSS_COMPILE)as |
321 | # Always use GNU ld | 327 | # Always use GNU ld |
322 | ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) | 328 | ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) |
323 | LD = $(CROSS_COMPILE)ld.bfd | 329 | LD = $(CROSS_COMPILE)ld.bfd |
324 | else | 330 | else |
325 | LD = $(CROSS_COMPILE)ld | 331 | LD = $(CROSS_COMPILE)ld |
326 | endif | 332 | endif |
327 | CC = $(CROSS_COMPILE)gcc | 333 | CC = $(CROSS_COMPILE)gcc |
328 | CPP = $(CC) -E | 334 | CPP = $(CC) -E |
329 | AR = $(CROSS_COMPILE)ar | 335 | AR = $(CROSS_COMPILE)ar |
330 | NM = $(CROSS_COMPILE)nm | 336 | NM = $(CROSS_COMPILE)nm |
331 | LDR = $(CROSS_COMPILE)ldr | 337 | LDR = $(CROSS_COMPILE)ldr |
332 | STRIP = $(CROSS_COMPILE)strip | 338 | STRIP = $(CROSS_COMPILE)strip |
333 | OBJCOPY = $(CROSS_COMPILE)objcopy | 339 | OBJCOPY = $(CROSS_COMPILE)objcopy |
334 | OBJDUMP = $(CROSS_COMPILE)objdump | 340 | OBJDUMP = $(CROSS_COMPILE)objdump |
335 | AWK = awk | 341 | AWK = awk |
336 | PERL = perl | 342 | PERL = perl |
337 | PYTHON = python | 343 | PYTHON = python |
338 | DTC = dtc | 344 | DTC = dtc |
339 | CHECK = sparse | 345 | CHECK = sparse |
340 | 346 | ||
341 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ | 347 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ |
342 | -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) | 348 | -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) |
343 | 349 | ||
344 | KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ | 350 | KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ |
345 | 351 | ||
346 | KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ | 352 | KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ |
347 | -Wno-format-security \ | 353 | -Wno-format-security \ |
348 | -fno-builtin -ffreestanding | 354 | -fno-builtin -ffreestanding |
349 | KBUILD_AFLAGS := -D__ASSEMBLY__ | 355 | KBUILD_AFLAGS := -D__ASSEMBLY__ |
350 | 356 | ||
351 | # Read UBOOTRELEASE from include/config/uboot.release (if it exists) | 357 | # Read UBOOTRELEASE from include/config/uboot.release (if it exists) |
352 | UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) | 358 | UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) |
353 | UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | 359 | UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) |
354 | 360 | ||
355 | export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION | 361 | export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION |
356 | export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR | 362 | export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR |
357 | export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC | 363 | export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC |
358 | export CPP AR NM LDR STRIP OBJCOPY OBJDUMP | 364 | export CPP AR NM LDR STRIP OBJCOPY OBJDUMP |
359 | export MAKE AWK PERL PYTHON | 365 | export MAKE AWK PERL PYTHON |
360 | export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS | 366 | export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS |
361 | 367 | ||
362 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS | 368 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS |
363 | export KBUILD_CFLAGS KBUILD_AFLAGS | 369 | export KBUILD_CFLAGS KBUILD_AFLAGS |
364 | 370 | ||
365 | # When compiling out-of-tree modules, put MODVERDIR in the module | 371 | # When compiling out-of-tree modules, put MODVERDIR in the module |
366 | # tree rather than in the kernel tree. The kernel tree might | 372 | # tree rather than in the kernel tree. The kernel tree might |
367 | # even be read-only. | 373 | # even be read-only. |
368 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions | 374 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions |
369 | 375 | ||
370 | # Files to ignore in find ... statements | 376 | # Files to ignore in find ... statements |
371 | 377 | ||
372 | export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ | 378 | export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ |
373 | -name CVS -o -name .pc -o -name .hg -o -name .git \) \ | 379 | -name CVS -o -name .pc -o -name .hg -o -name .git \) \ |
374 | -prune -o | 380 | -prune -o |
375 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ | 381 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ |
376 | --exclude CVS --exclude .pc --exclude .hg --exclude .git | 382 | --exclude CVS --exclude .pc --exclude .hg --exclude .git |
377 | 383 | ||
378 | # =========================================================================== | 384 | # =========================================================================== |
379 | # Rules shared between *config targets and build targets | 385 | # Rules shared between *config targets and build targets |
380 | 386 | ||
381 | # Basic helpers built in scripts/ | 387 | # Basic helpers built in scripts/ |
382 | PHONY += scripts_basic | 388 | PHONY += scripts_basic |
383 | scripts_basic: | 389 | scripts_basic: |
384 | $(Q)$(MAKE) $(build)=scripts/basic | 390 | $(Q)$(MAKE) $(build)=scripts/basic |
385 | $(Q)rm -f .tmp_quiet_recordmcount | 391 | $(Q)rm -f .tmp_quiet_recordmcount |
386 | 392 | ||
387 | # To avoid any implicit rule to kick in, define an empty command. | 393 | # To avoid any implicit rule to kick in, define an empty command. |
388 | scripts/basic/%: scripts_basic ; | 394 | scripts/basic/%: scripts_basic ; |
389 | 395 | ||
390 | PHONY += outputmakefile | 396 | PHONY += outputmakefile |
391 | # outputmakefile generates a Makefile in the output directory, if using a | 397 | # outputmakefile generates a Makefile in the output directory, if using a |
392 | # separate output directory. This allows convenient use of make in the | 398 | # separate output directory. This allows convenient use of make in the |
393 | # output directory. | 399 | # output directory. |
394 | outputmakefile: | 400 | outputmakefile: |
395 | ifneq ($(KBUILD_SRC),) | 401 | ifneq ($(KBUILD_SRC),) |
396 | $(Q)ln -fsn $(srctree) source | 402 | $(Q)ln -fsn $(srctree) source |
397 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ | 403 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ |
398 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 404 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
399 | endif | 405 | endif |
400 | 406 | ||
401 | # To make sure we do not include .config for any of the *config targets | 407 | # To make sure we do not include .config for any of the *config targets |
402 | # catch them early, and hand them over to scripts/kconfig/Makefile | 408 | # catch them early, and hand them over to scripts/kconfig/Makefile |
403 | # It is allowed to specify more targets when calling make, including | 409 | # It is allowed to specify more targets when calling make, including |
404 | # mixing *config targets and build targets. | 410 | # mixing *config targets and build targets. |
405 | # For example 'make oldconfig all'. | 411 | # For example 'make oldconfig all'. |
406 | # Detect when mixed targets is specified, and make a second invocation | 412 | # Detect when mixed targets is specified, and make a second invocation |
407 | # of make so .config is not included in this case either (for *config). | 413 | # of make so .config is not included in this case either (for *config). |
408 | 414 | ||
409 | version_h := include/generated/version_autogenerated.h | 415 | version_h := include/generated/version_autogenerated.h |
410 | timestamp_h := include/generated/timestamp_autogenerated.h | 416 | timestamp_h := include/generated/timestamp_autogenerated.h |
411 | 417 | ||
412 | no-dot-config-targets := clean clobber mrproper distclean \ | 418 | no-dot-config-targets := clean clobber mrproper distclean \ |
413 | help %docs check% coccicheck \ | 419 | help %docs check% coccicheck \ |
414 | ubootversion backup | 420 | ubootversion backup |
415 | 421 | ||
416 | config-targets := 0 | 422 | config-targets := 0 |
417 | mixed-targets := 0 | 423 | mixed-targets := 0 |
418 | dot-config := 1 | 424 | dot-config := 1 |
419 | 425 | ||
420 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) | 426 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
421 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) | 427 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) |
422 | dot-config := 0 | 428 | dot-config := 0 |
423 | endif | 429 | endif |
424 | endif | 430 | endif |
425 | 431 | ||
426 | ifeq ($(KBUILD_EXTMOD),) | 432 | ifeq ($(KBUILD_EXTMOD),) |
427 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) | 433 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) |
428 | config-targets := 1 | 434 | config-targets := 1 |
429 | ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) | 435 | ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) |
430 | mixed-targets := 1 | 436 | mixed-targets := 1 |
431 | endif | 437 | endif |
432 | endif | 438 | endif |
433 | endif | 439 | endif |
434 | 440 | ||
435 | ifeq ($(mixed-targets),1) | 441 | ifeq ($(mixed-targets),1) |
436 | # =========================================================================== | 442 | # =========================================================================== |
437 | # We're called with mixed targets (*config and build targets). | 443 | # We're called with mixed targets (*config and build targets). |
438 | # Handle them one by one. | 444 | # Handle them one by one. |
439 | 445 | ||
440 | PHONY += $(MAKECMDGOALS) __build_one_by_one | 446 | PHONY += $(MAKECMDGOALS) __build_one_by_one |
441 | 447 | ||
442 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | 448 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one |
443 | @: | 449 | @: |
444 | 450 | ||
445 | __build_one_by_one: | 451 | __build_one_by_one: |
446 | $(Q)set -e; \ | 452 | $(Q)set -e; \ |
447 | for i in $(MAKECMDGOALS); do \ | 453 | for i in $(MAKECMDGOALS); do \ |
448 | $(MAKE) -f $(srctree)/Makefile $$i; \ | 454 | $(MAKE) -f $(srctree)/Makefile $$i; \ |
449 | done | 455 | done |
450 | 456 | ||
451 | else | 457 | else |
452 | ifeq ($(config-targets),1) | 458 | ifeq ($(config-targets),1) |
453 | # =========================================================================== | 459 | # =========================================================================== |
454 | # *config targets only - make sure prerequisites are updated, and descend | 460 | # *config targets only - make sure prerequisites are updated, and descend |
455 | # in scripts/kconfig to make the *config target | 461 | # in scripts/kconfig to make the *config target |
456 | 462 | ||
457 | KBUILD_DEFCONFIG := sandbox_defconfig | 463 | KBUILD_DEFCONFIG := sandbox_defconfig |
458 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 464 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
459 | 465 | ||
460 | config: scripts_basic outputmakefile FORCE | 466 | config: scripts_basic outputmakefile FORCE |
461 | +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@ | 467 | +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@ |
462 | 468 | ||
463 | %config: scripts_basic outputmakefile FORCE | 469 | %config: scripts_basic outputmakefile FORCE |
464 | +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@ | 470 | +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@ |
465 | 471 | ||
466 | else | 472 | else |
467 | # =========================================================================== | 473 | # =========================================================================== |
468 | # Build targets only - this includes vmlinux, arch specific targets, clean | 474 | # Build targets only - this includes vmlinux, arch specific targets, clean |
469 | # targets and others. In general all targets except *config targets. | 475 | # targets and others. In general all targets except *config targets. |
470 | 476 | ||
471 | ifeq ($(dot-config),1) | 477 | ifeq ($(dot-config),1) |
472 | # Read in config | 478 | # Read in config |
473 | -include include/config/auto.conf | 479 | -include include/config/auto.conf |
474 | 480 | ||
475 | # Read in dependencies to all Kconfig* files, make sure to run | 481 | # Read in dependencies to all Kconfig* files, make sure to run |
476 | # oldconfig if changes are detected. | 482 | # oldconfig if changes are detected. |
477 | -include include/config/auto.conf.cmd | 483 | -include include/config/auto.conf.cmd |
478 | 484 | ||
479 | # To avoid any implicit rule to kick in, define an empty command | 485 | # To avoid any implicit rule to kick in, define an empty command |
480 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; | 486 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
481 | 487 | ||
482 | # If .config is newer than include/config/auto.conf, someone tinkered | 488 | # If .config is newer than include/config/auto.conf, someone tinkered |
483 | # with it and forgot to run make oldconfig. | 489 | # with it and forgot to run make oldconfig. |
484 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so | 490 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so |
485 | # we execute the config step to be sure to catch updated Kconfig files | 491 | # we execute the config step to be sure to catch updated Kconfig files |
486 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd | 492 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
487 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 493 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
488 | 494 | ||
489 | -include include/autoconf.mk | 495 | -include include/autoconf.mk |
490 | -include include/autoconf.mk.dep | 496 | -include include/autoconf.mk.dep |
491 | 497 | ||
492 | # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf | 498 | # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf |
493 | # is up-to-date. When we switch to a different board configuration, old CONFIG | 499 | # is up-to-date. When we switch to a different board configuration, old CONFIG |
494 | # macros are still remaining in include/config/auto.conf. Without the following | 500 | # macros are still remaining in include/config/auto.conf. Without the following |
495 | # gimmick, wrong config.mk would be included leading nasty warnings/errors. | 501 | # gimmick, wrong config.mk would be included leading nasty warnings/errors. |
496 | autoconf_is_current := $(if $(wildcard $(KCONFIG_CONFIG)),$(shell find . \ | 502 | autoconf_is_current := $(if $(wildcard $(KCONFIG_CONFIG)),$(shell find . \ |
497 | -path ./include/config/auto.conf -newer $(KCONFIG_CONFIG))) | 503 | -path ./include/config/auto.conf -newer $(KCONFIG_CONFIG))) |
498 | ifneq ($(autoconf_is_current),) | 504 | ifneq ($(autoconf_is_current),) |
499 | include $(srctree)/config.mk | 505 | include $(srctree)/config.mk |
500 | endif | 506 | endif |
501 | 507 | ||
502 | # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use | 508 | # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use |
503 | # that (or fail if absent). Otherwise, search for a linker script in a | 509 | # that (or fail if absent). Otherwise, search for a linker script in a |
504 | # standard location. | 510 | # standard location. |
505 | 511 | ||
506 | ifndef LDSCRIPT | 512 | ifndef LDSCRIPT |
507 | #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug | 513 | #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug |
508 | ifdef CONFIG_SYS_LDSCRIPT | 514 | ifdef CONFIG_SYS_LDSCRIPT |
509 | # need to strip off double quotes | 515 | # need to strip off double quotes |
510 | LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%) | 516 | LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%) |
511 | endif | 517 | endif |
512 | endif | 518 | endif |
513 | 519 | ||
514 | # If there is no specified link script, we look in a number of places for it | 520 | # If there is no specified link script, we look in a number of places for it |
515 | ifndef LDSCRIPT | 521 | ifndef LDSCRIPT |
516 | ifeq ($(wildcard $(LDSCRIPT)),) | 522 | ifeq ($(wildcard $(LDSCRIPT)),) |
517 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds | 523 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds |
518 | endif | 524 | endif |
519 | ifeq ($(wildcard $(LDSCRIPT)),) | 525 | ifeq ($(wildcard $(LDSCRIPT)),) |
520 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds | 526 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds |
521 | endif | 527 | endif |
522 | ifeq ($(wildcard $(LDSCRIPT)),) | 528 | ifeq ($(wildcard $(LDSCRIPT)),) |
523 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds | 529 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds |
524 | endif | 530 | endif |
525 | endif | 531 | endif |
526 | 532 | ||
527 | else | 533 | else |
528 | # Dummy target needed, because used as prerequisite | 534 | # Dummy target needed, because used as prerequisite |
529 | include/config/auto.conf: ; | 535 | include/config/auto.conf: ; |
530 | endif # $(dot-config) | 536 | endif # $(dot-config) |
531 | 537 | ||
532 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 538 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
533 | KBUILD_CFLAGS += -Os | 539 | KBUILD_CFLAGS += -Os |
534 | else | 540 | else |
535 | KBUILD_CFLAGS += -O2 | 541 | KBUILD_CFLAGS += -O2 |
536 | endif | 542 | endif |
537 | 543 | ||
538 | ifdef BUILD_TAG | 544 | ifdef BUILD_TAG |
539 | KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"' | 545 | KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"' |
540 | endif | 546 | endif |
541 | 547 | ||
542 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) | 548 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) |
543 | 549 | ||
544 | KBUILD_CFLAGS += -g | 550 | KBUILD_CFLAGS += -g |
545 | # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format> | 551 | # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format> |
546 | # option to the assembler. | 552 | # option to the assembler. |
547 | KBUILD_AFLAGS += -g | 553 | KBUILD_AFLAGS += -g |
548 | 554 | ||
549 | # Report stack usage if supported | 555 | # Report stack usage if supported |
550 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y) | 556 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y) |
551 | KBUILD_CFLAGS += -fstack-usage | 557 | KBUILD_CFLAGS += -fstack-usage |
552 | endif | 558 | endif |
553 | 559 | ||
554 | KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) | 560 | KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) |
555 | 561 | ||
556 | # turn jbsr into jsr for m68k | 562 | # turn jbsr into jsr for m68k |
557 | ifeq ($(ARCH),m68k) | 563 | ifeq ($(ARCH),m68k) |
558 | ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) | 564 | ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) |
559 | KBUILD_AFLAGS += -Wa,-gstabs,-S | 565 | KBUILD_AFLAGS += -Wa,-gstabs,-S |
560 | endif | 566 | endif |
561 | endif | 567 | endif |
562 | 568 | ||
563 | # Prohibit date/time macros, which would make the build non-deterministic | 569 | # Prohibit date/time macros, which would make the build non-deterministic |
564 | KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) | 570 | KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) |
565 | 571 | ||
566 | ifneq ($(CONFIG_SYS_TEXT_BASE),) | 572 | ifneq ($(CONFIG_SYS_TEXT_BASE),) |
567 | KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) | 573 | KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) |
568 | endif | 574 | endif |
569 | 575 | ||
570 | export CONFIG_SYS_TEXT_BASE | 576 | export CONFIG_SYS_TEXT_BASE |
571 | 577 | ||
572 | include $(srctree)/scripts/Makefile.extrawarn | 578 | include $(srctree)/scripts/Makefile.extrawarn |
573 | 579 | ||
574 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | 580 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments |
575 | KBUILD_CPPFLAGS += $(KCPPFLAGS) | 581 | KBUILD_CPPFLAGS += $(KCPPFLAGS) |
576 | KBUILD_AFLAGS += $(KAFLAGS) | 582 | KBUILD_AFLAGS += $(KAFLAGS) |
577 | KBUILD_CFLAGS += $(KCFLAGS) | 583 | KBUILD_CFLAGS += $(KCFLAGS) |
578 | 584 | ||
579 | # Use UBOOTINCLUDE when you must reference the include/ directory. | 585 | # Use UBOOTINCLUDE when you must reference the include/ directory. |
580 | # Needed to be compatible with the O= option | 586 | # Needed to be compatible with the O= option |
581 | UBOOTINCLUDE := \ | 587 | UBOOTINCLUDE := \ |
582 | -Iinclude \ | 588 | -Iinclude \ |
583 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ | 589 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ |
584 | -I$(srctree)/arch/$(ARCH)/include \ | 590 | -I$(srctree)/arch/$(ARCH)/include \ |
585 | -include $(srctree)/include/linux/kconfig.h | 591 | -include $(srctree)/include/linux/kconfig.h |
586 | 592 | ||
587 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 593 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
588 | CHECKFLAGS += $(NOSTDINC_FLAGS) | 594 | CHECKFLAGS += $(NOSTDINC_FLAGS) |
589 | 595 | ||
590 | # FIX ME | 596 | # FIX ME |
591 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ | 597 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ |
592 | $(NOSTDINC_FLAGS) | 598 | $(NOSTDINC_FLAGS) |
593 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) | 599 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) |
594 | 600 | ||
595 | ######################################################################### | 601 | ######################################################################### |
596 | # U-Boot objects....order is important (i.e. start must be first) | 602 | # U-Boot objects....order is important (i.e. start must be first) |
597 | 603 | ||
598 | head-y := $(CPUDIR)/start.o | 604 | head-y := $(CPUDIR)/start.o |
599 | head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o | 605 | head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o |
600 | head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o | 606 | head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o |
601 | 607 | ||
602 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) | 608 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) |
603 | 609 | ||
604 | libs-y += lib/ | 610 | libs-y += lib/ |
605 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | 611 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ |
606 | libs-y += $(CPUDIR)/ | 612 | libs-y += $(CPUDIR)/ |
607 | ifdef SOC | 613 | ifdef SOC |
608 | libs-y += $(CPUDIR)/$(SOC)/ | 614 | libs-y += $(CPUDIR)/$(SOC)/ |
609 | endif | 615 | endif |
610 | libs-$(CONFIG_OF_EMBED) += dts/ | 616 | libs-$(CONFIG_OF_EMBED) += dts/ |
611 | libs-y += arch/$(ARCH)/lib/ | 617 | libs-y += arch/$(ARCH)/lib/ |
612 | libs-y += fs/ | 618 | libs-y += fs/ |
613 | libs-y += net/ | 619 | libs-y += net/ |
614 | libs-y += disk/ | 620 | libs-y += disk/ |
615 | libs-y += drivers/ | 621 | libs-y += drivers/ |
616 | libs-y += drivers/dma/ | 622 | libs-y += drivers/dma/ |
617 | libs-y += drivers/gpio/ | 623 | libs-y += drivers/gpio/ |
618 | libs-y += drivers/i2c/ | 624 | libs-y += drivers/i2c/ |
619 | libs-y += drivers/mmc/ | 625 | libs-y += drivers/mmc/ |
620 | libs-y += drivers/mtd/ | 626 | libs-y += drivers/mtd/ |
621 | libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ | 627 | libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ |
622 | libs-y += drivers/mtd/onenand/ | 628 | libs-y += drivers/mtd/onenand/ |
623 | libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ | 629 | libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ |
624 | libs-y += drivers/mtd/spi/ | 630 | libs-y += drivers/mtd/spi/ |
625 | libs-y += drivers/net/ | 631 | libs-y += drivers/net/ |
626 | libs-y += drivers/net/phy/ | 632 | libs-y += drivers/net/phy/ |
627 | libs-y += drivers/pci/ | 633 | libs-y += drivers/pci/ |
628 | libs-y += drivers/power/ \ | 634 | libs-y += drivers/power/ \ |
629 | drivers/power/fuel_gauge/ \ | 635 | drivers/power/fuel_gauge/ \ |
630 | drivers/power/mfd/ \ | 636 | drivers/power/mfd/ \ |
631 | drivers/power/pmic/ \ | 637 | drivers/power/pmic/ \ |
632 | drivers/power/battery/ | 638 | drivers/power/battery/ |
633 | libs-y += drivers/spi/ | 639 | libs-y += drivers/spi/ |
634 | libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ | 640 | libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ |
635 | libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ | 641 | libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ |
636 | libs-y += drivers/serial/ | 642 | libs-y += drivers/serial/ |
637 | libs-y += drivers/usb/eth/ | 643 | libs-y += drivers/usb/eth/ |
638 | libs-y += drivers/usb/gadget/ | 644 | libs-y += drivers/usb/gadget/ |
639 | libs-y += drivers/usb/host/ | 645 | libs-y += drivers/usb/host/ |
640 | libs-y += drivers/usb/musb/ | 646 | libs-y += drivers/usb/musb/ |
641 | libs-y += drivers/usb/musb-new/ | 647 | libs-y += drivers/usb/musb-new/ |
642 | libs-y += drivers/usb/phy/ | 648 | libs-y += drivers/usb/phy/ |
643 | libs-y += drivers/usb/ulpi/ | 649 | libs-y += drivers/usb/ulpi/ |
644 | libs-y += common/ | 650 | libs-y += common/ |
645 | libs-y += lib/libfdt/ | 651 | libs-y += lib/libfdt/ |
646 | libs-$(CONFIG_API) += api/ | 652 | libs-$(CONFIG_API) += api/ |
647 | libs-$(CONFIG_HAS_POST) += post/ | 653 | libs-$(CONFIG_HAS_POST) += post/ |
648 | libs-y += test/ | 654 | libs-y += test/ |
649 | libs-y += test/dm/ | 655 | libs-y += test/dm/ |
650 | 656 | ||
651 | ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) | 657 | ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) |
652 | libs-y += arch/$(ARCH)/imx-common/ | 658 | libs-y += arch/$(ARCH)/imx-common/ |
653 | endif | 659 | endif |
654 | 660 | ||
655 | ifneq (,$(filter $(SOC), armada-xp kirkwood)) | 661 | ifneq (,$(filter $(SOC), armada-xp kirkwood)) |
656 | libs-y += arch/$(ARCH)/mvebu-common/ | 662 | libs-y += arch/$(ARCH)/mvebu-common/ |
657 | endif | 663 | endif |
658 | 664 | ||
659 | libs-$(CONFIG_ARM) += arch/arm/cpu/ | 665 | libs-$(CONFIG_ARM) += arch/arm/cpu/ |
660 | libs-$(CONFIG_PPC) += arch/powerpc/cpu/ | 666 | libs-$(CONFIG_PPC) += arch/powerpc/cpu/ |
661 | 667 | ||
662 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) | 668 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) |
663 | 669 | ||
664 | libs-y := $(sort $(libs-y)) | 670 | libs-y := $(sort $(libs-y)) |
665 | 671 | ||
666 | u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples | 672 | u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples |
667 | 673 | ||
668 | u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-)))) | 674 | u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-)))) |
669 | 675 | ||
670 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) | 676 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) |
671 | 677 | ||
672 | u-boot-init := $(head-y) | 678 | u-boot-init := $(head-y) |
673 | u-boot-main := $(libs-y) | 679 | u-boot-main := $(libs-y) |
674 | 680 | ||
675 | 681 | ||
676 | # Add GCC lib | 682 | # Add GCC lib |
677 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) | 683 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) |
678 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a | 684 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a |
679 | else | 685 | else |
680 | PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc | 686 | PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc |
681 | endif | 687 | endif |
682 | PLATFORM_LIBS += $(PLATFORM_LIBGCC) | 688 | PLATFORM_LIBS += $(PLATFORM_LIBGCC) |
683 | export PLATFORM_LIBS | 689 | export PLATFORM_LIBS |
684 | export PLATFORM_LIBGCC | 690 | export PLATFORM_LIBGCC |
685 | 691 | ||
686 | # Special flags for CPP when processing the linker script. | 692 | # Special flags for CPP when processing the linker script. |
687 | # Pass the version down so we can handle backwards compatibility | 693 | # Pass the version down so we can handle backwards compatibility |
688 | # on the fly. | 694 | # on the fly. |
689 | LDPPFLAGS += \ | 695 | LDPPFLAGS += \ |
690 | -include $(srctree)/include/u-boot/u-boot.lds.h \ | 696 | -include $(srctree)/include/u-boot/u-boot.lds.h \ |
691 | -DCPUDIR=$(CPUDIR) \ | 697 | -DCPUDIR=$(CPUDIR) \ |
692 | $(shell $(LD) --version | \ | 698 | $(shell $(LD) --version | \ |
693 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') | 699 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') |
694 | 700 | ||
695 | ######################################################################### | 701 | ######################################################################### |
696 | ######################################################################### | 702 | ######################################################################### |
697 | 703 | ||
698 | ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) | 704 | ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) |
699 | BOARD_SIZE_CHECK = \ | 705 | BOARD_SIZE_CHECK = \ |
700 | @actual=`wc -c $@ | awk '{print $$1}'`; \ | 706 | @actual=`wc -c $@ | awk '{print $$1}'`; \ |
701 | limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ | 707 | limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ |
702 | if test $$actual -gt $$limit; then \ | 708 | if test $$actual -gt $$limit; then \ |
703 | echo "$@ exceeds file size limit:" >&2 ; \ | 709 | echo "$@ exceeds file size limit:" >&2 ; \ |
704 | echo " limit: $$limit bytes" >&2 ; \ | 710 | echo " limit: $$limit bytes" >&2 ; \ |
705 | echo " actual: $$actual bytes" >&2 ; \ | 711 | echo " actual: $$actual bytes" >&2 ; \ |
706 | echo " excess: $$((actual - limit)) bytes" >&2; \ | 712 | echo " excess: $$((actual - limit)) bytes" >&2; \ |
707 | exit 1; \ | 713 | exit 1; \ |
708 | fi | 714 | fi |
709 | else | 715 | else |
710 | BOARD_SIZE_CHECK = | 716 | BOARD_SIZE_CHECK = |
711 | endif | 717 | endif |
712 | 718 | ||
713 | # Statically apply RELA-style relocations (currently arm64 only) | 719 | # Statically apply RELA-style relocations (currently arm64 only) |
714 | ifneq ($(CONFIG_STATIC_RELA),) | 720 | ifneq ($(CONFIG_STATIC_RELA),) |
715 | # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base | 721 | # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base |
716 | DO_STATIC_RELA = \ | 722 | DO_STATIC_RELA = \ |
717 | start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ | 723 | start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ |
718 | end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ | 724 | end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ |
719 | tools/relocate-rela $(2) $(3) $$start $$end | 725 | tools/relocate-rela $(2) $(3) $$start $$end |
720 | else | 726 | else |
721 | DO_STATIC_RELA = | 727 | DO_STATIC_RELA = |
722 | endif | 728 | endif |
723 | 729 | ||
724 | # Always append ALL so that arch config.mk's can add custom ones | 730 | # Always append ALL so that arch config.mk's can add custom ones |
725 | ALL-y += u-boot.srec u-boot.bin System.map binary_size_check | 731 | ALL-y += u-boot.srec u-boot.bin System.map binary_size_check |
726 | 732 | ||
727 | ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin | 733 | ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin |
728 | ifeq ($(CONFIG_SPL_FSL_PBL),y) | 734 | ifeq ($(CONFIG_SPL_FSL_PBL),y) |
729 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin | 735 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin |
730 | else | 736 | else |
731 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl | 737 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl |
732 | endif | 738 | endif |
733 | ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin | 739 | ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin |
734 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img | 740 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img |
735 | ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin | 741 | ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin |
736 | ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin | 742 | ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin |
737 | ifeq ($(CONFIG_SPL_FRAMEWORK),y) | 743 | ifeq ($(CONFIG_SPL_FRAMEWORK),y) |
738 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img | 744 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img |
739 | endif | 745 | endif |
740 | ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb | 746 | ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb |
741 | ifneq ($(CONFIG_SPL_TARGET),) | 747 | ifneq ($(CONFIG_SPL_TARGET),) |
742 | ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) | 748 | ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) |
743 | endif | 749 | endif |
744 | ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf | 750 | ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf |
745 | 751 | ||
746 | # enable combined SPL/u-boot/dtb rules for tegra | 752 | # enable combined SPL/u-boot/dtb rules for tegra |
747 | ifneq ($(CONFIG_TEGRA),) | 753 | ifneq ($(CONFIG_TEGRA),) |
748 | ifeq ($(CONFIG_SPL),y) | 754 | ifeq ($(CONFIG_SPL),y) |
749 | ifeq ($(CONFIG_OF_SEPARATE),y) | 755 | ifeq ($(CONFIG_OF_SEPARATE),y) |
750 | ALL-y += u-boot-dtb-tegra.bin | 756 | ALL-y += u-boot-dtb-tegra.bin |
751 | else | 757 | else |
752 | ALL-y += u-boot-nodtb-tegra.bin | 758 | ALL-y += u-boot-nodtb-tegra.bin |
753 | endif | 759 | endif |
754 | endif | 760 | endif |
755 | endif | 761 | endif |
756 | 762 | ||
757 | # Add optional build target if defined in board/cpu/soc headers | 763 | # Add optional build target if defined in board/cpu/soc headers |
758 | ifneq ($(CONFIG_BUILD_TARGET),) | 764 | ifneq ($(CONFIG_BUILD_TARGET),) |
759 | ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) | 765 | ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) |
760 | endif | 766 | endif |
761 | 767 | ||
762 | LDFLAGS_u-boot += $(LDFLAGS_FINAL) | 768 | LDFLAGS_u-boot += $(LDFLAGS_FINAL) |
763 | ifneq ($(CONFIG_SYS_TEXT_BASE),) | 769 | ifneq ($(CONFIG_SYS_TEXT_BASE),) |
764 | LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) | 770 | LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) |
765 | endif | 771 | endif |
766 | 772 | ||
767 | quiet_cmd_objcopy = OBJCOPY $@ | 773 | quiet_cmd_objcopy = OBJCOPY $@ |
768 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ | 774 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ |
769 | 775 | ||
770 | quiet_cmd_mkimage = MKIMAGE $@ | 776 | quiet_cmd_mkimage = MKIMAGE $@ |
771 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ | 777 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ |
772 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) | 778 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
773 | 779 | ||
774 | quiet_cmd_cat = CAT $@ | 780 | quiet_cmd_cat = CAT $@ |
775 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ | 781 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ |
776 | 782 | ||
777 | append = cat $(filter-out $< $(PHONY), $^) >> $@ | 783 | append = cat $(filter-out $< $(PHONY), $^) >> $@ |
778 | 784 | ||
779 | quiet_cmd_pad_cat = CAT $@ | 785 | quiet_cmd_pad_cat = CAT $@ |
780 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ | 786 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ |
781 | 787 | ||
782 | all: $(ALL-y) | 788 | all: $(ALL-y) |
783 | ifneq ($(CONFIG_SYS_GENERIC_BOARD),y) | 789 | ifneq ($(CONFIG_SYS_GENERIC_BOARD),y) |
784 | @echo "===================== WARNING ======================" | 790 | @echo "===================== WARNING ======================" |
785 | @echo "Please convert this board to generic board." | 791 | @echo "Please convert this board to generic board." |
786 | @echo "Otherwise it will be removed by the end of 2014." | 792 | @echo "Otherwise it will be removed by the end of 2014." |
787 | @echo "See doc/README.generic-board for further information" | 793 | @echo "See doc/README.generic-board for further information" |
788 | @echo "====================================================" | 794 | @echo "====================================================" |
789 | endif | 795 | endif |
790 | 796 | ||
791 | PHONY += dtbs | 797 | PHONY += dtbs |
792 | dtbs dts/dt.dtb: checkdtc u-boot | 798 | dtbs dts/dt.dtb: checkdtc u-boot |
793 | $(Q)$(MAKE) $(build)=dts dtbs | 799 | $(Q)$(MAKE) $(build)=dts dtbs |
794 | 800 | ||
795 | u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE | 801 | u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE |
796 | $(call if_changed,cat) | 802 | $(call if_changed,cat) |
797 | 803 | ||
798 | %.imx: %.bin | 804 | %.imx: %.bin |
799 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 805 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
800 | 806 | ||
801 | quiet_cmd_copy = COPY $@ | 807 | quiet_cmd_copy = COPY $@ |
802 | cmd_copy = cp $< $@ | 808 | cmd_copy = cp $< $@ |
803 | 809 | ||
804 | u-boot.dtb: dts/dt.dtb | 810 | u-boot.dtb: dts/dt.dtb |
805 | $(call cmd,copy) | 811 | $(call cmd,copy) |
806 | 812 | ||
807 | OBJCOPYFLAGS_u-boot.hex := -O ihex | 813 | OBJCOPYFLAGS_u-boot.hex := -O ihex |
808 | 814 | ||
809 | OBJCOPYFLAGS_u-boot.srec := -O srec | 815 | OBJCOPYFLAGS_u-boot.srec := -O srec |
810 | 816 | ||
811 | u-boot.hex u-boot.srec: u-boot FORCE | 817 | u-boot.hex u-boot.srec: u-boot FORCE |
812 | $(call if_changed,objcopy) | 818 | $(call if_changed,objcopy) |
813 | 819 | ||
814 | OBJCOPYFLAGS_u-boot.bin := -O binary | 820 | OBJCOPYFLAGS_u-boot.bin := -O binary |
815 | 821 | ||
816 | binary_size_check: u-boot.bin FORCE | 822 | binary_size_check: u-boot.bin FORCE |
817 | @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \ | 823 | @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \ |
818 | map_size=$(shell cat u-boot.map | \ | 824 | map_size=$(shell cat u-boot.map | \ |
819 | awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \ | 825 | awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \ |
820 | | sed 's/0X//g' \ | 826 | | sed 's/0X//g' \ |
821 | | bc); \ | 827 | | bc); \ |
822 | if [ "" != "$$map_size" ]; then \ | 828 | if [ "" != "$$map_size" ]; then \ |
823 | if test $$map_size -ne $$file_size; then \ | 829 | if test $$map_size -ne $$file_size; then \ |
824 | echo "u-boot.map shows a binary size of $$map_size" >&2 ; \ | 830 | echo "u-boot.map shows a binary size of $$map_size" >&2 ; \ |
825 | echo " but u-boot.bin shows $$file_size" >&2 ; \ | 831 | echo " but u-boot.bin shows $$file_size" >&2 ; \ |
826 | exit 1; \ | 832 | exit 1; \ |
827 | fi \ | 833 | fi \ |
828 | fi | 834 | fi |
829 | 835 | ||
830 | u-boot.bin: u-boot FORCE | 836 | u-boot.bin: u-boot FORCE |
831 | $(call if_changed,objcopy) | 837 | $(call if_changed,objcopy) |
832 | $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) | 838 | $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) |
833 | $(BOARD_SIZE_CHECK) | 839 | $(BOARD_SIZE_CHECK) |
834 | 840 | ||
835 | u-boot.ldr: u-boot | 841 | u-boot.ldr: u-boot |
836 | $(CREATE_LDR_ENV) | 842 | $(CREATE_LDR_ENV) |
837 | $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) | 843 | $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) |
838 | $(BOARD_SIZE_CHECK) | 844 | $(BOARD_SIZE_CHECK) |
839 | 845 | ||
840 | OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex | 846 | OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex |
841 | 847 | ||
842 | OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec | 848 | OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec |
843 | 849 | ||
844 | u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE | 850 | u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE |
845 | $(call if_changed,objcopy) | 851 | $(call if_changed,objcopy) |
846 | 852 | ||
847 | # | 853 | # |
848 | # U-Boot entry point, needed for booting of full-blown U-Boot | 854 | # U-Boot entry point, needed for booting of full-blown U-Boot |
849 | # from the SPL U-Boot version. | 855 | # from the SPL U-Boot version. |
850 | # | 856 | # |
851 | ifndef CONFIG_SYS_UBOOT_START | 857 | ifndef CONFIG_SYS_UBOOT_START |
852 | CONFIG_SYS_UBOOT_START := 0 | 858 | CONFIG_SYS_UBOOT_START := 0 |
853 | endif | 859 | endif |
854 | 860 | ||
855 | MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ | 861 | MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ |
856 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ | 862 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
857 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" | 863 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" |
858 | 864 | ||
859 | MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ | 865 | MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ |
860 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) | 866 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) |
861 | 867 | ||
862 | MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ | 868 | MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ |
863 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage | 869 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage |
864 | 870 | ||
865 | u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE | 871 | u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE |
866 | $(call if_changed,mkimage) | 872 | $(call if_changed,mkimage) |
867 | 873 | ||
868 | MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) | 874 | MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) |
869 | 875 | ||
870 | u-boot-dtb.img: u-boot-dtb.bin FORCE | 876 | u-boot-dtb.img: u-boot-dtb.bin FORCE |
871 | $(call if_changed,mkimage) | 877 | $(call if_changed,mkimage) |
872 | 878 | ||
873 | u-boot.sha1: u-boot.bin | 879 | u-boot.sha1: u-boot.bin |
874 | tools/ubsha1 u-boot.bin | 880 | tools/ubsha1 u-boot.bin |
875 | 881 | ||
876 | u-boot.dis: u-boot | 882 | u-boot.dis: u-boot |
877 | $(OBJDUMP) -d $< > $@ | 883 | $(OBJDUMP) -d $< > $@ |
878 | 884 | ||
879 | ifdef CONFIG_TPL | 885 | ifdef CONFIG_TPL |
880 | SPL_PAYLOAD := tpl/u-boot-with-tpl.bin | 886 | SPL_PAYLOAD := tpl/u-boot-with-tpl.bin |
881 | else | 887 | else |
882 | SPL_PAYLOAD := u-boot.bin | 888 | SPL_PAYLOAD := u-boot.bin |
883 | endif | 889 | endif |
884 | 890 | ||
885 | OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ | 891 | OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ |
886 | --pad-to=$(CONFIG_SPL_PAD_TO) | 892 | --pad-to=$(CONFIG_SPL_PAD_TO) |
887 | u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE | 893 | u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE |
888 | $(call if_changed,pad_cat) | 894 | $(call if_changed,pad_cat) |
889 | 895 | ||
890 | OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \ | 896 | OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \ |
891 | --pad-to=$(CONFIG_TPL_PAD_TO) | 897 | --pad-to=$(CONFIG_TPL_PAD_TO) |
892 | tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE | 898 | tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE |
893 | $(call if_changed,pad_cat) | 899 | $(call if_changed,pad_cat) |
894 | 900 | ||
895 | SPL: spl/u-boot-spl.bin FORCE | 901 | SPL: spl/u-boot-spl.bin FORCE |
896 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 902 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
897 | 903 | ||
898 | u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE | 904 | u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE |
899 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 905 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
900 | 906 | ||
901 | MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE) | 907 | MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE) |
902 | 908 | ||
903 | u-boot.ubl: u-boot-with-spl.bin FORCE | 909 | u-boot.ubl: u-boot-with-spl.bin FORCE |
904 | $(call if_changed,mkimage) | 910 | $(call if_changed,mkimage) |
905 | 911 | ||
906 | MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \ | 912 | MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \ |
907 | $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \ | 913 | $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \ |
908 | -T aisimage -e $(CONFIG_SPL_TEXT_BASE) | 914 | -T aisimage -e $(CONFIG_SPL_TEXT_BASE) |
909 | spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE | 915 | spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE |
910 | $(call if_changed,mkimage) | 916 | $(call if_changed,mkimage) |
911 | 917 | ||
912 | OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | 918 | OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) |
913 | u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE | 919 | u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE |
914 | $(call if_changed,pad_cat) | 920 | $(call if_changed,pad_cat) |
915 | 921 | ||
916 | u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin | 922 | u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin |
917 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb | 923 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb |
918 | u-boot.sb: u-boot.bin spl/u-boot-spl.bin | 924 | u-boot.sb: u-boot.bin spl/u-boot-spl.bin |
919 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb | 925 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb |
920 | 926 | ||
921 | # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. | 927 | # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. |
922 | # Both images are created using mkimage (crc etc), so that the ROM | 928 | # Both images are created using mkimage (crc etc), so that the ROM |
923 | # bootloader can check its integrity. Padding needs to be done to the | 929 | # bootloader can check its integrity. Padding needs to be done to the |
924 | # SPL image (with mkimage header) and not the binary. Otherwise the resulting image | 930 | # SPL image (with mkimage header) and not the binary. Otherwise the resulting image |
925 | # which is loaded/copied by the ROM bootloader to SRAM doesn't fit. | 931 | # which is loaded/copied by the ROM bootloader to SRAM doesn't fit. |
926 | # The resulting image containing both U-Boot images is called u-boot.spr | 932 | # The resulting image containing both U-Boot images is called u-boot.spr |
927 | MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \ | 933 | MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \ |
928 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER | 934 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER |
929 | spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE | 935 | spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE |
930 | $(call if_changed,mkimage) | 936 | $(call if_changed,mkimage) |
931 | 937 | ||
932 | OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ | 938 | OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ |
933 | --gap-fill=0xff | 939 | --gap-fill=0xff |
934 | u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE | 940 | u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE |
935 | $(call if_changed,pad_cat) | 941 | $(call if_changed,pad_cat) |
936 | 942 | ||
937 | MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ | 943 | MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ |
938 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL | 944 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL |
939 | spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE | 945 | spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE |
940 | $(call if_changed,mkimage) | 946 | $(call if_changed,mkimage) |
941 | 947 | ||
942 | OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ | 948 | OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ |
943 | --gap-fill=0 | 949 | --gap-fill=0 |
944 | u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE | 950 | u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE |
945 | $(call if_changed,pad_cat) | 951 | $(call if_changed,pad_cat) |
946 | 952 | ||
947 | MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \ | 953 | MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \ |
948 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot | 954 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot |
949 | u-boot-nand.gph: u-boot.bin FORCE | 955 | u-boot-nand.gph: u-boot.bin FORCE |
950 | $(call if_changed,mkimage) | 956 | $(call if_changed,mkimage) |
951 | @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@ | 957 | @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@ |
952 | 958 | ||
953 | ifneq ($(CONFIG_SUNXI),) | 959 | ifneq ($(CONFIG_SUNXI),) |
954 | OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ | 960 | OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ |
955 | --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff | 961 | --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff |
956 | u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \ | 962 | u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \ |
957 | u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE | 963 | u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE |
958 | $(call if_changed,pad_cat) | 964 | $(call if_changed,pad_cat) |
959 | endif | 965 | endif |
960 | 966 | ||
961 | ifneq ($(CONFIG_TEGRA),) | 967 | ifneq ($(CONFIG_TEGRA),) |
962 | OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) | 968 | OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) |
963 | u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE | 969 | u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE |
964 | $(call if_changed,pad_cat) | 970 | $(call if_changed,pad_cat) |
965 | 971 | ||
966 | ifeq ($(CONFIG_OF_SEPARATE),y) | 972 | ifeq ($(CONFIG_OF_SEPARATE),y) |
967 | u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE | 973 | u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE |
968 | $(call if_changed,cat) | 974 | $(call if_changed,cat) |
969 | endif | 975 | endif |
970 | endif | 976 | endif |
971 | 977 | ||
972 | u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE | 978 | u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE |
973 | $(call if_changed,cat) | 979 | $(call if_changed,cat) |
974 | 980 | ||
975 | #Add a target to create boot binary having SPL binary in PBI format | 981 | #Add a target to create boot binary having SPL binary in PBI format |
976 | #concatenated with u-boot binary. It is need by PowerPC SoC having | 982 | #concatenated with u-boot binary. It is need by PowerPC SoC having |
977 | #internal SRAM <= 512KB. | 983 | #internal SRAM <= 512KB. |
978 | MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ | 984 | MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ |
979 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage | 985 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage |
980 | 986 | ||
981 | spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE | 987 | spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE |
982 | $(call if_changed,mkimage) | 988 | $(call if_changed,mkimage) |
983 | 989 | ||
984 | OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ | 990 | OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ |
985 | --gap-fill=0xff | 991 | --gap-fill=0xff |
986 | 992 | ||
987 | u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl u-boot.bin FORCE | 993 | u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl u-boot.bin FORCE |
988 | $(call if_changed,pad_cat) | 994 | $(call if_changed,pad_cat) |
989 | 995 | ||
990 | # PPC4xx needs the SPL at the end of the image, since the reset vector | 996 | # PPC4xx needs the SPL at the end of the image, since the reset vector |
991 | # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target | 997 | # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target |
992 | # and need to introduce a new build target with the full blown U-Boot | 998 | # and need to introduce a new build target with the full blown U-Boot |
993 | # at the start padded up to the start of the SPL image. And then concat | 999 | # at the start padded up to the start of the SPL image. And then concat |
994 | # the SPL image to the end. | 1000 | # the SPL image to the end. |
995 | 1001 | ||
996 | OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \ | 1002 | OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \ |
997 | --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff | 1003 | --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff |
998 | u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE | 1004 | u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE |
999 | $(call if_changed,pad_cat) | 1005 | $(call if_changed,pad_cat) |
1000 | 1006 | ||
1001 | # Create a new ELF from a raw binary file. This is useful for arm64 | 1007 | # Create a new ELF from a raw binary file. This is useful for arm64 |
1002 | # where static relocation needs to be performed on the raw binary, | 1008 | # where static relocation needs to be performed on the raw binary, |
1003 | # but certain simulators only accept an ELF file (but don't do the | 1009 | # but certain simulators only accept an ELF file (but don't do the |
1004 | # relocation). | 1010 | # relocation). |
1005 | # FIXME refactor dts/Makefile to share target/arch detection | 1011 | # FIXME refactor dts/Makefile to share target/arch detection |
1006 | u-boot.elf: u-boot.bin | 1012 | u-boot.elf: u-boot.bin |
1007 | @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ | 1013 | @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ |
1008 | $< u-boot-elf.o | 1014 | $< u-boot-elf.o |
1009 | @$(LD) u-boot-elf.o -o $@ \ | 1015 | @$(LD) u-boot-elf.o -o $@ \ |
1010 | --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ | 1016 | --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ |
1011 | -Ttext=$(CONFIG_SYS_TEXT_BASE) | 1017 | -Ttext=$(CONFIG_SYS_TEXT_BASE) |
1012 | 1018 | ||
1013 | # Rule to link u-boot | 1019 | # Rule to link u-boot |
1014 | # May be overridden by arch/$(ARCH)/config.mk | 1020 | # May be overridden by arch/$(ARCH)/config.mk |
1015 | quiet_cmd_u-boot__ ?= LD $@ | 1021 | quiet_cmd_u-boot__ ?= LD $@ |
1016 | cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ | 1022 | cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ |
1017 | -T u-boot.lds $(u-boot-init) \ | 1023 | -T u-boot.lds $(u-boot-init) \ |
1018 | --start-group $(u-boot-main) --end-group \ | 1024 | --start-group $(u-boot-main) --end-group \ |
1019 | $(PLATFORM_LIBS) -Map u-boot.map | 1025 | $(PLATFORM_LIBS) -Map u-boot.map |
1020 | 1026 | ||
1021 | quiet_cmd_smap = GEN common/system_map.o | 1027 | quiet_cmd_smap = GEN common/system_map.o |
1022 | cmd_smap = \ | 1028 | cmd_smap = \ |
1023 | smap=`$(call SYSTEM_MAP,u-boot) | \ | 1029 | smap=`$(call SYSTEM_MAP,u-boot) | \ |
1024 | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ | 1030 | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ |
1025 | $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \ | 1031 | $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \ |
1026 | -c $(srctree)/common/system_map.c -o common/system_map.o | 1032 | -c $(srctree)/common/system_map.c -o common/system_map.o |
1027 | 1033 | ||
1028 | u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds | 1034 | u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds |
1029 | $(call if_changed,u-boot__) | 1035 | $(call if_changed,u-boot__) |
1030 | ifeq ($(CONFIG_KALLSYMS),y) | 1036 | ifeq ($(CONFIG_KALLSYMS),y) |
1031 | $(call cmd,smap) | 1037 | $(call cmd,smap) |
1032 | $(call cmd,u-boot__) common/system_map.o | 1038 | $(call cmd,u-boot__) common/system_map.o |
1033 | endif | 1039 | endif |
1034 | 1040 | ||
1035 | # The actual objects are generated when descending, | 1041 | # The actual objects are generated when descending, |
1036 | # make sure no implicit rule kicks in | 1042 | # make sure no implicit rule kicks in |
1037 | $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; | 1043 | $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; |
1038 | 1044 | ||
1039 | # Handle descending into subdirectories listed in $(vmlinux-dirs) | 1045 | # Handle descending into subdirectories listed in $(vmlinux-dirs) |
1040 | # Preset locale variables to speed up the build process. Limit locale | 1046 | # Preset locale variables to speed up the build process. Limit locale |
1041 | # tweaks to this spot to avoid wrong language settings when running | 1047 | # tweaks to this spot to avoid wrong language settings when running |
1042 | # make menuconfig etc. | 1048 | # make menuconfig etc. |
1043 | # Error messages still appears in the original language | 1049 | # Error messages still appears in the original language |
1044 | 1050 | ||
1045 | PHONY += $(u-boot-dirs) | 1051 | PHONY += $(u-boot-dirs) |
1046 | $(u-boot-dirs): prepare scripts | 1052 | $(u-boot-dirs): prepare scripts |
1047 | $(Q)$(MAKE) $(build)=$@ | 1053 | $(Q)$(MAKE) $(build)=$@ |
1048 | 1054 | ||
1049 | tools: prepare | 1055 | tools: prepare |
1050 | # The "tools" are needed early | 1056 | # The "tools" are needed early |
1051 | $(filter-out tools, $(u-boot-dirs)): tools | 1057 | $(filter-out tools, $(u-boot-dirs)): tools |
1052 | # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC | 1058 | # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC |
1053 | # is "yes"), so compile examples after U-Boot is compiled. | 1059 | # is "yes"), so compile examples after U-Boot is compiled. |
1054 | examples: $(filter-out examples, $(u-boot-dirs)) | 1060 | examples: $(filter-out examples, $(u-boot-dirs)) |
1055 | 1061 | ||
1056 | define filechk_uboot.release | 1062 | define filechk_uboot.release |
1057 | echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" | 1063 | echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
1058 | endef | 1064 | endef |
1059 | 1065 | ||
1060 | # Store (new) UBOOTRELEASE string in include/config/uboot.release | 1066 | # Store (new) UBOOTRELEASE string in include/config/uboot.release |
1061 | include/config/uboot.release: include/config/auto.conf FORCE | 1067 | include/config/uboot.release: include/config/auto.conf FORCE |
1062 | $(call filechk,uboot.release) | 1068 | $(call filechk,uboot.release) |
1063 | 1069 | ||
1064 | 1070 | ||
1065 | # Things we need to do before we recursively start building the kernel | 1071 | # Things we need to do before we recursively start building the kernel |
1066 | # or the modules are listed in "prepare". | 1072 | # or the modules are listed in "prepare". |
1067 | # A multi level approach is used. prepareN is processed before prepareN-1. | 1073 | # A multi level approach is used. prepareN is processed before prepareN-1. |
1068 | # archprepare is used in arch Makefiles and when processed asm symlink, | 1074 | # archprepare is used in arch Makefiles and when processed asm symlink, |
1069 | # version.h and scripts_basic is processed / created. | 1075 | # version.h and scripts_basic is processed / created. |
1070 | 1076 | ||
1071 | # Listed in dependency order | 1077 | # Listed in dependency order |
1072 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | 1078 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 |
1073 | 1079 | ||
1074 | # prepare3 is used to check if we are building in a separate output directory, | 1080 | # prepare3 is used to check if we are building in a separate output directory, |
1075 | # and if so do: | 1081 | # and if so do: |
1076 | # 1) Check that make has not been executed in the kernel src $(srctree) | 1082 | # 1) Check that make has not been executed in the kernel src $(srctree) |
1077 | prepare3: include/config/uboot.release | 1083 | prepare3: include/config/uboot.release |
1078 | ifneq ($(KBUILD_SRC),) | 1084 | ifneq ($(KBUILD_SRC),) |
1079 | @$(kecho) ' Using $(srctree) as source for U-Boot' | 1085 | @$(kecho) ' Using $(srctree) as source for U-Boot' |
1080 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ | 1086 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
1081 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ | 1087 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ |
1082 | echo >&2 " in the '$(srctree)' directory.";\ | 1088 | echo >&2 " in the '$(srctree)' directory.";\ |
1083 | /bin/false; \ | 1089 | /bin/false; \ |
1084 | fi; | 1090 | fi; |
1085 | endif | 1091 | endif |
1086 | 1092 | ||
1087 | # prepare2 creates a makefile if using a separate output directory | 1093 | # prepare2 creates a makefile if using a separate output directory |
1088 | prepare2: prepare3 outputmakefile | 1094 | prepare2: prepare3 outputmakefile |
1089 | 1095 | ||
1090 | prepare1: prepare2 $(version_h) $(timestamp_h) \ | 1096 | prepare1: prepare2 $(version_h) $(timestamp_h) \ |
1091 | include/config/auto.conf | 1097 | include/config/auto.conf |
1092 | ifeq ($(__HAVE_ARCH_GENERIC_BOARD),) | 1098 | ifeq ($(__HAVE_ARCH_GENERIC_BOARD),) |
1093 | ifeq ($(CONFIG_SYS_GENERIC_BOARD),y) | 1099 | ifeq ($(CONFIG_SYS_GENERIC_BOARD),y) |
1094 | @echo >&2 " Your architecture does not support generic board." | 1100 | @echo >&2 " Your architecture does not support generic board." |
1095 | @echo >&2 " Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file." | 1101 | @echo >&2 " Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file." |
1096 | @/bin/false | 1102 | @/bin/false |
1097 | endif | 1103 | endif |
1098 | endif | 1104 | endif |
1099 | ifeq ($(wildcard $(LDSCRIPT)),) | 1105 | ifeq ($(wildcard $(LDSCRIPT)),) |
1100 | @echo >&2 " Could not find linker script." | 1106 | @echo >&2 " Could not find linker script." |
1101 | @/bin/false | 1107 | @/bin/false |
1102 | endif | 1108 | endif |
1103 | 1109 | ||
1104 | archprepare: prepare1 scripts_basic | 1110 | archprepare: prepare1 scripts_basic |
1105 | 1111 | ||
1106 | prepare0: archprepare FORCE | 1112 | prepare0: archprepare FORCE |
1107 | $(Q)$(MAKE) $(build)=. | 1113 | $(Q)$(MAKE) $(build)=. |
1108 | 1114 | ||
1109 | # All the preparing.. | 1115 | # All the preparing.. |
1110 | prepare: prepare0 | 1116 | prepare: prepare0 |
1111 | 1117 | ||
1112 | # Generate some files | 1118 | # Generate some files |
1113 | # --------------------------------------------------------------------------- | 1119 | # --------------------------------------------------------------------------- |
1114 | 1120 | ||
1115 | define filechk_version.h | 1121 | define filechk_version.h |
1116 | (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \ | 1122 | (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \ |
1117 | echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \ | 1123 | echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \ |
1118 | echo \#define CC_VERSION_STRING \"$$($(CC) --version | head -n 1)\"; \ | 1124 | echo \#define CC_VERSION_STRING \"$$($(CC) --version | head -n 1)\"; \ |
1119 | echo \#define LD_VERSION_STRING \"$$($(LD) --version | head -n 1)\"; ) | 1125 | echo \#define LD_VERSION_STRING \"$$($(LD) --version | head -n 1)\"; ) |
1120 | endef | 1126 | endef |
1121 | 1127 | ||
1122 | define filechk_timestamp.h | 1128 | define filechk_timestamp.h |
1123 | (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ | 1129 | (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ |
1124 | LC_ALL=C date +'#define U_BOOT_TIME "%T"') | 1130 | LC_ALL=C date +'#define U_BOOT_TIME "%T"') |
1125 | endef | 1131 | endef |
1126 | 1132 | ||
1127 | $(version_h): include/config/uboot.release FORCE | 1133 | $(version_h): include/config/uboot.release FORCE |
1128 | $(call filechk,version.h) | 1134 | $(call filechk,version.h) |
1129 | 1135 | ||
1130 | $(timestamp_h): $(srctree)/Makefile FORCE | 1136 | $(timestamp_h): $(srctree)/Makefile FORCE |
1131 | $(call filechk,timestamp.h) | 1137 | $(call filechk,timestamp.h) |
1132 | 1138 | ||
1133 | # --------------------------------------------------------------------------- | 1139 | # --------------------------------------------------------------------------- |
1134 | 1140 | ||
1135 | PHONY += depend dep | 1141 | PHONY += depend dep |
1136 | depend dep: | 1142 | depend dep: |
1137 | @echo '*** Warning: make $@ is unnecessary now.' | 1143 | @echo '*** Warning: make $@ is unnecessary now.' |
1138 | 1144 | ||
1139 | # --------------------------------------------------------------------------- | 1145 | # --------------------------------------------------------------------------- |
1140 | quiet_cmd_cpp_lds = LDS $@ | 1146 | quiet_cmd_cpp_lds = LDS $@ |
1141 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ | 1147 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ |
1142 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< | 1148 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< |
1143 | 1149 | ||
1144 | u-boot.lds: $(LDSCRIPT) prepare FORCE | 1150 | u-boot.lds: $(LDSCRIPT) prepare FORCE |
1145 | $(call if_changed_dep,cpp_lds) | 1151 | $(call if_changed_dep,cpp_lds) |
1146 | 1152 | ||
1147 | spl/u-boot-spl.bin: spl/u-boot-spl | 1153 | spl/u-boot-spl.bin: spl/u-boot-spl |
1148 | @: | 1154 | @: |
1149 | spl/u-boot-spl: tools prepare | 1155 | spl/u-boot-spl: tools prepare |
1150 | $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all | 1156 | $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all |
1151 | 1157 | ||
1152 | spl/sunxi-spl.bin: spl/u-boot-spl | 1158 | spl/sunxi-spl.bin: spl/u-boot-spl |
1153 | @: | 1159 | @: |
1154 | 1160 | ||
1155 | tpl/u-boot-tpl.bin: tools prepare | 1161 | tpl/u-boot-tpl.bin: tools prepare |
1156 | $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all | 1162 | $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all |
1157 | 1163 | ||
1158 | TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) | 1164 | TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) |
1159 | 1165 | ||
1160 | FIND := find | 1166 | FIND := find |
1161 | FINDFLAGS := -L | 1167 | FINDFLAGS := -L |
1162 | 1168 | ||
1163 | tags ctags: | 1169 | tags ctags: |
1164 | ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ | 1170 | ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
1165 | -name '*.[chS]' -print` | 1171 | -name '*.[chS]' -print` |
1166 | 1172 | ||
1167 | etags: | 1173 | etags: |
1168 | etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ | 1174 | etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
1169 | -name '*.[chS]' -print` | 1175 | -name '*.[chS]' -print` |
1170 | cscope: | 1176 | cscope: |
1171 | $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ | 1177 | $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ |
1172 | cscope.files | 1178 | cscope.files |
1173 | cscope -b -q -k | 1179 | cscope -b -q -k |
1174 | 1180 | ||
1175 | SYSTEM_MAP = \ | 1181 | SYSTEM_MAP = \ |
1176 | $(NM) $1 | \ | 1182 | $(NM) $1 | \ |
1177 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ | 1183 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ |
1178 | LC_ALL=C sort | 1184 | LC_ALL=C sort |
1179 | System.map: u-boot | 1185 | System.map: u-boot |
1180 | @$(call SYSTEM_MAP,$<) > $@ | 1186 | @$(call SYSTEM_MAP,$<) > $@ |
1181 | 1187 | ||
1182 | checkdtc: | 1188 | checkdtc: |
1183 | @if test $(call dtc-version) -lt 0104; then \ | 1189 | @if test $(call dtc-version) -lt 0104; then \ |
1184 | echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ | 1190 | echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ |
1185 | false; \ | 1191 | false; \ |
1186 | fi | 1192 | fi |
1187 | 1193 | ||
1188 | ######################################################################### | 1194 | ######################################################################### |
1189 | 1195 | ||
1190 | # ARM relocations should all be R_ARM_RELATIVE (32-bit) or | 1196 | # ARM relocations should all be R_ARM_RELATIVE (32-bit) or |
1191 | # R_AARCH64_RELATIVE (64-bit). | 1197 | # R_AARCH64_RELATIVE (64-bit). |
1192 | checkarmreloc: u-boot | 1198 | checkarmreloc: u-boot |
1193 | @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \ | 1199 | @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \ |
1194 | grep R_A | sort -u`"; \ | 1200 | grep R_A | sort -u`"; \ |
1195 | if test "$$RELOC" != "R_ARM_RELATIVE" -a \ | 1201 | if test "$$RELOC" != "R_ARM_RELATIVE" -a \ |
1196 | "$$RELOC" != "R_AARCH64_RELATIVE"; then \ | 1202 | "$$RELOC" != "R_AARCH64_RELATIVE"; then \ |
1197 | echo "$< contains unexpected relocations: $$RELOC"; \ | 1203 | echo "$< contains unexpected relocations: $$RELOC"; \ |
1198 | false; \ | 1204 | false; \ |
1199 | fi | 1205 | fi |
1200 | 1206 | ||
1201 | env: scripts_basic | 1207 | env: scripts_basic |
1202 | $(Q)$(MAKE) $(build)=tools/$@ | 1208 | $(Q)$(MAKE) $(build)=tools/$@ |
1203 | 1209 | ||
1204 | tools-only: scripts_basic $(version_h) $(timestamp_h) | 1210 | tools-only: scripts_basic $(version_h) $(timestamp_h) |
1205 | $(Q)$(MAKE) $(build)=tools | 1211 | $(Q)$(MAKE) $(build)=tools |
1206 | 1212 | ||
1207 | tools-all: export HOST_TOOLS_ALL=y | 1213 | tools-all: export HOST_TOOLS_ALL=y |
1208 | tools-all: env tools ; | 1214 | tools-all: env tools ; |
1209 | 1215 | ||
1210 | cross_tools: export CROSS_BUILD_TOOLS=y | 1216 | cross_tools: export CROSS_BUILD_TOOLS=y |
1211 | cross_tools: tools ; | 1217 | cross_tools: tools ; |
1212 | 1218 | ||
1213 | .PHONY : CHANGELOG | 1219 | .PHONY : CHANGELOG |
1214 | CHANGELOG: | 1220 | CHANGELOG: |
1215 | git log --no-merges U-Boot-1_1_5.. | \ | 1221 | git log --no-merges U-Boot-1_1_5.. | \ |
1216 | unexpand -a | sed -e 's/\s\s*$$//' > $@ | 1222 | unexpand -a | sed -e 's/\s\s*$$//' > $@ |
1217 | 1223 | ||
1218 | include/license.h: tools/bin2header COPYING | 1224 | include/license.h: tools/bin2header COPYING |
1219 | cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h | 1225 | cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h |
1220 | ######################################################################### | 1226 | ######################################################################### |
1221 | 1227 | ||
1222 | ### | 1228 | ### |
1223 | # Cleaning is done on three levels. | 1229 | # Cleaning is done on three levels. |
1224 | # make clean Delete most generated files | 1230 | # make clean Delete most generated files |
1225 | # Leave enough to build external modules | 1231 | # Leave enough to build external modules |
1226 | # make mrproper Delete the current configuration, and all generated files | 1232 | # make mrproper Delete the current configuration, and all generated files |
1227 | # make distclean Remove editor backup files, patch leftover files and the like | 1233 | # make distclean Remove editor backup files, patch leftover files and the like |
1228 | 1234 | ||
1229 | # Directories & files removed with 'make clean' | 1235 | # Directories & files removed with 'make clean' |
1230 | CLEAN_DIRS += $(MODVERDIR) \ | 1236 | CLEAN_DIRS += $(MODVERDIR) \ |
1231 | $(foreach d, spl tpl, $(patsubst %,$d/%, \ | 1237 | $(foreach d, spl tpl, $(patsubst %,$d/%, \ |
1232 | $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) | 1238 | $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) |
1233 | 1239 | ||
1234 | CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \ | 1240 | CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \ |
1235 | u-boot* MLO* SPL System.map | 1241 | u-boot* MLO* SPL System.map |
1236 | 1242 | ||
1237 | # Directories & files removed with 'make mrproper' | 1243 | # Directories & files removed with 'make mrproper' |
1238 | MRPROPER_DIRS += include/config include/generated spl tpl \ | 1244 | MRPROPER_DIRS += include/config include/generated spl tpl \ |
1239 | .tmp_objdiff | 1245 | .tmp_objdiff |
1240 | MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ | 1246 | MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ |
1241 | ctags etags TAGS cscope* GPATH GTAGS GRTAGS GSYMS | 1247 | ctags etags TAGS cscope* GPATH GTAGS GRTAGS GSYMS |
1242 | 1248 | ||
1243 | # clean - Delete most, but leave enough to build external modules | 1249 | # clean - Delete most, but leave enough to build external modules |
1244 | # | 1250 | # |
1245 | clean: rm-dirs := $(CLEAN_DIRS) | 1251 | clean: rm-dirs := $(CLEAN_DIRS) |
1246 | clean: rm-files := $(CLEAN_FILES) | 1252 | clean: rm-files := $(CLEAN_FILES) |
1247 | 1253 | ||
1248 | clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f)) | 1254 | clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f)) |
1249 | 1255 | ||
1250 | clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook) | 1256 | clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook) |
1251 | 1257 | ||
1252 | PHONY += $(clean-dirs) clean archclean | 1258 | PHONY += $(clean-dirs) clean archclean |
1253 | $(clean-dirs): | 1259 | $(clean-dirs): |
1254 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 1260 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1255 | 1261 | ||
1256 | # TODO: Do not use *.cfgtmp | 1262 | # TODO: Do not use *.cfgtmp |
1257 | clean: $(clean-dirs) | 1263 | clean: $(clean-dirs) |
1258 | $(call cmd,rmdirs) | 1264 | $(call cmd,rmdirs) |
1259 | $(call cmd,rmfiles) | 1265 | $(call cmd,rmfiles) |
1260 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ | 1266 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ |
1261 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1267 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1262 | -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ | 1268 | -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ |
1263 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1269 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
1264 | -o -name '*.symtypes' -o -name 'modules.order' \ | 1270 | -o -name '*.symtypes' -o -name 'modules.order' \ |
1265 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ | 1271 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ |
1266 | -o -name '*.gcno' \) -type f -print | xargs rm -f | 1272 | -o -name '*.gcno' \) -type f -print | xargs rm -f |
1267 | 1273 | ||
1268 | # mrproper - Delete all generated files, including .config | 1274 | # mrproper - Delete all generated files, including .config |
1269 | # | 1275 | # |
1270 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) | 1276 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) |
1271 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | 1277 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
1272 | mrproper-dirs := $(addprefix _mrproper_,scripts) | 1278 | mrproper-dirs := $(addprefix _mrproper_,scripts) |
1273 | 1279 | ||
1274 | PHONY += $(mrproper-dirs) mrproper archmrproper | 1280 | PHONY += $(mrproper-dirs) mrproper archmrproper |
1275 | $(mrproper-dirs): | 1281 | $(mrproper-dirs): |
1276 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) | 1282 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
1277 | 1283 | ||
1278 | mrproper: clean $(mrproper-dirs) | 1284 | mrproper: clean $(mrproper-dirs) |
1279 | $(call cmd,rmdirs) | 1285 | $(call cmd,rmdirs) |
1280 | $(call cmd,rmfiles) | 1286 | $(call cmd,rmfiles) |
1281 | @rm -f arch/*/include/asm/arch | 1287 | @rm -f arch/*/include/asm/arch |
1282 | 1288 | ||
1283 | # distclean | 1289 | # distclean |
1284 | # | 1290 | # |
1285 | PHONY += distclean | 1291 | PHONY += distclean |
1286 | 1292 | ||
1287 | distclean: mrproper | 1293 | distclean: mrproper |
1288 | @find $(srctree) $(RCS_FIND_IGNORE) \ | 1294 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
1289 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ | 1295 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ |
1290 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ | 1296 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ |
1291 | -o -name '.*.rej' -o -name '*%' -o -name 'core' \ | 1297 | -o -name '.*.rej' -o -name '*%' -o -name 'core' \ |
1292 | -o -name '*.pyc' \) \ | 1298 | -o -name '*.pyc' \) \ |
1293 | -type f -print | xargs rm -f | 1299 | -type f -print | xargs rm -f |
1294 | @rm -f boards.cfg | 1300 | @rm -f boards.cfg |
1295 | 1301 | ||
1296 | backup: | 1302 | backup: |
1297 | F=`basename $(srctree)` ; cd .. ; \ | 1303 | F=`basename $(srctree)` ; cd .. ; \ |
1298 | gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F | 1304 | gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F |
1299 | 1305 | ||
1300 | help: | 1306 | help: |
1301 | @echo 'Cleaning targets:' | 1307 | @echo 'Cleaning targets:' |
1302 | @echo ' clean - Remove most generated files but keep the config' | 1308 | @echo ' clean - Remove most generated files but keep the config' |
1303 | @echo ' mrproper - Remove all generated files + config + various backup files' | 1309 | @echo ' mrproper - Remove all generated files + config + various backup files' |
1304 | @echo ' distclean - mrproper + remove editor backup and patch files' | 1310 | @echo ' distclean - mrproper + remove editor backup and patch files' |
1305 | @echo '' | 1311 | @echo '' |
1306 | @echo 'Configuration targets:' | 1312 | @echo 'Configuration targets:' |
1307 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help | 1313 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help |
1308 | @echo '' | 1314 | @echo '' |
1309 | @echo 'Other generic targets:' | 1315 | @echo 'Other generic targets:' |
1310 | @echo ' all - Build all necessary images depending on configuration' | 1316 | @echo ' all - Build all necessary images depending on configuration' |
1311 | @echo ' u-boot - Build the bare u-boot' | 1317 | @echo '* u-boot - Build the bare u-boot' |
1312 | @echo ' dir/ - Build all files in dir and below' | 1318 | @echo ' dir/ - Build all files in dir and below' |
1313 | @echo ' dir/file.[oisS] - Build specified target only' | 1319 | @echo ' dir/file.[oisS] - Build specified target only' |
1314 | @echo ' dir/file.lst - Build specified mixed source/assembly target only' | 1320 | @echo ' dir/file.lst - Build specified mixed source/assembly target only' |
1315 | @echo ' (requires a recent binutils and recent build (System.map))' | 1321 | @echo ' (requires a recent binutils and recent build (System.map))' |
1316 | @echo ' tags/ctags - Generate ctags file for editors' | 1322 | @echo ' tags/ctags - Generate ctags file for editors' |
1317 | @echo ' etags - Generate etags file for editors' | 1323 | @echo ' etags - Generate etags file for editors' |
1318 | @echo ' cscope - Generate cscope index' | 1324 | @echo ' cscope - Generate cscope index' |
1319 | @echo ' ubootrelease - Output the release version string' | 1325 | @echo ' ubootrelease - Output the release version string (use with make -s)' |
1320 | @echo ' ubootversion - Output the version stored in Makefile' | 1326 | @echo ' ubootversion - Output the version stored in Makefile (use with make -s)' |
1321 | @echo '' | 1327 | @echo '' |
1322 | @echo 'Static analysers' | 1328 | @echo 'Static analysers' |
1323 | @echo ' checkstack - Generate a list of stack hogs' | 1329 | @echo ' checkstack - Generate a list of stack hogs' |
1324 | @echo '' | 1330 | @echo '' |
1325 | @echo 'Documentation targets:' | 1331 | @echo 'Documentation targets:' |
1326 | @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp | 1332 | @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp |
1327 | @echo '' | 1333 | @echo '' |
1328 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | 1334 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
1329 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' | 1335 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' |
1330 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | 1336 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
1331 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' | 1337 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' |
1332 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' | 1338 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
1333 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' | 1339 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' |
1334 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' | 1340 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' |
1335 | @echo ' 1: warnings which may be relevant and do not occur too often' | 1341 | @echo ' 1: warnings which may be relevant and do not occur too often' |
1336 | @echo ' 2: warnings which occur quite often but may still be relevant' | 1342 | @echo ' 2: warnings which occur quite often but may still be relevant' |
1337 | @echo ' 3: more obscure warnings, can most likely be ignored' | 1343 | @echo ' 3: more obscure warnings, can most likely be ignored' |
1338 | @echo ' Multiple levels can be combined with W=12 or W=123' | 1344 | @echo ' Multiple levels can be combined with W=12 or W=123' |
1339 | @echo '' | 1345 | @echo '' |
1340 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' | 1346 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' |
1341 | @echo 'For further info see the ./README file' | 1347 | @echo 'For further info see the ./README file' |
1342 | 1348 | ||
1343 | 1349 | ||
1344 | # Documentation targets | 1350 | # Documentation targets |
1345 | # --------------------------------------------------------------------------- | 1351 | # --------------------------------------------------------------------------- |
1346 | %docs: scripts_basic FORCE | 1352 | %docs: scripts_basic FORCE |
1347 | $(Q)$(MAKE) $(build)=scripts build_docproc | 1353 | $(Q)$(MAKE) $(build)=scripts build_docproc |
1348 | $(Q)$(MAKE) $(build)=doc/DocBook $@ | 1354 | $(Q)$(MAKE) $(build)=doc/DocBook $@ |
1349 | 1355 | ||
1350 | # Dummies... | 1356 | # Dummies... |
1351 | PHONY += prepare scripts | 1357 | PHONY += prepare scripts |
1352 | prepare: ; | 1358 | prepare: ; |
1353 | scripts: ; | 1359 | scripts: ; |
1354 | 1360 | ||
1355 | endif #ifeq ($(config-targets),1) | 1361 | endif #ifeq ($(config-targets),1) |
1356 | endif #ifeq ($(mixed-targets),1) | 1362 | endif #ifeq ($(mixed-targets),1) |
1357 | 1363 | ||
1358 | PHONY += checkstack ubootrelease ubootversion | 1364 | PHONY += checkstack ubootrelease ubootversion |
1359 | 1365 | ||
1360 | checkstack: | 1366 | checkstack: |
1361 | $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \ | 1367 | $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \ |
1362 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | 1368 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) |
1363 | 1369 | ||
1364 | ubootrelease: | 1370 | ubootrelease: |
1365 | @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" | 1371 | @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
1366 | 1372 | ||
1367 | ubootversion: | 1373 | ubootversion: |
1368 | @echo $(UBOOTVERSION) | 1374 | @echo $(UBOOTVERSION) |
1369 | 1375 | ||
1370 | # Single targets | 1376 | # Single targets |
1371 | # --------------------------------------------------------------------------- | 1377 | # --------------------------------------------------------------------------- |
1372 | # Single targets are compatible with: | 1378 | # Single targets are compatible with: |
1373 | # - build with mixed source and output | 1379 | # - build with mixed source and output |
1374 | # - build with separate output dir 'make O=...' | 1380 | # - build with separate output dir 'make O=...' |
1375 | # - external modules | 1381 | # - external modules |
1376 | # | 1382 | # |
1377 | # target-dir => where to store outputfile | 1383 | # target-dir => where to store outputfile |
1378 | # build-dir => directory in kernel source tree to use | 1384 | # build-dir => directory in kernel source tree to use |
1379 | 1385 | ||
1380 | ifeq ($(KBUILD_EXTMOD),) | 1386 | ifeq ($(KBUILD_EXTMOD),) |
1381 | build-dir = $(patsubst %/,%,$(dir $@)) | 1387 | build-dir = $(patsubst %/,%,$(dir $@)) |
1382 | target-dir = $(dir $@) | 1388 | target-dir = $(dir $@) |
1383 | else | 1389 | else |
scripts/Makefile.autoconf
1 | # This helper makefile is used for creating | 1 | # This helper makefile is used for creating |
2 | # - symbolic links (arch/$ARCH/include/asm/arch | 2 | # - symbolic links (arch/$ARCH/include/asm/arch |
3 | # - include/autoconf.mk, {spl,tpl}/include/autoconf.mk | 3 | # - include/autoconf.mk, {spl,tpl}/include/autoconf.mk |
4 | # - include/config.h | 4 | # - include/config.h |
5 | # | 5 | # |
6 | # When our migration to Kconfig is done | 6 | # When our migration to Kconfig is done |
7 | # (= When we move all CONFIGs from header files to Kconfig) | 7 | # (= When we move all CONFIGs from header files to Kconfig) |
8 | # this makefile can be deleted. | 8 | # this makefile can be deleted. |
9 | 9 | ||
10 | # obj is "include" or "spl/include" or "tpl/include" | 10 | # obj is "include" or "spl/include" or "tpl/include" |
11 | # for non-SPL, SPL, TPL, respectively | 11 | # for non-SPL, SPL, TPL, respectively |
12 | include $(obj)/config/auto.conf | 12 | include $(obj)/config/auto.conf |
13 | 13 | ||
14 | include scripts/Kbuild.include | 14 | include scripts/Kbuild.include |
15 | 15 | ||
16 | # Need to define CC and CPP again here in case the top Makefile did not | 16 | # Need to define CC and CPP again here in case the top Makefile did not |
17 | # include config.mk. Some architectures expect CROSS_COMPILE to be defined | 17 | # include config.mk. Some architectures expect CROSS_COMPILE to be defined |
18 | # in arch/$(ARCH)/config.mk | 18 | # in arch/$(ARCH)/config.mk |
19 | CC = $(CROSS_COMPILE)gcc | 19 | CC = $(CROSS_COMPILE)gcc |
20 | CPP = $(CC) -E | 20 | CPP = $(CC) -E |
21 | 21 | ||
22 | include config.mk | 22 | include config.mk |
23 | 23 | ||
24 | UBOOTINCLUDE := \ | 24 | UBOOTINCLUDE := \ |
25 | -I$(obj) \ | 25 | -I$(obj) \ |
26 | -Iinclude \ | 26 | -Iinclude \ |
27 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ | 27 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ |
28 | -I$(srctree)/arch/$(ARCH)/include \ | 28 | -I$(srctree)/arch/$(ARCH)/include \ |
29 | -include $(srctree)/include/linux/kconfig.h | 29 | -include $(srctree)/include/linux/kconfig.h |
30 | 30 | ||
31 | c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \ | 31 | c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \ |
32 | $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) | 32 | $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) |
33 | 33 | ||
34 | quiet_cmd_autoconf_dep = GEN $@ | 34 | quiet_cmd_autoconf_dep = GEN $@ |
35 | cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \ | 35 | cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \ |
36 | -MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \ | 36 | -MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \ |
37 | rm $@; false; \ | 37 | rm $@; false; \ |
38 | } | 38 | } |
39 | include/autoconf.mk.dep: FORCE | 39 | include/autoconf.mk.dep: FORCE |
40 | $(call cmd,autoconf_dep) | 40 | $(call cmd,autoconf_dep) |
41 | 41 | ||
42 | # We are migrating from board headers to Kconfig little by little. | 42 | # We are migrating from board headers to Kconfig little by little. |
43 | # In the interim, we use both of | 43 | # In the interim, we use both of |
44 | # - include/config/auto.conf (generated by Kconfig) | 44 | # - include/config/auto.conf (generated by Kconfig) |
45 | # - include/autoconf.mk (used in the U-Boot conventional configuration) | 45 | # - include/autoconf.mk (used in the U-Boot conventional configuration) |
46 | # The following rule creates autoconf.mk | 46 | # The following rule creates autoconf.mk |
47 | # include/config/auto.conf is grepped in order to avoid duplication of the | 47 | # include/config/auto.conf is grepped in order to avoid duplication of the |
48 | # same CONFIG macros | 48 | # same CONFIG macros |
49 | quiet_cmd_autoconf = GEN $@ | 49 | quiet_cmd_autoconf = GEN $@ |
50 | cmd_autoconf = \ | 50 | cmd_autoconf = \ |
51 | $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \ | 51 | $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \ |
52 | sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp | \ | 52 | sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp | \ |
53 | while read line; do \ | 53 | while read line; do \ |
54 | if ! grep -q "$${line%=*}=" $(obj)/config/auto.conf; then \ | 54 | if ! grep -q "$${line%=*}=" $(obj)/config/auto.conf; then \ |
55 | echo "$$line"; \ | 55 | echo "$$line"; \ |
56 | fi \ | 56 | fi \ |
57 | done > $@; \ | 57 | done > $@; \ |
58 | rm $@.tmp; \ | 58 | rm $@.tmp; \ |
59 | } || { \ | 59 | } || { \ |
60 | rm $@.tmp; false; \ | 60 | rm $@.tmp; false; \ |
61 | } | 61 | } |
62 | 62 | ||
63 | $(obj)/autoconf.mk: FORCE | 63 | $(obj)/autoconf.mk: FORCE |
64 | $(call cmd,autoconf) | 64 | $(call cmd,autoconf) |
65 | 65 | ||
66 | include/autoconf.mk include/autoconf.mk.dep: include/config.h | 66 | include/autoconf.mk include/autoconf.mk.dep: include/config.h |
67 | 67 | ||
68 | # include/config.h | 68 | # include/config.h |
69 | # Prior to Kconfig, it was generated by mkconfig. Now it is created here. | 69 | # Prior to Kconfig, it was generated by mkconfig. Now it is created here. |
70 | define filechk_config_h | 70 | define filechk_config_h |
71 | (echo "/* Automatically generated - do not edit */"; \ | 71 | (echo "/* Automatically generated - do not edit */"; \ |
72 | for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \ | 72 | for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \ |
73 | echo \#define CONFIG_$$i \ | 73 | echo \#define CONFIG_$$i \ |
74 | | sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \ | 74 | | sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \ |
75 | done; \ | 75 | done; \ |
76 | echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\ | 76 | echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\ |
77 | echo \#include \<config_defaults.h\>; \ | 77 | echo \#include \<config_defaults.h\>; \ |
78 | echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \ | 78 | echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \ |
79 | echo \#include \<asm/config.h\>; \ | 79 | echo \#include \<asm/config.h\>; \ |
80 | echo \#include \<config_fallbacks.h\>; \ | 80 | echo \#include \<config_fallbacks.h\>; \ |
81 | echo \#include \<config_uncmd_spl.h\>; ) | 81 | echo \#include \<config_uncmd_spl.h\>; ) |
82 | endef | 82 | endef |
83 | 83 | ||
84 | include/config.h: scripts/Makefile.autoconf create_symlink FORCE | 84 | include/config.h: scripts/Makefile.autoconf create_symlink FORCE |
85 | $(call filechk,config_h) | 85 | $(call filechk,config_h) |
86 | 86 | ||
87 | # symbolic links | 87 | # symbolic links |
88 | PHONY += create_symlink | 88 | PHONY += create_symlink |
89 | create_symlink: | 89 | create_symlink: |
90 | ifneq ($(KBUILD_SRC),) | 90 | ifneq ($(KBUILD_SRC),) |
91 | $(Q)mkdir -p include/asm | 91 | $(Q)mkdir -p include/asm |
92 | $(Q)ln -fsn $(KBUILD_SRC)/arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)) \ | ||
93 | include/asm/arch | ||
94 | else | ||
95 | $(Q)ln -fsn arch-$(if $(SOC),$(SOC),$(CPU)) \ | ||
96 | arch/$(ARCH)/include/asm/arch | ||
92 | endif | 97 | endif |
93 | $(Q)ln -fsn $(srctree)/arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)) \ | ||
94 | $(if $(KBUILD_SRC),,arch/$(ARCH)/)include/asm/arch | ||
95 | 98 | ||
96 | PHONY += FORCE | 99 | PHONY += FORCE |
97 | FORCE: | 100 | FORCE: |
98 | 101 |
tools/Makefile
1 | # | 1 | # |
2 | # (C) Copyright 2000-2006 | 2 | # (C) Copyright 2000-2006 |
3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | # | 4 | # |
5 | # SPDX-License-Identifier: GPL-2.0+ | 5 | # SPDX-License-Identifier: GPL-2.0+ |
6 | # | 6 | # |
7 | 7 | ||
8 | # Enable all the config-independent tools | 8 | # Enable all the config-independent tools |
9 | ifneq ($(HOST_TOOLS_ALL),) | 9 | ifneq ($(HOST_TOOLS_ALL),) |
10 | CONFIG_LCD_LOGO = y | 10 | CONFIG_LCD_LOGO = y |
11 | CONFIG_CMD_LOADS = y | 11 | CONFIG_CMD_LOADS = y |
12 | CONFIG_CMD_NET = y | 12 | CONFIG_CMD_NET = y |
13 | CONFIG_XWAY_SWAP_BYTES = y | 13 | CONFIG_XWAY_SWAP_BYTES = y |
14 | CONFIG_NETCONSOLE = y | 14 | CONFIG_NETCONSOLE = y |
15 | CONFIG_SHA1_CHECK_UB_IMG = y | 15 | CONFIG_SHA1_CHECK_UB_IMG = y |
16 | endif | 16 | endif |
17 | 17 | ||
18 | subdir-$(HOST_TOOLS_ALL) += easylogo | 18 | subdir-$(HOST_TOOLS_ALL) += easylogo |
19 | subdir-$(HOST_TOOLS_ALL) += gdb | 19 | subdir-$(HOST_TOOLS_ALL) += gdb |
20 | 20 | ||
21 | # Merge all the different vars for envcrc into one | 21 | # Merge all the different vars for envcrc into one |
22 | ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y | 22 | ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y |
23 | ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y | 23 | ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y |
24 | ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y | 24 | ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y |
25 | ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | 25 | ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y |
26 | ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y | 26 | ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y |
27 | ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y | 27 | ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y |
28 | ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y | 28 | ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y |
29 | ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y | 29 | ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y |
30 | CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) | 30 | CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) |
31 | 31 | ||
32 | hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params | 32 | hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params |
33 | 33 | ||
34 | # TODO: CONFIG_CMD_LICENSE does not work | 34 | # TODO: CONFIG_CMD_LICENSE does not work |
35 | hostprogs-$(CONFIG_CMD_LICENSE) += bin2header | 35 | hostprogs-$(CONFIG_CMD_LICENSE) += bin2header |
36 | hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo | 36 | hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo |
37 | hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo | 37 | hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo |
38 | HOSTCFLAGS_bmp_logo.o := -pedantic | 38 | HOSTCFLAGS_bmp_logo.o := -pedantic |
39 | 39 | ||
40 | hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc | 40 | hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc |
41 | envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o | 41 | envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o |
42 | 42 | ||
43 | hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr | 43 | hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr |
44 | HOSTCFLAGS_gen_eth_addr.o := -pedantic | 44 | HOSTCFLAGS_gen_eth_addr.o := -pedantic |
45 | 45 | ||
46 | hostprogs-$(CONFIG_CMD_LOADS) += img2srec | 46 | hostprogs-$(CONFIG_CMD_LOADS) += img2srec |
47 | HOSTCFLAGS_img2srec.o := -pedantic | 47 | HOSTCFLAGS_img2srec.o := -pedantic |
48 | 48 | ||
49 | hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes | 49 | hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes |
50 | HOSTCFLAGS_xway-swap-bytes.o := -pedantic | 50 | HOSTCFLAGS_xway-swap-bytes.o := -pedantic |
51 | 51 | ||
52 | hostprogs-y += mkenvimage | 52 | hostprogs-y += mkenvimage |
53 | mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o | 53 | mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o |
54 | 54 | ||
55 | hostprogs-y += dumpimage mkimage | 55 | hostprogs-y += dumpimage mkimage |
56 | hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign | 56 | hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign |
57 | 57 | ||
58 | FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o | 58 | FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o |
59 | # Flattened device tree objects | 59 | # Flattened device tree objects |
60 | LIBFDT_OBJS := $(addprefix lib/libfdt/, \ | 60 | LIBFDT_OBJS := $(addprefix lib/libfdt/, \ |
61 | fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o) | 61 | fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o) |
62 | RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ | 62 | RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ |
63 | rsa-sign.o rsa-verify.o rsa-checksum.o) | 63 | rsa-sign.o rsa-verify.o rsa-checksum.o) |
64 | 64 | ||
65 | # common objs for dumpimage and mkimage | 65 | # common objs for dumpimage and mkimage |
66 | dumpimage-mkimage-objs := aisimage.o \ | 66 | dumpimage-mkimage-objs := aisimage.o \ |
67 | atmelimage.o \ | 67 | atmelimage.o \ |
68 | $(FIT_SIG_OBJS-y) \ | 68 | $(FIT_SIG_OBJS-y) \ |
69 | common/bootm.o \ | 69 | common/bootm.o \ |
70 | lib/crc32.o \ | 70 | lib/crc32.o \ |
71 | default_image.o \ | 71 | default_image.o \ |
72 | lib/fdtdec_common.o \ | 72 | lib/fdtdec_common.o \ |
73 | lib/fdtdec.o \ | 73 | lib/fdtdec.o \ |
74 | fit_common.o \ | 74 | fit_common.o \ |
75 | fit_image.o \ | 75 | fit_image.o \ |
76 | gpimage.o \ | 76 | gpimage.o \ |
77 | gpimage-common.o \ | 77 | gpimage-common.o \ |
78 | common/image-fit.o \ | 78 | common/image-fit.o \ |
79 | image-host.o \ | 79 | image-host.o \ |
80 | common/image.o \ | 80 | common/image.o \ |
81 | imagetool.o \ | 81 | imagetool.o \ |
82 | imximage.o \ | 82 | imximage.o \ |
83 | kwbimage.o \ | 83 | kwbimage.o \ |
84 | lib/md5.o \ | 84 | lib/md5.o \ |
85 | mxsimage.o \ | 85 | mxsimage.o \ |
86 | omapimage.o \ | 86 | omapimage.o \ |
87 | os_support.o \ | 87 | os_support.o \ |
88 | pblimage.o \ | 88 | pblimage.o \ |
89 | pbl_crc32.o \ | 89 | pbl_crc32.o \ |
90 | socfpgaimage.o \ | 90 | socfpgaimage.o \ |
91 | lib/sha1.o \ | 91 | lib/sha1.o \ |
92 | lib/sha256.o \ | 92 | lib/sha256.o \ |
93 | ublimage.o \ | 93 | ublimage.o \ |
94 | $(LIBFDT_OBJS) \ | 94 | $(LIBFDT_OBJS) \ |
95 | $(RSA_OBJS-y) | 95 | $(RSA_OBJS-y) |
96 | 96 | ||
97 | dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o | 97 | dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o |
98 | mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o | 98 | mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o |
99 | fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o | 99 | fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o |
100 | fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o | 100 | fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o |
101 | 101 | ||
102 | # TODO(sjg@chromium.org): Is this correct on Mac OS? | 102 | # TODO(sjg@chromium.org): Is this correct on Mac OS? |
103 | 103 | ||
104 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) | 104 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28),) |
105 | # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register | 105 | # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register |
106 | # the mxsimage support within tools/mxsimage.c . | 106 | # the mxsimage support within tools/mxsimage.c . |
107 | HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS | 107 | HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS |
108 | endif | 108 | endif |
109 | 109 | ||
110 | ifdef CONFIG_FIT_SIGNATURE | 110 | ifdef CONFIG_FIT_SIGNATURE |
111 | # This affects include/image.h, but including the board config file | 111 | # This affects include/image.h, but including the board config file |
112 | # is tricky, so manually define this options here. | 112 | # is tricky, so manually define this options here. |
113 | HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE | 113 | HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE |
114 | endif | 114 | endif |
115 | 115 | ||
116 | # MXSImage needs LibSSL | 116 | # MXSImage needs LibSSL |
117 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) | 117 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) |
118 | HOSTLOADLIBES_mkimage += -lssl -lcrypto | 118 | HOSTLOADLIBES_mkimage += -lssl -lcrypto |
119 | endif | 119 | endif |
120 | 120 | ||
121 | HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage) | 121 | HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage) |
122 | HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage) | 122 | HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage) |
123 | HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage) | 123 | HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage) |
124 | 124 | ||
125 | hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl | 125 | hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl |
126 | hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl | 126 | hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl |
127 | HOSTCFLAGS_mkexynosspl.o := -pedantic | 127 | HOSTCFLAGS_mkexynosspl.o := -pedantic |
128 | 128 | ||
129 | hostprogs-$(CONFIG_MX23) += mxsboot | 129 | hostprogs-$(CONFIG_MX23) += mxsboot |
130 | hostprogs-$(CONFIG_MX28) += mxsboot | 130 | hostprogs-$(CONFIG_MX28) += mxsboot |
131 | HOSTCFLAGS_mxsboot.o := -pedantic | 131 | HOSTCFLAGS_mxsboot.o := -pedantic |
132 | 132 | ||
133 | hostprogs-$(CONFIG_SUNXI) += mksunxiboot | 133 | hostprogs-$(CONFIG_SUNXI) += mksunxiboot |
134 | 134 | ||
135 | hostprogs-$(CONFIG_NETCONSOLE) += ncb | 135 | hostprogs-$(CONFIG_NETCONSOLE) += ncb |
136 | hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1 | 136 | hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1 |
137 | 137 | ||
138 | ubsha1-objs := os_support.o ubsha1.o lib/sha1.o | 138 | ubsha1-objs := os_support.o ubsha1.o lib/sha1.o |
139 | 139 | ||
140 | HOSTCFLAGS_ubsha1.o := -pedantic | 140 | HOSTCFLAGS_ubsha1.o := -pedantic |
141 | 141 | ||
142 | hostprogs-$(CONFIG_KIRKWOOD) += kwboot | 142 | hostprogs-$(CONFIG_KIRKWOOD) += kwboot |
143 | hostprogs-$(CONFIG_ARMADA_XP) += kwboot | 143 | hostprogs-$(CONFIG_ARMADA_XP) += kwboot |
144 | hostprogs-y += proftool | 144 | hostprogs-y += proftool |
145 | hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela | 145 | hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela |
146 | 146 | ||
147 | # We build some files with extra pedantic flags to try to minimize things | 147 | # We build some files with extra pedantic flags to try to minimize things |
148 | # that won't build on some weird host compiler -- though there are lots of | 148 | # that won't build on some weird host compiler -- though there are lots of |
149 | # exceptions for files that aren't complaint. | 149 | # exceptions for files that aren't complaint. |
150 | HOSTCFLAGS_crc32.o := -pedantic | 150 | HOSTCFLAGS_crc32.o := -pedantic |
151 | HOSTCFLAGS_md5.o := -pedantic | 151 | HOSTCFLAGS_md5.o := -pedantic |
152 | HOSTCFLAGS_sha1.o := -pedantic | 152 | HOSTCFLAGS_sha1.o := -pedantic |
153 | HOSTCFLAGS_sha256.o := -pedantic | 153 | HOSTCFLAGS_sha256.o := -pedantic |
154 | 154 | ||
155 | # Don't build by default | 155 | # Don't build by default |
156 | #hostprogs-$(CONFIG_PPC) += mpc86x_clk | 156 | #hostprogs-$(CONFIG_PPC) += mpc86x_clk |
157 | #HOSTCFLAGS_mpc86x_clk.o := -pedantic | 157 | #HOSTCFLAGS_mpc86x_clk.o := -pedantic |
158 | 158 | ||
159 | quiet_cmd_wrap = WRAP $@ | 159 | quiet_cmd_wrap = WRAP $@ |
160 | cmd_wrap = echo "\#include <$(srctree)/$(patsubst $(obj)/%,%,$@)>" >$@ | 160 | cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@ |
161 | 161 | ||
162 | $(obj)/lib/%.c $(obj)/common/%.c: | 162 | $(obj)/lib/%.c $(obj)/common/%.c: |
163 | $(call cmd,wrap) | 163 | $(call cmd,wrap) |
164 | 164 | ||
165 | clean-dirs := lib common | 165 | clean-dirs := lib common |
166 | 166 | ||
167 | always := $(hostprogs-y) | 167 | always := $(hostprogs-y) |
168 | 168 | ||
169 | # Generated LCD/video logo | 169 | # Generated LCD/video logo |
170 | LOGO_H = $(objtree)/include/bmp_logo.h | 170 | LOGO_H = $(objtree)/include/bmp_logo.h |
171 | LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h | 171 | LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h |
172 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H) | 172 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H) |
173 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H) | 173 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H) |
174 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H) | 174 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H) |
175 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H) | 175 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H) |
176 | 176 | ||
177 | # Generic logo | 177 | # Generic logo |
178 | ifeq ($(LOGO_BMP),) | 178 | ifeq ($(LOGO_BMP),) |
179 | LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp | 179 | LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp |
180 | 180 | ||
181 | # Use board logo and fallback to vendor | 181 | # Use board logo and fallback to vendor |
182 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),) | 182 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),) |
183 | LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp | 183 | LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp |
184 | else | 184 | else |
185 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),) | 185 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),) |
186 | LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp | 186 | LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp |
187 | endif | 187 | endif |
188 | endif | 188 | endif |
189 | 189 | ||
190 | endif # !LOGO_BMP | 190 | endif # !LOGO_BMP |
191 | 191 | ||
192 | # | 192 | # |
193 | # Use native tools and options | 193 | # Use native tools and options |
194 | # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps | 194 | # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps |
195 | # Define _GNU_SOURCE to obtain the getline prototype from stdio.h | 195 | # Define _GNU_SOURCE to obtain the getline prototype from stdio.h |
196 | # | 196 | # |
197 | HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ | 197 | HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ |
198 | $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ | 198 | $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ |
199 | -I$(srctree)/lib/libfdt \ | 199 | -I$(srctree)/lib/libfdt \ |
200 | -I$(srctree)/tools \ | 200 | -I$(srctree)/tools \ |
201 | -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ | 201 | -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ |
202 | -DUSE_HOSTCC \ | 202 | -DUSE_HOSTCC \ |
203 | -D__KERNEL_STRICT_NAMES \ | 203 | -D__KERNEL_STRICT_NAMES \ |
204 | -D_GNU_SOURCE | 204 | -D_GNU_SOURCE |
205 | 205 | ||
206 | __build: $(LOGO-y) | 206 | __build: $(LOGO-y) |
207 | 207 | ||
208 | $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) | 208 | $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) |
209 | $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ | 209 | $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ |
210 | 210 | ||
211 | $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) | 211 | $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) |
212 | $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@ | 212 | $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@ |
213 | 213 | ||
214 | # Let clean descend into subdirs | 214 | # Let clean descend into subdirs |
215 | subdir- += env | 215 | subdir- += env |
216 | 216 | ||
217 | ifneq ($(CROSS_BUILD_TOOLS),) | 217 | ifneq ($(CROSS_BUILD_TOOLS),) |
218 | HOSTCC = $(CC) | 218 | HOSTCC = $(CC) |
219 | 219 | ||
220 | quiet_cmd_crosstools_strip = STRIP $^ | 220 | quiet_cmd_crosstools_strip = STRIP $^ |
221 | cmd_crosstools_strip = $(STRIP) $^; touch $@ | 221 | cmd_crosstools_strip = $(STRIP) $^; touch $@ |
222 | $(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y))) | 222 | $(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y))) |
223 | $(call cmd,crosstools_strip) | 223 | $(call cmd,crosstools_strip) |
224 | 224 | ||
225 | always += .strip | 225 | always += .strip |
226 | endif | 226 | endif |
227 | clean-files += .strip | 227 | clean-files += .strip |
228 | 228 |