Commit 1f6a664802a4044779b9aebe03b9af6d2745de5f
Committed by
Stefano Babic
1 parent
3de6c7fc00
Exists in
v2017.01-smarct4x
and in
25 other branches
Makefile: preserve output for images that can contain HAB Blocks
To being able to sign created binaries, we need to know the HAB Blocks for that image. Especially for the imximage type the HAB Blocks are only available during creation of the image. We want to preserve the information until we get to sign the files. In the verbose case we still get them printed out instead of writing to log files. Cc: sbabic@denx.de v2-Changes: - No usage of MKIMAGEOUTPUT_$(@F) macro. - Predefine default value /dev/null in every involved Makefile. Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> Reviewed-by: George McCollister <george.mccollister@gmail.com> Tested-by: George McCollister <george.mccollister@gmail.com>
Showing 6 changed files with 17 additions and 5 deletions Inline Diff
.gitignore
1 | # | 1 | # |
2 | # NOTE! Don't add files that are generated in specific | 2 | # NOTE! Don't add files that are generated in specific |
3 | # subdirectories here. Add them in the ".gitignore" file | 3 | # subdirectories here. Add them in the ".gitignore" file |
4 | # in that subdirectory instead. | 4 | # in that subdirectory instead. |
5 | # | 5 | # |
6 | # Normal rules | 6 | # Normal rules |
7 | # | 7 | # |
8 | .* | 8 | .* |
9 | *.o | 9 | *.o |
10 | *.o.* | 10 | *.o.* |
11 | *.a | 11 | *.a |
12 | *.s | 12 | *.s |
13 | *.su | 13 | *.su |
14 | *.mod.c | 14 | *.mod.c |
15 | *.i | 15 | *.i |
16 | *.lst | 16 | *.lst |
17 | *.order | 17 | *.order |
18 | *.elf | 18 | *.elf |
19 | *.swp | 19 | *.swp |
20 | *.bin | 20 | *.bin |
21 | *.patch | 21 | *.patch |
22 | *.cfgtmp | 22 | *.cfgtmp |
23 | 23 | ||
24 | # host programs on Cygwin | 24 | # host programs on Cygwin |
25 | *.exe | 25 | *.exe |
26 | 26 | ||
27 | # Build tree | 27 | # Build tree |
28 | /build-* | 28 | /build-* |
29 | 29 | ||
30 | # | 30 | # |
31 | # Top-level generic files | 31 | # Top-level generic files |
32 | # | 32 | # |
33 | /MLO* | 33 | /MLO* |
34 | /SPL | 34 | /SPL* |
35 | /System.map | 35 | /System.map |
36 | /u-boot* | 36 | /u-boot* |
37 | /boards.cfg | 37 | /boards.cfg |
38 | 38 | ||
39 | # | 39 | # |
40 | # git files that we don't want to ignore even it they are dot-files | 40 | # git files that we don't want to ignore even it they are dot-files |
41 | # | 41 | # |
42 | !.gitignore | 42 | !.gitignore |
43 | !.mailmap | 43 | !.mailmap |
44 | 44 | ||
45 | # | 45 | # |
46 | # Generated files | 46 | # Generated files |
47 | # | 47 | # |
48 | /LOG | 48 | /LOG |
49 | /spl/ | 49 | /spl/ |
50 | /tpl/ | 50 | /tpl/ |
51 | /defconfig | 51 | /defconfig |
52 | 52 | ||
53 | # | 53 | # |
54 | # Generated include files | 54 | # Generated include files |
55 | # | 55 | # |
56 | /include/config/ | 56 | /include/config/ |
57 | /include/generated/ | 57 | /include/generated/ |
58 | 58 | ||
59 | # stgit generated dirs | 59 | # stgit generated dirs |
60 | patches-* | 60 | patches-* |
61 | .stgit-edit.txt | 61 | .stgit-edit.txt |
62 | 62 | ||
63 | # quilt's files | 63 | # quilt's files |
64 | patches | 64 | patches |
65 | series | 65 | series |
66 | 66 | ||
67 | # gdb files | 67 | # gdb files |
68 | .gdb_history | 68 | .gdb_history |
69 | 69 | ||
70 | # cscope files | 70 | # cscope files |
71 | cscope.* | 71 | cscope.* |
72 | 72 | ||
73 | # tags files | 73 | # tags files |
74 | /tags | 74 | /tags |
75 | /ctags | 75 | /ctags |
76 | /etags | 76 | /etags |
77 | 77 | ||
78 | # gnu global files | 78 | # gnu global files |
79 | GPATH | 79 | GPATH |
80 | GRTAGS | 80 | GRTAGS |
81 | GSYMS | 81 | GSYMS |
82 | GTAGS | 82 | GTAGS |
83 | 83 | ||
84 | *.orig | 84 | *.orig |
85 | *~ | 85 | *~ |
86 | \#*# | 86 | \#*# |
87 | 87 |
Makefile
1 | # | 1 | # |
2 | # SPDX-License-Identifier: GPL-2.0+ | 2 | # SPDX-License-Identifier: GPL-2.0+ |
3 | # | 3 | # |
4 | 4 | ||
5 | VERSION = 2017 | 5 | VERSION = 2017 |
6 | PATCHLEVEL = 01 | 6 | PATCHLEVEL = 01 |
7 | SUBLEVEL = | 7 | SUBLEVEL = |
8 | EXTRAVERSION = -rc2 | 8 | EXTRAVERSION = -rc2 |
9 | NAME = | 9 | NAME = |
10 | 10 | ||
11 | # *DOCUMENTATION* | 11 | # *DOCUMENTATION* |
12 | # To see a list of typical targets execute "make help" | 12 | # To see a list of typical targets execute "make help" |
13 | # More info can be located in ./README | 13 | # More info can be located in ./README |
14 | # Comments in this file are targeted only to the developer, do not | 14 | # Comments in this file are targeted only to the developer, do not |
15 | # expect to learn how to build the kernel reading this file. | 15 | # expect to learn how to build the kernel reading this file. |
16 | 16 | ||
17 | # o Do not use make's built-in rules and variables | 17 | # o Do not use make's built-in rules and variables |
18 | # (this increases performance and avoids hard-to-debug behaviour); | 18 | # (this increases performance and avoids hard-to-debug behaviour); |
19 | # o Look for make include files relative to root of kernel src | 19 | # o Look for make include files relative to root of kernel src |
20 | MAKEFLAGS += -rR --include-dir=$(CURDIR) | 20 | MAKEFLAGS += -rR --include-dir=$(CURDIR) |
21 | 21 | ||
22 | # Avoid funny character set dependencies | 22 | # Avoid funny character set dependencies |
23 | unexport LC_ALL | 23 | unexport LC_ALL |
24 | LC_COLLATE=C | 24 | LC_COLLATE=C |
25 | LC_NUMERIC=C | 25 | LC_NUMERIC=C |
26 | export LC_COLLATE LC_NUMERIC | 26 | export LC_COLLATE LC_NUMERIC |
27 | 27 | ||
28 | # Avoid interference with shell env settings | 28 | # Avoid interference with shell env settings |
29 | unexport GREP_OPTIONS | 29 | unexport GREP_OPTIONS |
30 | 30 | ||
31 | # We are using a recursive build, so we need to do a little thinking | 31 | # We are using a recursive build, so we need to do a little thinking |
32 | # to get the ordering right. | 32 | # to get the ordering right. |
33 | # | 33 | # |
34 | # Most importantly: sub-Makefiles should only ever modify files in | 34 | # Most importantly: sub-Makefiles should only ever modify files in |
35 | # their own directory. If in some directory we have a dependency on | 35 | # their own directory. If in some directory we have a dependency on |
36 | # a file in another dir (which doesn't happen often, but it's often | 36 | # a file in another dir (which doesn't happen often, but it's often |
37 | # unavoidable when linking the built-in.o targets which finally | 37 | # unavoidable when linking the built-in.o targets which finally |
38 | # turn into vmlinux), we will call a sub make in that other dir, and | 38 | # turn into vmlinux), we will call a sub make in that other dir, and |
39 | # after that we are sure that everything which is in that other dir | 39 | # after that we are sure that everything which is in that other dir |
40 | # is now up to date. | 40 | # is now up to date. |
41 | # | 41 | # |
42 | # The only cases where we need to modify files which have global | 42 | # The only cases where we need to modify files which have global |
43 | # effects are thus separated out and done before the recursive | 43 | # effects are thus separated out and done before the recursive |
44 | # descending is started. They are now explicitly listed as the | 44 | # descending is started. They are now explicitly listed as the |
45 | # prepare rule. | 45 | # prepare rule. |
46 | 46 | ||
47 | # Beautify output | 47 | # Beautify output |
48 | # --------------------------------------------------------------------------- | 48 | # --------------------------------------------------------------------------- |
49 | # | 49 | # |
50 | # Normally, we echo the whole command before executing it. By making | 50 | # Normally, we echo the whole command before executing it. By making |
51 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | 51 | # that echo $($(quiet)$(cmd)), we now have the possibility to set |
52 | # $(quiet) to choose other forms of output instead, e.g. | 52 | # $(quiet) to choose other forms of output instead, e.g. |
53 | # | 53 | # |
54 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | 54 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ |
55 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | 55 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< |
56 | # | 56 | # |
57 | # If $(quiet) is empty, the whole command will be printed. | 57 | # If $(quiet) is empty, the whole command will be printed. |
58 | # If it is set to "quiet_", only the short version will be printed. | 58 | # If it is set to "quiet_", only the short version will be printed. |
59 | # If it is set to "silent_", nothing will be printed at all, since | 59 | # If it is set to "silent_", nothing will be printed at all, since |
60 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | 60 | # the variable $(silent_cmd_cc_o_c) doesn't exist. |
61 | # | 61 | # |
62 | # A simple variant is to prefix commands with $(Q) - that's useful | 62 | # A simple variant is to prefix commands with $(Q) - that's useful |
63 | # for commands that shall be hidden in non-verbose mode. | 63 | # for commands that shall be hidden in non-verbose mode. |
64 | # | 64 | # |
65 | # $(Q)ln $@ :< | 65 | # $(Q)ln $@ :< |
66 | # | 66 | # |
67 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | 67 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. |
68 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | 68 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. |
69 | # | 69 | # |
70 | # To put more focus on warnings, be less verbose as default | 70 | # To put more focus on warnings, be less verbose as default |
71 | # Use 'make V=1' to see the full commands | 71 | # Use 'make V=1' to see the full commands |
72 | 72 | ||
73 | ifeq ("$(origin V)", "command line") | 73 | ifeq ("$(origin V)", "command line") |
74 | KBUILD_VERBOSE = $(V) | 74 | KBUILD_VERBOSE = $(V) |
75 | endif | 75 | endif |
76 | ifndef KBUILD_VERBOSE | 76 | ifndef KBUILD_VERBOSE |
77 | KBUILD_VERBOSE = 0 | 77 | KBUILD_VERBOSE = 0 |
78 | endif | 78 | endif |
79 | 79 | ||
80 | ifeq ($(KBUILD_VERBOSE),1) | 80 | ifeq ($(KBUILD_VERBOSE),1) |
81 | quiet = | 81 | quiet = |
82 | Q = | 82 | Q = |
83 | else | 83 | else |
84 | quiet=quiet_ | 84 | quiet=quiet_ |
85 | Q = @ | 85 | Q = @ |
86 | endif | 86 | endif |
87 | 87 | ||
88 | # If the user is running make -s (silent mode), suppress echoing of | 88 | # If the user is running make -s (silent mode), suppress echoing of |
89 | # commands | 89 | # commands |
90 | 90 | ||
91 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 | 91 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 |
92 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) | 92 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) |
93 | quiet=silent_ | 93 | quiet=silent_ |
94 | endif | 94 | endif |
95 | else # make-3.8x | 95 | else # make-3.8x |
96 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) | 96 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),) |
97 | quiet=silent_ | 97 | quiet=silent_ |
98 | endif | 98 | endif |
99 | endif | 99 | endif |
100 | 100 | ||
101 | export quiet Q KBUILD_VERBOSE | 101 | export quiet Q KBUILD_VERBOSE |
102 | 102 | ||
103 | # kbuild supports saving output files in a separate directory. | 103 | # kbuild supports saving output files in a separate directory. |
104 | # To locate output files in a separate directory two syntaxes are supported. | 104 | # To locate output files in a separate directory two syntaxes are supported. |
105 | # In both cases the working directory must be the root of the kernel src. | 105 | # In both cases the working directory must be the root of the kernel src. |
106 | # 1) O= | 106 | # 1) O= |
107 | # Use "make O=dir/to/store/output/files/" | 107 | # Use "make O=dir/to/store/output/files/" |
108 | # | 108 | # |
109 | # 2) Set KBUILD_OUTPUT | 109 | # 2) Set KBUILD_OUTPUT |
110 | # Set the environment variable KBUILD_OUTPUT to point to the directory | 110 | # Set the environment variable KBUILD_OUTPUT to point to the directory |
111 | # where the output files shall be placed. | 111 | # where the output files shall be placed. |
112 | # export KBUILD_OUTPUT=dir/to/store/output/files/ | 112 | # export KBUILD_OUTPUT=dir/to/store/output/files/ |
113 | # make | 113 | # make |
114 | # | 114 | # |
115 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment | 115 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment |
116 | # variable. | 116 | # variable. |
117 | 117 | ||
118 | # KBUILD_SRC is set on invocation of make in OBJ directory | 118 | # KBUILD_SRC is set on invocation of make in OBJ directory |
119 | # KBUILD_SRC is not intended to be used by the regular user (for now) | 119 | # KBUILD_SRC is not intended to be used by the regular user (for now) |
120 | ifeq ($(KBUILD_SRC),) | 120 | ifeq ($(KBUILD_SRC),) |
121 | 121 | ||
122 | # OK, Make called in directory where kernel src resides | 122 | # OK, Make called in directory where kernel src resides |
123 | # Do we want to locate output files in a separate directory? | 123 | # Do we want to locate output files in a separate directory? |
124 | ifeq ("$(origin O)", "command line") | 124 | ifeq ("$(origin O)", "command line") |
125 | KBUILD_OUTPUT := $(O) | 125 | KBUILD_OUTPUT := $(O) |
126 | endif | 126 | endif |
127 | 127 | ||
128 | # That's our default target when none is given on the command line | 128 | # That's our default target when none is given on the command line |
129 | PHONY := _all | 129 | PHONY := _all |
130 | _all: | 130 | _all: |
131 | 131 | ||
132 | # Cancel implicit rules on top Makefile | 132 | # Cancel implicit rules on top Makefile |
133 | $(CURDIR)/Makefile Makefile: ; | 133 | $(CURDIR)/Makefile Makefile: ; |
134 | 134 | ||
135 | ifneq ($(KBUILD_OUTPUT),) | 135 | ifneq ($(KBUILD_OUTPUT),) |
136 | # Invoke a second make in the output directory, passing relevant variables | 136 | # Invoke a second make in the output directory, passing relevant variables |
137 | # check that the output directory actually exists | 137 | # check that the output directory actually exists |
138 | saved-output := $(KBUILD_OUTPUT) | 138 | saved-output := $(KBUILD_OUTPUT) |
139 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ | 139 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ |
140 | && /bin/pwd) | 140 | && /bin/pwd) |
141 | $(if $(KBUILD_OUTPUT),, \ | 141 | $(if $(KBUILD_OUTPUT),, \ |
142 | $(error failed to create output directory "$(saved-output)")) | 142 | $(error failed to create output directory "$(saved-output)")) |
143 | 143 | ||
144 | PHONY += $(MAKECMDGOALS) sub-make | 144 | PHONY += $(MAKECMDGOALS) sub-make |
145 | 145 | ||
146 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make | 146 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make |
147 | @: | 147 | @: |
148 | 148 | ||
149 | sub-make: FORCE | 149 | sub-make: FORCE |
150 | $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ | 150 | $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ |
151 | -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) | 151 | -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) |
152 | 152 | ||
153 | # Leave processing to above invocation of make | 153 | # Leave processing to above invocation of make |
154 | skip-makefile := 1 | 154 | skip-makefile := 1 |
155 | endif # ifneq ($(KBUILD_OUTPUT),) | 155 | endif # ifneq ($(KBUILD_OUTPUT),) |
156 | endif # ifeq ($(KBUILD_SRC),) | 156 | endif # ifeq ($(KBUILD_SRC),) |
157 | 157 | ||
158 | # We process the rest of the Makefile if this is the final invocation of make | 158 | # We process the rest of the Makefile if this is the final invocation of make |
159 | ifeq ($(skip-makefile),) | 159 | ifeq ($(skip-makefile),) |
160 | 160 | ||
161 | # Do not print "Entering directory ...", | 161 | # Do not print "Entering directory ...", |
162 | # but we want to display it when entering to the output directory | 162 | # but we want to display it when entering to the output directory |
163 | # so that IDEs/editors are able to understand relative filenames. | 163 | # so that IDEs/editors are able to understand relative filenames. |
164 | MAKEFLAGS += --no-print-directory | 164 | MAKEFLAGS += --no-print-directory |
165 | 165 | ||
166 | # Call a source code checker (by default, "sparse") as part of the | 166 | # Call a source code checker (by default, "sparse") as part of the |
167 | # C compilation. | 167 | # C compilation. |
168 | # | 168 | # |
169 | # Use 'make C=1' to enable checking of only re-compiled files. | 169 | # Use 'make C=1' to enable checking of only re-compiled files. |
170 | # Use 'make C=2' to enable checking of *all* source files, regardless | 170 | # Use 'make C=2' to enable checking of *all* source files, regardless |
171 | # of whether they are re-compiled or not. | 171 | # of whether they are re-compiled or not. |
172 | # | 172 | # |
173 | # See the file "Documentation/sparse.txt" for more details, including | 173 | # See the file "Documentation/sparse.txt" for more details, including |
174 | # where to get the "sparse" utility. | 174 | # where to get the "sparse" utility. |
175 | 175 | ||
176 | ifeq ("$(origin C)", "command line") | 176 | ifeq ("$(origin C)", "command line") |
177 | KBUILD_CHECKSRC = $(C) | 177 | KBUILD_CHECKSRC = $(C) |
178 | endif | 178 | endif |
179 | ifndef KBUILD_CHECKSRC | 179 | ifndef KBUILD_CHECKSRC |
180 | KBUILD_CHECKSRC = 0 | 180 | KBUILD_CHECKSRC = 0 |
181 | endif | 181 | endif |
182 | 182 | ||
183 | # Use make M=dir to specify directory of external module to build | 183 | # Use make M=dir to specify directory of external module to build |
184 | # Old syntax make ... SUBDIRS=$PWD is still supported | 184 | # Old syntax make ... SUBDIRS=$PWD is still supported |
185 | # Setting the environment variable KBUILD_EXTMOD take precedence | 185 | # Setting the environment variable KBUILD_EXTMOD take precedence |
186 | ifdef SUBDIRS | 186 | ifdef SUBDIRS |
187 | KBUILD_EXTMOD ?= $(SUBDIRS) | 187 | KBUILD_EXTMOD ?= $(SUBDIRS) |
188 | endif | 188 | endif |
189 | 189 | ||
190 | ifeq ("$(origin M)", "command line") | 190 | ifeq ("$(origin M)", "command line") |
191 | KBUILD_EXTMOD := $(M) | 191 | KBUILD_EXTMOD := $(M) |
192 | endif | 192 | endif |
193 | 193 | ||
194 | # If building an external module we do not care about the all: rule | 194 | # If building an external module we do not care about the all: rule |
195 | # but instead _all depend on modules | 195 | # but instead _all depend on modules |
196 | PHONY += all | 196 | PHONY += all |
197 | ifeq ($(KBUILD_EXTMOD),) | 197 | ifeq ($(KBUILD_EXTMOD),) |
198 | _all: all | 198 | _all: all |
199 | else | 199 | else |
200 | _all: modules | 200 | _all: modules |
201 | endif | 201 | endif |
202 | 202 | ||
203 | ifeq ($(KBUILD_SRC),) | 203 | ifeq ($(KBUILD_SRC),) |
204 | # building in the source tree | 204 | # building in the source tree |
205 | srctree := . | 205 | srctree := . |
206 | else | 206 | else |
207 | ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) | 207 | ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) |
208 | # building in a subdirectory of the source tree | 208 | # building in a subdirectory of the source tree |
209 | srctree := .. | 209 | srctree := .. |
210 | else | 210 | else |
211 | srctree := $(KBUILD_SRC) | 211 | srctree := $(KBUILD_SRC) |
212 | endif | 212 | endif |
213 | endif | 213 | endif |
214 | objtree := . | 214 | objtree := . |
215 | src := $(srctree) | 215 | src := $(srctree) |
216 | obj := $(objtree) | 216 | obj := $(objtree) |
217 | 217 | ||
218 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) | 218 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) |
219 | 219 | ||
220 | export srctree objtree VPATH | 220 | export srctree objtree VPATH |
221 | 221 | ||
222 | # Make sure CDPATH settings don't interfere | 222 | # Make sure CDPATH settings don't interfere |
223 | unexport CDPATH | 223 | unexport CDPATH |
224 | 224 | ||
225 | ######################################################################### | 225 | ######################################################################### |
226 | 226 | ||
227 | HOSTARCH := $(shell uname -m | \ | 227 | HOSTARCH := $(shell uname -m | \ |
228 | sed -e s/i.86/x86/ \ | 228 | sed -e s/i.86/x86/ \ |
229 | -e s/sun4u/sparc64/ \ | 229 | -e s/sun4u/sparc64/ \ |
230 | -e s/arm.*/arm/ \ | 230 | -e s/arm.*/arm/ \ |
231 | -e s/sa110/arm/ \ | 231 | -e s/sa110/arm/ \ |
232 | -e s/ppc64/powerpc/ \ | 232 | -e s/ppc64/powerpc/ \ |
233 | -e s/ppc/powerpc/ \ | 233 | -e s/ppc/powerpc/ \ |
234 | -e s/macppc/powerpc/\ | 234 | -e s/macppc/powerpc/\ |
235 | -e s/sh.*/sh/) | 235 | -e s/sh.*/sh/) |
236 | 236 | ||
237 | HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ | 237 | HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ |
238 | sed -e 's/\(cygwin\).*/cygwin/') | 238 | sed -e 's/\(cygwin\).*/cygwin/') |
239 | 239 | ||
240 | export HOSTARCH HOSTOS | 240 | export HOSTARCH HOSTOS |
241 | 241 | ||
242 | ######################################################################### | 242 | ######################################################################### |
243 | 243 | ||
244 | # set default to nothing for native builds | 244 | # set default to nothing for native builds |
245 | ifeq ($(HOSTARCH),$(ARCH)) | 245 | ifeq ($(HOSTARCH),$(ARCH)) |
246 | CROSS_COMPILE ?= | 246 | CROSS_COMPILE ?= |
247 | endif | 247 | endif |
248 | 248 | ||
249 | KCONFIG_CONFIG ?= .config | 249 | KCONFIG_CONFIG ?= .config |
250 | export KCONFIG_CONFIG | 250 | export KCONFIG_CONFIG |
251 | 251 | ||
252 | # SHELL used by kbuild | 252 | # SHELL used by kbuild |
253 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | 253 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
254 | else if [ -x /bin/bash ]; then echo /bin/bash; \ | 254 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
255 | else echo sh; fi ; fi) | 255 | else echo sh; fi ; fi) |
256 | 256 | ||
257 | HOSTCC = cc | 257 | HOSTCC = cc |
258 | HOSTCXX = c++ | 258 | HOSTCXX = c++ |
259 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ | 259 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ |
260 | $(if $(CONFIG_TOOLS_DEBUG),-g) | 260 | $(if $(CONFIG_TOOLS_DEBUG),-g) |
261 | HOSTCXXFLAGS = -O2 | 261 | HOSTCXXFLAGS = -O2 |
262 | 262 | ||
263 | ifeq ($(HOSTOS),cygwin) | 263 | ifeq ($(HOSTOS),cygwin) |
264 | HOSTCFLAGS += -ansi | 264 | HOSTCFLAGS += -ansi |
265 | endif | 265 | endif |
266 | 266 | ||
267 | # Mac OS X / Darwin's C preprocessor is Apple specific. It | 267 | # Mac OS X / Darwin's C preprocessor is Apple specific. It |
268 | # generates numerous errors and warnings. We want to bypass it | 268 | # generates numerous errors and warnings. We want to bypass it |
269 | # and use GNU C's cpp. To do this we pass the -traditional-cpp | 269 | # and use GNU C's cpp. To do this we pass the -traditional-cpp |
270 | # option to the compiler. Note that the -traditional-cpp flag | 270 | # option to the compiler. Note that the -traditional-cpp flag |
271 | # DOES NOT have the same semantics as GNU C's flag, all it does | 271 | # DOES NOT have the same semantics as GNU C's flag, all it does |
272 | # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. | 272 | # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. |
273 | # | 273 | # |
274 | # Apple's linker is similar, thanks to the new 2 stage linking | 274 | # Apple's linker is similar, thanks to the new 2 stage linking |
275 | # multiple symbol definitions are treated as errors, hence the | 275 | # multiple symbol definitions are treated as errors, hence the |
276 | # -multiply_defined suppress option to turn off this error. | 276 | # -multiply_defined suppress option to turn off this error. |
277 | # | 277 | # |
278 | ifeq ($(HOSTOS),darwin) | 278 | ifeq ($(HOSTOS),darwin) |
279 | # get major and minor product version (e.g. '10' and '6' for Snow Leopard) | 279 | # get major and minor product version (e.g. '10' and '6' for Snow Leopard) |
280 | DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') | 280 | DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') |
281 | DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') | 281 | DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') |
282 | 282 | ||
283 | os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ | 283 | os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ |
284 | $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) | 284 | $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) |
285 | 285 | ||
286 | # Snow Leopards build environment has no longer restrictions as described above | 286 | # Snow Leopards build environment has no longer restrictions as described above |
287 | HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") | 287 | HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") |
288 | HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") | 288 | HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") |
289 | HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") | 289 | HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") |
290 | 290 | ||
291 | # since Lion (10.7) ASLR is on by default, but we use linker generated lists | 291 | # since Lion (10.7) ASLR is on by default, but we use linker generated lists |
292 | # in some host tools which is a problem then ... so disable ASLR for these | 292 | # in some host tools which is a problem then ... so disable ASLR for these |
293 | # tools | 293 | # tools |
294 | HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie") | 294 | HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie") |
295 | endif | 295 | endif |
296 | 296 | ||
297 | # Decide whether to build built-in, modular, or both. | 297 | # Decide whether to build built-in, modular, or both. |
298 | # Normally, just do built-in. | 298 | # Normally, just do built-in. |
299 | 299 | ||
300 | KBUILD_MODULES := | 300 | KBUILD_MODULES := |
301 | KBUILD_BUILTIN := 1 | 301 | KBUILD_BUILTIN := 1 |
302 | 302 | ||
303 | # If we have only "make modules", don't compile built-in objects. | 303 | # If we have only "make modules", don't compile built-in objects. |
304 | # When we're building modules with modversions, we need to consider | 304 | # When we're building modules with modversions, we need to consider |
305 | # the built-in objects during the descend as well, in order to | 305 | # the built-in objects during the descend as well, in order to |
306 | # make sure the checksums are up to date before we record them. | 306 | # make sure the checksums are up to date before we record them. |
307 | 307 | ||
308 | ifeq ($(MAKECMDGOALS),modules) | 308 | ifeq ($(MAKECMDGOALS),modules) |
309 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | 309 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) |
310 | endif | 310 | endif |
311 | 311 | ||
312 | # If we have "make <whatever> modules", compile modules | 312 | # If we have "make <whatever> modules", compile modules |
313 | # in addition to whatever we do anyway. | 313 | # in addition to whatever we do anyway. |
314 | # Just "make" or "make all" shall build modules as well | 314 | # Just "make" or "make all" shall build modules as well |
315 | 315 | ||
316 | # U-Boot does not need modules | 316 | # U-Boot does not need modules |
317 | #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | 317 | #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) |
318 | # KBUILD_MODULES := 1 | 318 | # KBUILD_MODULES := 1 |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | #ifeq ($(MAKECMDGOALS),) | 321 | #ifeq ($(MAKECMDGOALS),) |
322 | # KBUILD_MODULES := 1 | 322 | # KBUILD_MODULES := 1 |
323 | #endif | 323 | #endif |
324 | 324 | ||
325 | export KBUILD_MODULES KBUILD_BUILTIN | 325 | export KBUILD_MODULES KBUILD_BUILTIN |
326 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 326 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
327 | 327 | ||
328 | # We need some generic definitions (do not try to remake the file). | 328 | # We need some generic definitions (do not try to remake the file). |
329 | scripts/Kbuild.include: ; | 329 | scripts/Kbuild.include: ; |
330 | include scripts/Kbuild.include | 330 | include scripts/Kbuild.include |
331 | 331 | ||
332 | # Make variables (CC, etc...) | 332 | # Make variables (CC, etc...) |
333 | 333 | ||
334 | AS = $(CROSS_COMPILE)as | 334 | AS = $(CROSS_COMPILE)as |
335 | # Always use GNU ld | 335 | # Always use GNU ld |
336 | ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) | 336 | ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) |
337 | LD = $(CROSS_COMPILE)ld.bfd | 337 | LD = $(CROSS_COMPILE)ld.bfd |
338 | else | 338 | else |
339 | LD = $(CROSS_COMPILE)ld | 339 | LD = $(CROSS_COMPILE)ld |
340 | endif | 340 | endif |
341 | CC = $(CROSS_COMPILE)gcc | 341 | CC = $(CROSS_COMPILE)gcc |
342 | CPP = $(CC) -E | 342 | CPP = $(CC) -E |
343 | AR = $(CROSS_COMPILE)ar | 343 | AR = $(CROSS_COMPILE)ar |
344 | NM = $(CROSS_COMPILE)nm | 344 | NM = $(CROSS_COMPILE)nm |
345 | LDR = $(CROSS_COMPILE)ldr | 345 | LDR = $(CROSS_COMPILE)ldr |
346 | STRIP = $(CROSS_COMPILE)strip | 346 | STRIP = $(CROSS_COMPILE)strip |
347 | OBJCOPY = $(CROSS_COMPILE)objcopy | 347 | OBJCOPY = $(CROSS_COMPILE)objcopy |
348 | OBJDUMP = $(CROSS_COMPILE)objdump | 348 | OBJDUMP = $(CROSS_COMPILE)objdump |
349 | AWK = awk | 349 | AWK = awk |
350 | PERL = perl | 350 | PERL = perl |
351 | PYTHON = python | 351 | PYTHON = python |
352 | DTC = dtc | 352 | DTC = dtc |
353 | CHECK = sparse | 353 | CHECK = sparse |
354 | 354 | ||
355 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ | 355 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ |
356 | -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) | 356 | -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) |
357 | 357 | ||
358 | KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ | 358 | KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ |
359 | 359 | ||
360 | KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ | 360 | KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ |
361 | -Wno-format-security \ | 361 | -Wno-format-security \ |
362 | -fno-builtin -ffreestanding | 362 | -fno-builtin -ffreestanding |
363 | KBUILD_AFLAGS := -D__ASSEMBLY__ | 363 | KBUILD_AFLAGS := -D__ASSEMBLY__ |
364 | 364 | ||
365 | # Read UBOOTRELEASE from include/config/uboot.release (if it exists) | 365 | # Read UBOOTRELEASE from include/config/uboot.release (if it exists) |
366 | UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) | 366 | UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) |
367 | UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | 367 | UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) |
368 | 368 | ||
369 | export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION | 369 | export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION |
370 | export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR | 370 | export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR |
371 | export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC | 371 | export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC |
372 | export CPP AR NM LDR STRIP OBJCOPY OBJDUMP | 372 | export CPP AR NM LDR STRIP OBJCOPY OBJDUMP |
373 | export MAKE AWK PERL PYTHON | 373 | export MAKE AWK PERL PYTHON |
374 | export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS | 374 | export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS |
375 | 375 | ||
376 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS | 376 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS |
377 | export KBUILD_CFLAGS KBUILD_AFLAGS | 377 | export KBUILD_CFLAGS KBUILD_AFLAGS |
378 | 378 | ||
379 | # When compiling out-of-tree modules, put MODVERDIR in the module | 379 | # When compiling out-of-tree modules, put MODVERDIR in the module |
380 | # tree rather than in the kernel tree. The kernel tree might | 380 | # tree rather than in the kernel tree. The kernel tree might |
381 | # even be read-only. | 381 | # even be read-only. |
382 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions | 382 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions |
383 | 383 | ||
384 | # Files to ignore in find ... statements | 384 | # Files to ignore in find ... statements |
385 | 385 | ||
386 | export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ | 386 | export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ |
387 | -name CVS -o -name .pc -o -name .hg -o -name .git \) \ | 387 | -name CVS -o -name .pc -o -name .hg -o -name .git \) \ |
388 | -prune -o | 388 | -prune -o |
389 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ | 389 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ |
390 | --exclude CVS --exclude .pc --exclude .hg --exclude .git | 390 | --exclude CVS --exclude .pc --exclude .hg --exclude .git |
391 | 391 | ||
392 | # =========================================================================== | 392 | # =========================================================================== |
393 | # Rules shared between *config targets and build targets | 393 | # Rules shared between *config targets and build targets |
394 | 394 | ||
395 | # Basic helpers built in scripts/ | 395 | # Basic helpers built in scripts/ |
396 | PHONY += scripts_basic | 396 | PHONY += scripts_basic |
397 | scripts_basic: | 397 | scripts_basic: |
398 | $(Q)$(MAKE) $(build)=scripts/basic | 398 | $(Q)$(MAKE) $(build)=scripts/basic |
399 | $(Q)rm -f .tmp_quiet_recordmcount | 399 | $(Q)rm -f .tmp_quiet_recordmcount |
400 | 400 | ||
401 | # To avoid any implicit rule to kick in, define an empty command. | 401 | # To avoid any implicit rule to kick in, define an empty command. |
402 | scripts/basic/%: scripts_basic ; | 402 | scripts/basic/%: scripts_basic ; |
403 | 403 | ||
404 | PHONY += outputmakefile | 404 | PHONY += outputmakefile |
405 | # outputmakefile generates a Makefile in the output directory, if using a | 405 | # outputmakefile generates a Makefile in the output directory, if using a |
406 | # separate output directory. This allows convenient use of make in the | 406 | # separate output directory. This allows convenient use of make in the |
407 | # output directory. | 407 | # output directory. |
408 | outputmakefile: | 408 | outputmakefile: |
409 | ifneq ($(KBUILD_SRC),) | 409 | ifneq ($(KBUILD_SRC),) |
410 | $(Q)ln -fsn $(srctree) source | 410 | $(Q)ln -fsn $(srctree) source |
411 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ | 411 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ |
412 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 412 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
413 | endif | 413 | endif |
414 | 414 | ||
415 | # To make sure we do not include .config for any of the *config targets | 415 | # To make sure we do not include .config for any of the *config targets |
416 | # catch them early, and hand them over to scripts/kconfig/Makefile | 416 | # catch them early, and hand them over to scripts/kconfig/Makefile |
417 | # It is allowed to specify more targets when calling make, including | 417 | # It is allowed to specify more targets when calling make, including |
418 | # mixing *config targets and build targets. | 418 | # mixing *config targets and build targets. |
419 | # For example 'make oldconfig all'. | 419 | # For example 'make oldconfig all'. |
420 | # Detect when mixed targets is specified, and make a second invocation | 420 | # Detect when mixed targets is specified, and make a second invocation |
421 | # of make so .config is not included in this case either (for *config). | 421 | # of make so .config is not included in this case either (for *config). |
422 | 422 | ||
423 | version_h := include/generated/version_autogenerated.h | 423 | version_h := include/generated/version_autogenerated.h |
424 | timestamp_h := include/generated/timestamp_autogenerated.h | 424 | timestamp_h := include/generated/timestamp_autogenerated.h |
425 | 425 | ||
426 | no-dot-config-targets := clean clobber mrproper distclean \ | 426 | no-dot-config-targets := clean clobber mrproper distclean \ |
427 | help %docs check% coccicheck \ | 427 | help %docs check% coccicheck \ |
428 | ubootversion backup tests | 428 | ubootversion backup tests |
429 | 429 | ||
430 | config-targets := 0 | 430 | config-targets := 0 |
431 | mixed-targets := 0 | 431 | mixed-targets := 0 |
432 | dot-config := 1 | 432 | dot-config := 1 |
433 | 433 | ||
434 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) | 434 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
435 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) | 435 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) |
436 | dot-config := 0 | 436 | dot-config := 0 |
437 | endif | 437 | endif |
438 | endif | 438 | endif |
439 | 439 | ||
440 | ifeq ($(KBUILD_EXTMOD),) | 440 | ifeq ($(KBUILD_EXTMOD),) |
441 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) | 441 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) |
442 | config-targets := 1 | 442 | config-targets := 1 |
443 | ifneq ($(words $(MAKECMDGOALS)),1) | 443 | ifneq ($(words $(MAKECMDGOALS)),1) |
444 | mixed-targets := 1 | 444 | mixed-targets := 1 |
445 | endif | 445 | endif |
446 | endif | 446 | endif |
447 | endif | 447 | endif |
448 | 448 | ||
449 | ifeq ($(mixed-targets),1) | 449 | ifeq ($(mixed-targets),1) |
450 | # =========================================================================== | 450 | # =========================================================================== |
451 | # We're called with mixed targets (*config and build targets). | 451 | # We're called with mixed targets (*config and build targets). |
452 | # Handle them one by one. | 452 | # Handle them one by one. |
453 | 453 | ||
454 | PHONY += $(MAKECMDGOALS) __build_one_by_one | 454 | PHONY += $(MAKECMDGOALS) __build_one_by_one |
455 | 455 | ||
456 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | 456 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one |
457 | @: | 457 | @: |
458 | 458 | ||
459 | __build_one_by_one: | 459 | __build_one_by_one: |
460 | $(Q)set -e; \ | 460 | $(Q)set -e; \ |
461 | for i in $(MAKECMDGOALS); do \ | 461 | for i in $(MAKECMDGOALS); do \ |
462 | $(MAKE) -f $(srctree)/Makefile $$i; \ | 462 | $(MAKE) -f $(srctree)/Makefile $$i; \ |
463 | done | 463 | done |
464 | 464 | ||
465 | else | 465 | else |
466 | ifeq ($(config-targets),1) | 466 | ifeq ($(config-targets),1) |
467 | # =========================================================================== | 467 | # =========================================================================== |
468 | # *config targets only - make sure prerequisites are updated, and descend | 468 | # *config targets only - make sure prerequisites are updated, and descend |
469 | # in scripts/kconfig to make the *config target | 469 | # in scripts/kconfig to make the *config target |
470 | 470 | ||
471 | KBUILD_DEFCONFIG := sandbox_defconfig | 471 | KBUILD_DEFCONFIG := sandbox_defconfig |
472 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 472 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
473 | 473 | ||
474 | config: scripts_basic outputmakefile FORCE | 474 | config: scripts_basic outputmakefile FORCE |
475 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 475 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
476 | 476 | ||
477 | %config: scripts_basic outputmakefile FORCE | 477 | %config: scripts_basic outputmakefile FORCE |
478 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 478 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
479 | 479 | ||
480 | else | 480 | else |
481 | # =========================================================================== | 481 | # =========================================================================== |
482 | # Build targets only - this includes vmlinux, arch specific targets, clean | 482 | # Build targets only - this includes vmlinux, arch specific targets, clean |
483 | # targets and others. In general all targets except *config targets. | 483 | # targets and others. In general all targets except *config targets. |
484 | 484 | ||
485 | ifeq ($(dot-config),1) | 485 | ifeq ($(dot-config),1) |
486 | # Read in config | 486 | # Read in config |
487 | -include include/config/auto.conf | 487 | -include include/config/auto.conf |
488 | 488 | ||
489 | # Read in dependencies to all Kconfig* files, make sure to run | 489 | # Read in dependencies to all Kconfig* files, make sure to run |
490 | # oldconfig if changes are detected. | 490 | # oldconfig if changes are detected. |
491 | -include include/config/auto.conf.cmd | 491 | -include include/config/auto.conf.cmd |
492 | 492 | ||
493 | # To avoid any implicit rule to kick in, define an empty command | 493 | # To avoid any implicit rule to kick in, define an empty command |
494 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; | 494 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
495 | 495 | ||
496 | # If .config is newer than include/config/auto.conf, someone tinkered | 496 | # If .config is newer than include/config/auto.conf, someone tinkered |
497 | # with it and forgot to run make oldconfig. | 497 | # with it and forgot to run make oldconfig. |
498 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so | 498 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so |
499 | # we execute the config step to be sure to catch updated Kconfig files | 499 | # we execute the config step to be sure to catch updated Kconfig files |
500 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd | 500 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
501 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 501 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
502 | @# If the following part fails, include/config/auto.conf should be | 502 | @# If the following part fails, include/config/auto.conf should be |
503 | @# deleted so "make silentoldconfig" will be re-run on the next build. | 503 | @# deleted so "make silentoldconfig" will be re-run on the next build. |
504 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \ | 504 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \ |
505 | { rm -f include/config/auto.conf; false; } | 505 | { rm -f include/config/auto.conf; false; } |
506 | @# include/config.h has been updated after "make silentoldconfig". | 506 | @# include/config.h has been updated after "make silentoldconfig". |
507 | @# We need to touch include/config/auto.conf so it gets newer | 507 | @# We need to touch include/config/auto.conf so it gets newer |
508 | @# than include/config.h. | 508 | @# than include/config.h. |
509 | @# Otherwise, 'make silentoldconfig' would be invoked twice. | 509 | @# Otherwise, 'make silentoldconfig' would be invoked twice. |
510 | $(Q)touch include/config/auto.conf | 510 | $(Q)touch include/config/auto.conf |
511 | 511 | ||
512 | -include include/autoconf.mk | 512 | -include include/autoconf.mk |
513 | -include include/autoconf.mk.dep | 513 | -include include/autoconf.mk.dep |
514 | 514 | ||
515 | # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf | 515 | # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf |
516 | # is up-to-date. When we switch to a different board configuration, old CONFIG | 516 | # is up-to-date. When we switch to a different board configuration, old CONFIG |
517 | # macros are still remaining in include/config/auto.conf. Without the following | 517 | # macros are still remaining in include/config/auto.conf. Without the following |
518 | # gimmick, wrong config.mk would be included leading nasty warnings/errors. | 518 | # gimmick, wrong config.mk would be included leading nasty warnings/errors. |
519 | ifneq ($(wildcard $(KCONFIG_CONFIG)),) | 519 | ifneq ($(wildcard $(KCONFIG_CONFIG)),) |
520 | ifneq ($(wildcard include/config/auto.conf),) | 520 | ifneq ($(wildcard include/config/auto.conf),) |
521 | autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \ | 521 | autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \ |
522 | include/config/auto.conf) | 522 | include/config/auto.conf) |
523 | ifeq ($(autoconf_is_old),) | 523 | ifeq ($(autoconf_is_old),) |
524 | include config.mk | 524 | include config.mk |
525 | include arch/$(ARCH)/Makefile | 525 | include arch/$(ARCH)/Makefile |
526 | endif | 526 | endif |
527 | endif | 527 | endif |
528 | endif | 528 | endif |
529 | 529 | ||
530 | # These are set by the arch-specific config.mk. Make sure they are exported | 530 | # These are set by the arch-specific config.mk. Make sure they are exported |
531 | # so they can be used when building an EFI application. | 531 | # so they can be used when building an EFI application. |
532 | export EFI_LDS # Filename of EFI link script in arch/$(ARCH)/lib | 532 | export EFI_LDS # Filename of EFI link script in arch/$(ARCH)/lib |
533 | export EFI_CRT0 # Filename of EFI CRT0 in arch/$(ARCH)/lib | 533 | export EFI_CRT0 # Filename of EFI CRT0 in arch/$(ARCH)/lib |
534 | export EFI_RELOC # Filename of EFU relocation code in arch/$(ARCH)/lib | 534 | export EFI_RELOC # Filename of EFU relocation code in arch/$(ARCH)/lib |
535 | export CFLAGS_EFI # Compiler flags to add when building EFI app | 535 | export CFLAGS_EFI # Compiler flags to add when building EFI app |
536 | export CFLAGS_NON_EFI # Compiler flags to remove when building EFI app | 536 | export CFLAGS_NON_EFI # Compiler flags to remove when building EFI app |
537 | export EFI_TARGET # binutils target if EFI is natively supported | 537 | export EFI_TARGET # binutils target if EFI is natively supported |
538 | 538 | ||
539 | # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use | 539 | # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use |
540 | # that (or fail if absent). Otherwise, search for a linker script in a | 540 | # that (or fail if absent). Otherwise, search for a linker script in a |
541 | # standard location. | 541 | # standard location. |
542 | 542 | ||
543 | ifndef LDSCRIPT | 543 | ifndef LDSCRIPT |
544 | #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug | 544 | #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug |
545 | ifdef CONFIG_SYS_LDSCRIPT | 545 | ifdef CONFIG_SYS_LDSCRIPT |
546 | # need to strip off double quotes | 546 | # need to strip off double quotes |
547 | LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%) | 547 | LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%) |
548 | endif | 548 | endif |
549 | endif | 549 | endif |
550 | 550 | ||
551 | # If there is no specified link script, we look in a number of places for it | 551 | # If there is no specified link script, we look in a number of places for it |
552 | ifndef LDSCRIPT | 552 | ifndef LDSCRIPT |
553 | ifeq ($(wildcard $(LDSCRIPT)),) | 553 | ifeq ($(wildcard $(LDSCRIPT)),) |
554 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds | 554 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds |
555 | endif | 555 | endif |
556 | ifeq ($(wildcard $(LDSCRIPT)),) | 556 | ifeq ($(wildcard $(LDSCRIPT)),) |
557 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds | 557 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds |
558 | endif | 558 | endif |
559 | ifeq ($(wildcard $(LDSCRIPT)),) | 559 | ifeq ($(wildcard $(LDSCRIPT)),) |
560 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds | 560 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds |
561 | endif | 561 | endif |
562 | endif | 562 | endif |
563 | 563 | ||
564 | else | 564 | else |
565 | # Dummy target needed, because used as prerequisite | 565 | # Dummy target needed, because used as prerequisite |
566 | include/config/auto.conf: ; | 566 | include/config/auto.conf: ; |
567 | endif # $(dot-config) | 567 | endif # $(dot-config) |
568 | 568 | ||
569 | # | 569 | # |
570 | # Xtensa linker script cannot be preprocessed with -ansi because of | 570 | # Xtensa linker script cannot be preprocessed with -ansi because of |
571 | # preprocessor operations on strings that don't make C identifiers. | 571 | # preprocessor operations on strings that don't make C identifiers. |
572 | # | 572 | # |
573 | ifeq ($(CONFIG_XTENSA),) | 573 | ifeq ($(CONFIG_XTENSA),) |
574 | LDPPFLAGS += -ansi | 574 | LDPPFLAGS += -ansi |
575 | endif | 575 | endif |
576 | 576 | ||
577 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 577 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
578 | KBUILD_CFLAGS += -Os | 578 | KBUILD_CFLAGS += -Os |
579 | else | 579 | else |
580 | KBUILD_CFLAGS += -O2 | 580 | KBUILD_CFLAGS += -O2 |
581 | endif | 581 | endif |
582 | 582 | ||
583 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) | 583 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) |
584 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks) | 584 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks) |
585 | 585 | ||
586 | KBUILD_CFLAGS += -g | 586 | KBUILD_CFLAGS += -g |
587 | # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format> | 587 | # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format> |
588 | # option to the assembler. | 588 | # option to the assembler. |
589 | KBUILD_AFLAGS += -g | 589 | KBUILD_AFLAGS += -g |
590 | 590 | ||
591 | # Report stack usage if supported | 591 | # Report stack usage if supported |
592 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y) | 592 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y) |
593 | KBUILD_CFLAGS += -fstack-usage | 593 | KBUILD_CFLAGS += -fstack-usage |
594 | endif | 594 | endif |
595 | 595 | ||
596 | KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) | 596 | KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) |
597 | 597 | ||
598 | # turn jbsr into jsr for m68k | 598 | # turn jbsr into jsr for m68k |
599 | ifeq ($(ARCH),m68k) | 599 | ifeq ($(ARCH),m68k) |
600 | ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) | 600 | ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) |
601 | KBUILD_AFLAGS += -Wa,-gstabs,-S | 601 | KBUILD_AFLAGS += -Wa,-gstabs,-S |
602 | endif | 602 | endif |
603 | endif | 603 | endif |
604 | 604 | ||
605 | # Prohibit date/time macros, which would make the build non-deterministic | 605 | # Prohibit date/time macros, which would make the build non-deterministic |
606 | KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) | 606 | KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) |
607 | 607 | ||
608 | include scripts/Makefile.extrawarn | 608 | include scripts/Makefile.extrawarn |
609 | 609 | ||
610 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | 610 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments |
611 | KBUILD_CPPFLAGS += $(KCPPFLAGS) | 611 | KBUILD_CPPFLAGS += $(KCPPFLAGS) |
612 | KBUILD_AFLAGS += $(KAFLAGS) | 612 | KBUILD_AFLAGS += $(KAFLAGS) |
613 | KBUILD_CFLAGS += $(KCFLAGS) | 613 | KBUILD_CFLAGS += $(KCFLAGS) |
614 | 614 | ||
615 | # Use UBOOTINCLUDE when you must reference the include/ directory. | 615 | # Use UBOOTINCLUDE when you must reference the include/ directory. |
616 | # Needed to be compatible with the O= option | 616 | # Needed to be compatible with the O= option |
617 | UBOOTINCLUDE := \ | 617 | UBOOTINCLUDE := \ |
618 | -Iinclude \ | 618 | -Iinclude \ |
619 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ | 619 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ |
620 | $(if $(CONFIG_SYS_THUMB_BUILD), $(if $(CONFIG_HAS_THUMB2),, \ | 620 | $(if $(CONFIG_SYS_THUMB_BUILD), $(if $(CONFIG_HAS_THUMB2),, \ |
621 | -I$(srctree)/arch/$(ARCH)/thumb1/include),) \ | 621 | -I$(srctree)/arch/$(ARCH)/thumb1/include),) \ |
622 | -I$(srctree)/arch/$(ARCH)/include \ | 622 | -I$(srctree)/arch/$(ARCH)/include \ |
623 | -include $(srctree)/include/linux/kconfig.h | 623 | -include $(srctree)/include/linux/kconfig.h |
624 | 624 | ||
625 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 625 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
626 | CHECKFLAGS += $(NOSTDINC_FLAGS) | 626 | CHECKFLAGS += $(NOSTDINC_FLAGS) |
627 | 627 | ||
628 | # FIX ME | 628 | # FIX ME |
629 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ | 629 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ |
630 | $(NOSTDINC_FLAGS) | 630 | $(NOSTDINC_FLAGS) |
631 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) | 631 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) |
632 | 632 | ||
633 | ######################################################################### | 633 | ######################################################################### |
634 | # U-Boot objects....order is important (i.e. start must be first) | 634 | # U-Boot objects....order is important (i.e. start must be first) |
635 | 635 | ||
636 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) | 636 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) |
637 | 637 | ||
638 | libs-y += lib/ | 638 | libs-y += lib/ |
639 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | 639 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ |
640 | libs-$(CONFIG_OF_EMBED) += dts/ | 640 | libs-$(CONFIG_OF_EMBED) += dts/ |
641 | libs-y += fs/ | 641 | libs-y += fs/ |
642 | libs-y += net/ | 642 | libs-y += net/ |
643 | libs-y += disk/ | 643 | libs-y += disk/ |
644 | libs-y += drivers/ | 644 | libs-y += drivers/ |
645 | libs-y += drivers/dma/ | 645 | libs-y += drivers/dma/ |
646 | libs-y += drivers/gpio/ | 646 | libs-y += drivers/gpio/ |
647 | libs-y += drivers/i2c/ | 647 | libs-y += drivers/i2c/ |
648 | libs-y += drivers/mmc/ | 648 | libs-y += drivers/mmc/ |
649 | libs-y += drivers/mtd/ | 649 | libs-y += drivers/mtd/ |
650 | libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ | 650 | libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ |
651 | libs-y += drivers/mtd/onenand/ | 651 | libs-y += drivers/mtd/onenand/ |
652 | libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ | 652 | libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ |
653 | libs-y += drivers/mtd/spi/ | 653 | libs-y += drivers/mtd/spi/ |
654 | libs-y += drivers/net/ | 654 | libs-y += drivers/net/ |
655 | libs-y += drivers/net/phy/ | 655 | libs-y += drivers/net/phy/ |
656 | libs-y += drivers/pci/ | 656 | libs-y += drivers/pci/ |
657 | libs-y += drivers/power/ \ | 657 | libs-y += drivers/power/ \ |
658 | drivers/power/domain/ \ | 658 | drivers/power/domain/ \ |
659 | drivers/power/fuel_gauge/ \ | 659 | drivers/power/fuel_gauge/ \ |
660 | drivers/power/mfd/ \ | 660 | drivers/power/mfd/ \ |
661 | drivers/power/pmic/ \ | 661 | drivers/power/pmic/ \ |
662 | drivers/power/battery/ \ | 662 | drivers/power/battery/ \ |
663 | drivers/power/regulator/ | 663 | drivers/power/regulator/ |
664 | libs-y += drivers/spi/ | 664 | libs-y += drivers/spi/ |
665 | libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ | 665 | libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ |
666 | libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ | 666 | libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ |
667 | libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/ | 667 | libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/ |
668 | libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/ | 668 | libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/ |
669 | libs-y += drivers/serial/ | 669 | libs-y += drivers/serial/ |
670 | libs-y += drivers/usb/dwc3/ | 670 | libs-y += drivers/usb/dwc3/ |
671 | libs-y += drivers/usb/common/ | 671 | libs-y += drivers/usb/common/ |
672 | libs-y += drivers/usb/emul/ | 672 | libs-y += drivers/usb/emul/ |
673 | libs-y += drivers/usb/eth/ | 673 | libs-y += drivers/usb/eth/ |
674 | libs-y += drivers/usb/gadget/ | 674 | libs-y += drivers/usb/gadget/ |
675 | libs-y += drivers/usb/gadget/udc/ | 675 | libs-y += drivers/usb/gadget/udc/ |
676 | libs-y += drivers/usb/host/ | 676 | libs-y += drivers/usb/host/ |
677 | libs-y += drivers/usb/musb/ | 677 | libs-y += drivers/usb/musb/ |
678 | libs-y += drivers/usb/musb-new/ | 678 | libs-y += drivers/usb/musb-new/ |
679 | libs-y += drivers/usb/phy/ | 679 | libs-y += drivers/usb/phy/ |
680 | libs-y += drivers/usb/ulpi/ | 680 | libs-y += drivers/usb/ulpi/ |
681 | libs-y += cmd/ | 681 | libs-y += cmd/ |
682 | libs-y += common/ | 682 | libs-y += common/ |
683 | libs-$(CONFIG_API) += api/ | 683 | libs-$(CONFIG_API) += api/ |
684 | libs-$(CONFIG_HAS_POST) += post/ | 684 | libs-$(CONFIG_HAS_POST) += post/ |
685 | libs-y += test/ | 685 | libs-y += test/ |
686 | libs-y += test/dm/ | 686 | libs-y += test/dm/ |
687 | libs-$(CONFIG_UT_ENV) += test/env/ | 687 | libs-$(CONFIG_UT_ENV) += test/env/ |
688 | libs-$(CONFIG_UT_OVERLAY) += test/overlay/ | 688 | libs-$(CONFIG_UT_OVERLAY) += test/overlay/ |
689 | 689 | ||
690 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) | 690 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) |
691 | 691 | ||
692 | libs-y := $(sort $(libs-y)) | 692 | libs-y := $(sort $(libs-y)) |
693 | 693 | ||
694 | u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples | 694 | u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples |
695 | 695 | ||
696 | u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-)))) | 696 | u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-)))) |
697 | 697 | ||
698 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) | 698 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) |
699 | 699 | ||
700 | u-boot-init := $(head-y) | 700 | u-boot-init := $(head-y) |
701 | u-boot-main := $(libs-y) | 701 | u-boot-main := $(libs-y) |
702 | 702 | ||
703 | 703 | ||
704 | # Add GCC lib | 704 | # Add GCC lib |
705 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) | 705 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) |
706 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a | 706 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a |
707 | else | 707 | else |
708 | PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc | 708 | PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc |
709 | endif | 709 | endif |
710 | PLATFORM_LIBS += $(PLATFORM_LIBGCC) | 710 | PLATFORM_LIBS += $(PLATFORM_LIBGCC) |
711 | export PLATFORM_LIBS | 711 | export PLATFORM_LIBS |
712 | export PLATFORM_LIBGCC | 712 | export PLATFORM_LIBGCC |
713 | 713 | ||
714 | # Special flags for CPP when processing the linker script. | 714 | # Special flags for CPP when processing the linker script. |
715 | # Pass the version down so we can handle backwards compatibility | 715 | # Pass the version down so we can handle backwards compatibility |
716 | # on the fly. | 716 | # on the fly. |
717 | LDPPFLAGS += \ | 717 | LDPPFLAGS += \ |
718 | -include $(srctree)/include/u-boot/u-boot.lds.h \ | 718 | -include $(srctree)/include/u-boot/u-boot.lds.h \ |
719 | -DCPUDIR=$(CPUDIR) \ | 719 | -DCPUDIR=$(CPUDIR) \ |
720 | $(shell $(LD) --version | \ | 720 | $(shell $(LD) --version | \ |
721 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') | 721 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') |
722 | 722 | ||
723 | ######################################################################### | 723 | ######################################################################### |
724 | ######################################################################### | 724 | ######################################################################### |
725 | 725 | ||
726 | ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) | 726 | ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) |
727 | BOARD_SIZE_CHECK = \ | 727 | BOARD_SIZE_CHECK = \ |
728 | @actual=`wc -c $@ | awk '{print $$1}'`; \ | 728 | @actual=`wc -c $@ | awk '{print $$1}'`; \ |
729 | limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ | 729 | limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ |
730 | if test $$actual -gt $$limit; then \ | 730 | if test $$actual -gt $$limit; then \ |
731 | echo "$@ exceeds file size limit:" >&2 ; \ | 731 | echo "$@ exceeds file size limit:" >&2 ; \ |
732 | echo " limit: $$limit bytes" >&2 ; \ | 732 | echo " limit: $$limit bytes" >&2 ; \ |
733 | echo " actual: $$actual bytes" >&2 ; \ | 733 | echo " actual: $$actual bytes" >&2 ; \ |
734 | echo " excess: $$((actual - limit)) bytes" >&2; \ | 734 | echo " excess: $$((actual - limit)) bytes" >&2; \ |
735 | exit 1; \ | 735 | exit 1; \ |
736 | fi | 736 | fi |
737 | else | 737 | else |
738 | BOARD_SIZE_CHECK = | 738 | BOARD_SIZE_CHECK = |
739 | endif | 739 | endif |
740 | 740 | ||
741 | # Statically apply RELA-style relocations (currently arm64 only) | 741 | # Statically apply RELA-style relocations (currently arm64 only) |
742 | ifneq ($(CONFIG_STATIC_RELA),) | 742 | ifneq ($(CONFIG_STATIC_RELA),) |
743 | # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base | 743 | # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base |
744 | DO_STATIC_RELA = \ | 744 | DO_STATIC_RELA = \ |
745 | start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ | 745 | start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ |
746 | end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ | 746 | end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ |
747 | tools/relocate-rela $(2) $(3) $$start $$end | 747 | tools/relocate-rela $(2) $(3) $$start $$end |
748 | else | 748 | else |
749 | DO_STATIC_RELA = | 749 | DO_STATIC_RELA = |
750 | endif | 750 | endif |
751 | 751 | ||
752 | # Always append ALL so that arch config.mk's can add custom ones | 752 | # Always append ALL so that arch config.mk's can add custom ones |
753 | ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check | 753 | ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check |
754 | 754 | ||
755 | ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin | 755 | ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin |
756 | ifeq ($(CONFIG_SPL_FSL_PBL),y) | 756 | ifeq ($(CONFIG_SPL_FSL_PBL),y) |
757 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin | 757 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin |
758 | else | 758 | else |
759 | ifneq ($(CONFIG_SECURE_BOOT), y) | 759 | ifneq ($(CONFIG_SECURE_BOOT), y) |
760 | # For Secure Boot The Image needs to be signed and Header must also | 760 | # For Secure Boot The Image needs to be signed and Header must also |
761 | # be included. So The image has to be built explicitly | 761 | # be included. So The image has to be built explicitly |
762 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl | 762 | ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl |
763 | endif | 763 | endif |
764 | endif | 764 | endif |
765 | ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin | 765 | ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin |
766 | ifeq ($(CONFIG_MX6)$(CONFIG_SECURE_BOOT), yy) | 766 | ifeq ($(CONFIG_MX6)$(CONFIG_SECURE_BOOT), yy) |
767 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img | 767 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img |
768 | else | 768 | else |
769 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img | 769 | ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img |
770 | endif | 770 | endif |
771 | ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin | 771 | ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin |
772 | ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb | 772 | ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb |
773 | ifeq ($(CONFIG_SPL_FRAMEWORK),y) | 773 | ifeq ($(CONFIG_SPL_FRAMEWORK),y) |
774 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img | 774 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img |
775 | endif | 775 | endif |
776 | ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb | 776 | ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb |
777 | ifneq ($(CONFIG_SPL_TARGET),) | 777 | ifneq ($(CONFIG_SPL_TARGET),) |
778 | ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) | 778 | ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) |
779 | endif | 779 | endif |
780 | ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf | 780 | ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf |
781 | ALL-$(CONFIG_EFI_APP) += u-boot-app.efi | 781 | ALL-$(CONFIG_EFI_APP) += u-boot-app.efi |
782 | ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi | 782 | ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi |
783 | 783 | ||
784 | ifneq ($(BUILD_ROM),) | 784 | ifneq ($(BUILD_ROM),) |
785 | ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom | 785 | ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom |
786 | endif | 786 | endif |
787 | 787 | ||
788 | # enable combined SPL/u-boot/dtb rules for tegra | 788 | # enable combined SPL/u-boot/dtb rules for tegra |
789 | ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) | 789 | ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) |
790 | ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin | 790 | ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin |
791 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin | 791 | ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin |
792 | endif | 792 | endif |
793 | 793 | ||
794 | # Add optional build target if defined in board/cpu/soc headers | 794 | # Add optional build target if defined in board/cpu/soc headers |
795 | ifneq ($(CONFIG_BUILD_TARGET),) | 795 | ifneq ($(CONFIG_BUILD_TARGET),) |
796 | ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) | 796 | ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) |
797 | endif | 797 | endif |
798 | 798 | ||
799 | LDFLAGS_u-boot += $(LDFLAGS_FINAL) | 799 | LDFLAGS_u-boot += $(LDFLAGS_FINAL) |
800 | ifneq ($(CONFIG_SYS_TEXT_BASE),) | 800 | ifneq ($(CONFIG_SYS_TEXT_BASE),) |
801 | LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) | 801 | LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) |
802 | endif | 802 | endif |
803 | 803 | ||
804 | # Normally we fill empty space with 0xff | 804 | # Normally we fill empty space with 0xff |
805 | quiet_cmd_objcopy = OBJCOPY $@ | 805 | quiet_cmd_objcopy = OBJCOPY $@ |
806 | cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \ | 806 | cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \ |
807 | $(OBJCOPYFLAGS_$(@F)) $< $@ | 807 | $(OBJCOPYFLAGS_$(@F)) $< $@ |
808 | 808 | ||
809 | # Provide a version which does not do this, for use by EFI | 809 | # Provide a version which does not do this, for use by EFI |
810 | quiet_cmd_zobjcopy = OBJCOPY $@ | 810 | quiet_cmd_zobjcopy = OBJCOPY $@ |
811 | cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ | 811 | cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ |
812 | 812 | ||
813 | quiet_cmd_efipayload = OBJCOPY $@ | 813 | quiet_cmd_efipayload = OBJCOPY $@ |
814 | cmd_efipayload = $(OBJCOPY) -I binary -O $(EFIPAYLOAD_BFDTARGET) -B $(EFIPAYLOAD_BFDARCH) $< $@ | 814 | cmd_efipayload = $(OBJCOPY) -I binary -O $(EFIPAYLOAD_BFDTARGET) -B $(EFIPAYLOAD_BFDARCH) $< $@ |
815 | 815 | ||
816 | MKIMAGEOUTPUT ?= /dev/null | ||
817 | |||
816 | quiet_cmd_mkimage = MKIMAGE $@ | 818 | quiet_cmd_mkimage = MKIMAGE $@ |
817 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ | 819 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ |
818 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) | 820 | $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) |
819 | 821 | ||
820 | quiet_cmd_cat = CAT $@ | 822 | quiet_cmd_cat = CAT $@ |
821 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ | 823 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ |
822 | 824 | ||
823 | append = cat $(filter-out $< $(PHONY), $^) >> $@ | 825 | append = cat $(filter-out $< $(PHONY), $^) >> $@ |
824 | 826 | ||
825 | quiet_cmd_pad_cat = CAT $@ | 827 | quiet_cmd_pad_cat = CAT $@ |
826 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ | 828 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ |
827 | 829 | ||
828 | cfg: u-boot.cfg | 830 | cfg: u-boot.cfg |
829 | 831 | ||
830 | all: $(ALL-y) | 832 | all: $(ALL-y) |
831 | ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y) | 833 | ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y) |
832 | @echo "===================== WARNING ======================" | 834 | @echo "===================== WARNING ======================" |
833 | @echo "This board uses CONFIG_DM_I2C_COMPAT. Please remove" | 835 | @echo "This board uses CONFIG_DM_I2C_COMPAT. Please remove" |
834 | @echo "(possibly in a subsequent patch in your series)" | 836 | @echo "(possibly in a subsequent patch in your series)" |
835 | @echo "before sending patches to the mailing list." | 837 | @echo "before sending patches to the mailing list." |
836 | @echo "====================================================" | 838 | @echo "====================================================" |
837 | endif | 839 | endif |
838 | @# Check that this build does not use CONFIG options that we do not | 840 | @# Check that this build does not use CONFIG options that we do not |
839 | @# know about unless they are in Kconfig. All the existing CONFIG | 841 | @# know about unless they are in Kconfig. All the existing CONFIG |
840 | @# options are whitelisted, so new ones should not be added. | 842 | @# options are whitelisted, so new ones should not be added. |
841 | $(srctree)/scripts/check-config.sh u-boot.cfg \ | 843 | $(srctree)/scripts/check-config.sh u-boot.cfg \ |
842 | $(srctree)/scripts/config_whitelist.txt ${srctree} 1>&2 | 844 | $(srctree)/scripts/config_whitelist.txt ${srctree} 1>&2 |
843 | 845 | ||
844 | PHONY += dtbs | 846 | PHONY += dtbs |
845 | dtbs: dts/dt.dtb | 847 | dtbs: dts/dt.dtb |
846 | @: | 848 | @: |
847 | dts/dt.dtb: checkdtc u-boot | 849 | dts/dt.dtb: checkdtc u-boot |
848 | $(Q)$(MAKE) $(build)=dts dtbs | 850 | $(Q)$(MAKE) $(build)=dts dtbs |
849 | 851 | ||
850 | quiet_cmd_copy = COPY $@ | 852 | quiet_cmd_copy = COPY $@ |
851 | cmd_copy = cp $< $@ | 853 | cmd_copy = cp $< $@ |
852 | 854 | ||
853 | ifeq ($(CONFIG_OF_SEPARATE),y) | 855 | ifeq ($(CONFIG_OF_SEPARATE),y) |
854 | u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE | 856 | u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE |
855 | $(call if_changed,cat) | 857 | $(call if_changed,cat) |
856 | 858 | ||
857 | u-boot.bin: u-boot-dtb.bin FORCE | 859 | u-boot.bin: u-boot-dtb.bin FORCE |
858 | $(call if_changed,copy) | 860 | $(call if_changed,copy) |
859 | else | 861 | else |
860 | u-boot.bin: u-boot-nodtb.bin FORCE | 862 | u-boot.bin: u-boot-nodtb.bin FORCE |
861 | $(call if_changed,copy) | 863 | $(call if_changed,copy) |
862 | endif | 864 | endif |
863 | 865 | ||
864 | %.imx: %.bin | 866 | %.imx: %.bin |
865 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 867 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
866 | 868 | ||
867 | %.vyb: %.imx | 869 | %.vyb: %.imx |
868 | $(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@ | 870 | $(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@ |
869 | 871 | ||
870 | quiet_cmd_copy = COPY $@ | 872 | quiet_cmd_copy = COPY $@ |
871 | cmd_copy = cp $< $@ | 873 | cmd_copy = cp $< $@ |
872 | 874 | ||
873 | u-boot.dtb: dts/dt.dtb | 875 | u-boot.dtb: dts/dt.dtb |
874 | $(call cmd,copy) | 876 | $(call cmd,copy) |
875 | 877 | ||
876 | OBJCOPYFLAGS_u-boot.hex := -O ihex | 878 | OBJCOPYFLAGS_u-boot.hex := -O ihex |
877 | 879 | ||
878 | OBJCOPYFLAGS_u-boot.srec := -O srec | 880 | OBJCOPYFLAGS_u-boot.srec := -O srec |
879 | 881 | ||
880 | u-boot.hex u-boot.srec: u-boot FORCE | 882 | u-boot.hex u-boot.srec: u-boot FORCE |
881 | $(call if_changed,objcopy) | 883 | $(call if_changed,objcopy) |
882 | 884 | ||
883 | OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ | 885 | OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ |
884 | $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec) | 886 | $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec) |
885 | 887 | ||
886 | binary_size_check: u-boot-nodtb.bin FORCE | 888 | binary_size_check: u-boot-nodtb.bin FORCE |
887 | @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ | 889 | @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ |
888 | map_size=$(shell cat u-boot.map | \ | 890 | map_size=$(shell cat u-boot.map | \ |
889 | awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \ | 891 | awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \ |
890 | | sed 's/0X//g' \ | 892 | | sed 's/0X//g' \ |
891 | | bc); \ | 893 | | bc); \ |
892 | if [ "" != "$$map_size" ]; then \ | 894 | if [ "" != "$$map_size" ]; then \ |
893 | if test $$map_size -ne $$file_size; then \ | 895 | if test $$map_size -ne $$file_size; then \ |
894 | echo "u-boot.map shows a binary size of $$map_size" >&2 ; \ | 896 | echo "u-boot.map shows a binary size of $$map_size" >&2 ; \ |
895 | echo " but u-boot-nodtb.bin shows $$file_size" >&2 ; \ | 897 | echo " but u-boot-nodtb.bin shows $$file_size" >&2 ; \ |
896 | exit 1; \ | 898 | exit 1; \ |
897 | fi \ | 899 | fi \ |
898 | fi | 900 | fi |
899 | 901 | ||
900 | u-boot-nodtb.bin: u-boot FORCE | 902 | u-boot-nodtb.bin: u-boot FORCE |
901 | $(call if_changed,objcopy) | 903 | $(call if_changed,objcopy) |
902 | $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) | 904 | $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) |
903 | $(BOARD_SIZE_CHECK) | 905 | $(BOARD_SIZE_CHECK) |
904 | 906 | ||
905 | u-boot.ldr: u-boot | 907 | u-boot.ldr: u-boot |
906 | $(CREATE_LDR_ENV) | 908 | $(CREATE_LDR_ENV) |
907 | $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS) | 909 | $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS) |
908 | $(BOARD_SIZE_CHECK) | 910 | $(BOARD_SIZE_CHECK) |
909 | 911 | ||
910 | # binman | 912 | # binman |
911 | # --------------------------------------------------------------------------- | 913 | # --------------------------------------------------------------------------- |
912 | quiet_cmd_binman = BINMAN $@ | 914 | quiet_cmd_binman = BINMAN $@ |
913 | cmd_binman = $(srctree)/tools/binman/binman -d u-boot.dtb -O . \ | 915 | cmd_binman = $(srctree)/tools/binman/binman -d u-boot.dtb -O . \ |
914 | -I . -I $(srctree)/board/$(BOARDDIR) $< | 916 | -I . -I $(srctree)/board/$(BOARDDIR) $< |
915 | 917 | ||
916 | OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex | 918 | OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex |
917 | 919 | ||
918 | OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec | 920 | OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec |
919 | 921 | ||
920 | u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE | 922 | u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE |
921 | $(call if_changed,objcopy) | 923 | $(call if_changed,objcopy) |
922 | 924 | ||
923 | # | 925 | # |
924 | # U-Boot entry point, needed for booting of full-blown U-Boot | 926 | # U-Boot entry point, needed for booting of full-blown U-Boot |
925 | # from the SPL U-Boot version. | 927 | # from the SPL U-Boot version. |
926 | # | 928 | # |
927 | ifndef CONFIG_SYS_UBOOT_START | 929 | ifndef CONFIG_SYS_UBOOT_START |
928 | CONFIG_SYS_UBOOT_START := 0 | 930 | CONFIG_SYS_UBOOT_START := 0 |
929 | endif | 931 | endif |
930 | 932 | ||
931 | # Create a file containing the configuration options the image was built with | 933 | # Create a file containing the configuration options the image was built with |
932 | quiet_cmd_cpp_cfg = CFG $@ | 934 | quiet_cmd_cpp_cfg = CFG $@ |
933 | cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ | 935 | cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ |
934 | -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< | 936 | -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< |
935 | 937 | ||
936 | ifdef CONFIG_SPL_LOAD_FIT | 938 | ifdef CONFIG_SPL_LOAD_FIT |
937 | MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ | 939 | MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ |
938 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ | 940 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
939 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ | 941 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ |
940 | $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) | 942 | $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) |
941 | else | 943 | else |
942 | MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ | 944 | MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ |
943 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ | 945 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
944 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" | 946 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" |
945 | MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \ | 947 | MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \ |
946 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ | 948 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
947 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" | 949 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" |
950 | u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log | ||
951 | CLEAN_FILES += u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log | ||
948 | endif | 952 | endif |
949 | 953 | ||
950 | MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) | 954 | MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) |
951 | 955 | ||
952 | MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ | 956 | MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ |
953 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) | 957 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) |
954 | 958 | ||
955 | MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ | 959 | MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ |
956 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) | 960 | -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) |
957 | 961 | ||
958 | MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ | 962 | MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ |
959 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage | 963 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage |
960 | 964 | ||
961 | u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ | 965 | u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ |
962 | $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE | 966 | $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE |
963 | $(call if_changed,mkimage) | 967 | $(call if_changed,mkimage) |
964 | 968 | ||
965 | u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE | 969 | u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE |
966 | $(call if_changed,mkimage) | 970 | $(call if_changed,mkimage) |
967 | 971 | ||
968 | u-boot.sha1: u-boot.bin | 972 | u-boot.sha1: u-boot.bin |
969 | tools/ubsha1 u-boot.bin | 973 | tools/ubsha1 u-boot.bin |
970 | 974 | ||
971 | u-boot.dis: u-boot | 975 | u-boot.dis: u-boot |
972 | $(OBJDUMP) -d $< > $@ | 976 | $(OBJDUMP) -d $< > $@ |
973 | 977 | ||
974 | ifdef CONFIG_TPL | 978 | ifdef CONFIG_TPL |
975 | SPL_PAYLOAD := tpl/u-boot-with-tpl.bin | 979 | SPL_PAYLOAD := tpl/u-boot-with-tpl.bin |
976 | else | 980 | else |
977 | SPL_PAYLOAD := u-boot.bin | 981 | SPL_PAYLOAD := u-boot.bin |
978 | endif | 982 | endif |
979 | 983 | ||
980 | OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ | 984 | OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ |
981 | --pad-to=$(CONFIG_SPL_PAD_TO) | 985 | --pad-to=$(CONFIG_SPL_PAD_TO) |
982 | u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE | 986 | u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE |
983 | $(call if_changed,pad_cat) | 987 | $(call if_changed,pad_cat) |
984 | 988 | ||
985 | MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE) | 989 | MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE) |
986 | 990 | ||
987 | lpc32xx-spl.img: spl/u-boot-spl.bin FORCE | 991 | lpc32xx-spl.img: spl/u-boot-spl.bin FORCE |
988 | $(call if_changed,mkimage) | 992 | $(call if_changed,mkimage) |
989 | 993 | ||
990 | OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | 994 | OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) |
991 | 995 | ||
992 | lpc32xx-boot-0.bin: lpc32xx-spl.img FORCE | 996 | lpc32xx-boot-0.bin: lpc32xx-spl.img FORCE |
993 | $(call if_changed,objcopy) | 997 | $(call if_changed,objcopy) |
994 | 998 | ||
995 | OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | 999 | OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) |
996 | 1000 | ||
997 | lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE | 1001 | lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE |
998 | $(call if_changed,objcopy) | 1002 | $(call if_changed,objcopy) |
999 | 1003 | ||
1000 | lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE | 1004 | lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE |
1001 | $(call if_changed,cat) | 1005 | $(call if_changed,cat) |
1002 | 1006 | ||
1003 | CLEAN_FILES += lpc32xx-* | 1007 | CLEAN_FILES += lpc32xx-* |
1004 | 1008 | ||
1005 | OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \ | 1009 | OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \ |
1006 | --pad-to=$(CONFIG_TPL_PAD_TO) | 1010 | --pad-to=$(CONFIG_TPL_PAD_TO) |
1007 | tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE | 1011 | tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE |
1008 | $(call if_changed,pad_cat) | 1012 | $(call if_changed,pad_cat) |
1009 | 1013 | ||
1010 | SPL: spl/u-boot-spl.bin FORCE | 1014 | SPL: spl/u-boot-spl.bin FORCE |
1011 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 1015 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
1012 | 1016 | ||
1013 | u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE | 1017 | u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE |
1014 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ | 1018 | $(Q)$(MAKE) $(build)=arch/arm/imx-common $@ |
1015 | 1019 | ||
1016 | MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE) | 1020 | MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE) |
1017 | 1021 | ||
1018 | u-boot.ubl: u-boot-with-spl.bin FORCE | 1022 | u-boot.ubl: u-boot-with-spl.bin FORCE |
1019 | $(call if_changed,mkimage) | 1023 | $(call if_changed,mkimage) |
1020 | 1024 | ||
1021 | MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \ | 1025 | MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \ |
1022 | $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \ | 1026 | $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \ |
1023 | -T aisimage -e $(CONFIG_SPL_TEXT_BASE) | 1027 | -T aisimage -e $(CONFIG_SPL_TEXT_BASE) |
1024 | spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE | 1028 | spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE |
1025 | $(call if_changed,mkimage) | 1029 | $(call if_changed,mkimage) |
1026 | 1030 | ||
1027 | OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | 1031 | OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) |
1028 | u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE | 1032 | u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE |
1029 | $(call if_changed,pad_cat) | 1033 | $(call if_changed,pad_cat) |
1030 | 1034 | ||
1031 | u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin | 1035 | u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin |
1032 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb | 1036 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb |
1033 | u-boot.sb: u-boot.bin spl/u-boot-spl.bin | 1037 | u-boot.sb: u-boot.bin spl/u-boot-spl.bin |
1034 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb | 1038 | $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb |
1035 | 1039 | ||
1036 | # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. | 1040 | # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. |
1037 | # Both images are created using mkimage (crc etc), so that the ROM | 1041 | # Both images are created using mkimage (crc etc), so that the ROM |
1038 | # bootloader can check its integrity. Padding needs to be done to the | 1042 | # bootloader can check its integrity. Padding needs to be done to the |
1039 | # SPL image (with mkimage header) and not the binary. Otherwise the resulting image | 1043 | # SPL image (with mkimage header) and not the binary. Otherwise the resulting image |
1040 | # which is loaded/copied by the ROM bootloader to SRAM doesn't fit. | 1044 | # which is loaded/copied by the ROM bootloader to SRAM doesn't fit. |
1041 | # The resulting image containing both U-Boot images is called u-boot.spr | 1045 | # The resulting image containing both U-Boot images is called u-boot.spr |
1042 | MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \ | 1046 | MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \ |
1043 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER | 1047 | -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER |
1044 | spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE | 1048 | spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE |
1045 | $(call if_changed,mkimage) | 1049 | $(call if_changed,mkimage) |
1046 | 1050 | ||
1047 | OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ | 1051 | OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ |
1048 | --gap-fill=0xff | 1052 | --gap-fill=0xff |
1049 | u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE | 1053 | u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE |
1050 | $(call if_changed,pad_cat) | 1054 | $(call if_changed,pad_cat) |
1051 | 1055 | ||
1052 | ifneq ($(CONFIG_ARCH_SOCFPGA),) | 1056 | ifneq ($(CONFIG_ARCH_SOCFPGA),) |
1053 | quiet_cmd_socboot = SOCBOOT $@ | 1057 | quiet_cmd_socboot = SOCBOOT $@ |
1054 | cmd_socboot = cat spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ | 1058 | cmd_socboot = cat spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ |
1055 | spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ | 1059 | spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ |
1056 | u-boot.img > $@ || rm -f $@ | 1060 | u-boot.img > $@ || rm -f $@ |
1057 | u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE | 1061 | u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE |
1058 | $(call if_changed,socboot) | 1062 | $(call if_changed,socboot) |
1059 | endif | 1063 | endif |
1060 | 1064 | ||
1061 | # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including | 1065 | # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including |
1062 | # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in | 1066 | # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in |
1063 | # the middle. This is handled by binman based on an image description in the | 1067 | # the middle. This is handled by binman based on an image description in the |
1064 | # board's device tree. | 1068 | # board's device tree. |
1065 | ifneq ($(CONFIG_X86_RESET_VECTOR),) | 1069 | ifneq ($(CONFIG_X86_RESET_VECTOR),) |
1066 | rom: u-boot.rom FORCE | 1070 | rom: u-boot.rom FORCE |
1067 | 1071 | ||
1068 | refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE | 1072 | refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE |
1069 | $(call if_changed,copy) | 1073 | $(call if_changed,copy) |
1070 | 1074 | ||
1071 | quiet_cmd_ldr = LD $@ | 1075 | quiet_cmd_ldr = LD $@ |
1072 | cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ | 1076 | cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ |
1073 | $(filter-out FORCE,$^) -o $@ | 1077 | $(filter-out FORCE,$^) -o $@ |
1074 | 1078 | ||
1075 | u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ | 1079 | u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \ |
1076 | $(if $(CONFIG_HAVE_REFCODE),refcode.bin) | 1080 | $(if $(CONFIG_HAVE_REFCODE),refcode.bin) |
1077 | $(call if_changed,binman) | 1081 | $(call if_changed,binman) |
1078 | 1082 | ||
1079 | OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec | 1083 | OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec |
1080 | u-boot-x86-16bit.bin: u-boot FORCE | 1084 | u-boot-x86-16bit.bin: u-boot FORCE |
1081 | $(call if_changed,objcopy) | 1085 | $(call if_changed,objcopy) |
1082 | endif | 1086 | endif |
1083 | 1087 | ||
1084 | ifneq ($(CONFIG_ARCH_SUNXI),) | 1088 | ifneq ($(CONFIG_ARCH_SUNXI),) |
1085 | u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE | 1089 | u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE |
1086 | $(call if_changed,binman) | 1090 | $(call if_changed,binman) |
1087 | endif | 1091 | endif |
1088 | 1092 | ||
1089 | ifneq ($(CONFIG_TEGRA),) | 1093 | ifneq ($(CONFIG_TEGRA),) |
1090 | OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) | 1094 | OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) |
1091 | u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE | 1095 | u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE |
1092 | $(call if_changed,pad_cat) | 1096 | $(call if_changed,pad_cat) |
1093 | 1097 | ||
1094 | OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) | 1098 | OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) |
1095 | u-boot-tegra.bin: spl/u-boot-spl u-boot.bin FORCE | 1099 | u-boot-tegra.bin: spl/u-boot-spl u-boot.bin FORCE |
1096 | $(call if_changed,pad_cat) | 1100 | $(call if_changed,pad_cat) |
1097 | 1101 | ||
1098 | u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE | 1102 | u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE |
1099 | $(call if_changed,copy) | 1103 | $(call if_changed,copy) |
1100 | endif | 1104 | endif |
1101 | 1105 | ||
1102 | OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI) | 1106 | OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI) |
1103 | u-boot-app.efi: u-boot FORCE | 1107 | u-boot-app.efi: u-boot FORCE |
1104 | $(call if_changed,zobjcopy) | 1108 | $(call if_changed,zobjcopy) |
1105 | 1109 | ||
1106 | u-boot.bin.o: u-boot.bin FORCE | 1110 | u-boot.bin.o: u-boot.bin FORCE |
1107 | $(call if_changed,efipayload) | 1111 | $(call if_changed,efipayload) |
1108 | 1112 | ||
1109 | u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE | 1113 | u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE |
1110 | $(call if_changed_dep,cpp_lds) | 1114 | $(call if_changed_dep,cpp_lds) |
1111 | 1115 | ||
1112 | # Rule to link the EFI payload which contains a stub and a U-Boot binary | 1116 | # Rule to link the EFI payload which contains a stub and a U-Boot binary |
1113 | quiet_cmd_u-boot_payload ?= LD $@ | 1117 | quiet_cmd_u-boot_payload ?= LD $@ |
1114 | cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \ | 1118 | cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \ |
1115 | -T u-boot-payload.lds arch/x86/cpu/call32.o \ | 1119 | -T u-boot-payload.lds arch/x86/cpu/call32.o \ |
1116 | lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \ | 1120 | lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \ |
1117 | $(addprefix arch/$(ARCH)/lib/,$(EFISTUB)) | 1121 | $(addprefix arch/$(ARCH)/lib/,$(EFISTUB)) |
1118 | 1122 | ||
1119 | u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE | 1123 | u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE |
1120 | $(call if_changed,u-boot_payload) | 1124 | $(call if_changed,u-boot_payload) |
1121 | 1125 | ||
1122 | OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI) | 1126 | OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI) |
1123 | u-boot-payload.efi: u-boot-payload FORCE | 1127 | u-boot-payload.efi: u-boot-payload FORCE |
1124 | $(call if_changed,zobjcopy) | 1128 | $(call if_changed,zobjcopy) |
1125 | 1129 | ||
1126 | u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE | 1130 | u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE |
1127 | $(call if_changed,cat) | 1131 | $(call if_changed,cat) |
1128 | 1132 | ||
1129 | #Add a target to create boot binary having SPL binary in PBI format | 1133 | #Add a target to create boot binary having SPL binary in PBI format |
1130 | #concatenated with u-boot binary. It is need by PowerPC SoC having | 1134 | #concatenated with u-boot binary. It is need by PowerPC SoC having |
1131 | #internal SRAM <= 512KB. | 1135 | #internal SRAM <= 512KB. |
1132 | MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ | 1136 | MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ |
1133 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \ | 1137 | -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \ |
1134 | -A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE) | 1138 | -A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE) |
1135 | 1139 | ||
1136 | spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE | 1140 | spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE |
1137 | $(call if_changed,mkimage) | 1141 | $(call if_changed,mkimage) |
1138 | 1142 | ||
1139 | ifeq ($(ARCH),arm) | 1143 | ifeq ($(ARCH),arm) |
1140 | UBOOT_BINLOAD := u-boot.img | 1144 | UBOOT_BINLOAD := u-boot.img |
1141 | else | 1145 | else |
1142 | UBOOT_BINLOAD := u-boot.bin | 1146 | UBOOT_BINLOAD := u-boot.bin |
1143 | endif | 1147 | endif |
1144 | 1148 | ||
1145 | OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ | 1149 | OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ |
1146 | --gap-fill=0xff | 1150 | --gap-fill=0xff |
1147 | 1151 | ||
1148 | u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE | 1152 | u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE |
1149 | $(call if_changed,pad_cat) | 1153 | $(call if_changed,pad_cat) |
1150 | 1154 | ||
1151 | # PPC4xx needs the SPL at the end of the image, since the reset vector | 1155 | # PPC4xx needs the SPL at the end of the image, since the reset vector |
1152 | # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target | 1156 | # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target |
1153 | # and need to introduce a new build target with the full blown U-Boot | 1157 | # and need to introduce a new build target with the full blown U-Boot |
1154 | # at the start padded up to the start of the SPL image. And then concat | 1158 | # at the start padded up to the start of the SPL image. And then concat |
1155 | # the SPL image to the end. | 1159 | # the SPL image to the end. |
1156 | 1160 | ||
1157 | OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \ | 1161 | OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \ |
1158 | --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff | 1162 | --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff |
1159 | u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE | 1163 | u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE |
1160 | $(call if_changed,pad_cat) | 1164 | $(call if_changed,pad_cat) |
1161 | 1165 | ||
1162 | # Create a new ELF from a raw binary file. This is useful for arm64 | 1166 | # Create a new ELF from a raw binary file. This is useful for arm64 |
1163 | # where static relocation needs to be performed on the raw binary, | 1167 | # where static relocation needs to be performed on the raw binary, |
1164 | # but certain simulators only accept an ELF file (but don't do the | 1168 | # but certain simulators only accept an ELF file (but don't do the |
1165 | # relocation). | 1169 | # relocation). |
1166 | # FIXME refactor dts/Makefile to share target/arch detection | 1170 | # FIXME refactor dts/Makefile to share target/arch detection |
1167 | u-boot.elf: u-boot.bin | 1171 | u-boot.elf: u-boot.bin |
1168 | @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ | 1172 | @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ |
1169 | $< u-boot-elf.o | 1173 | $< u-boot-elf.o |
1170 | @$(LD) u-boot-elf.o -o $@ \ | 1174 | @$(LD) u-boot-elf.o -o $@ \ |
1171 | --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ | 1175 | --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ |
1172 | -Ttext=$(CONFIG_SYS_TEXT_BASE) | 1176 | -Ttext=$(CONFIG_SYS_TEXT_BASE) |
1173 | 1177 | ||
1174 | # Rule to link u-boot | 1178 | # Rule to link u-boot |
1175 | # May be overridden by arch/$(ARCH)/config.mk | 1179 | # May be overridden by arch/$(ARCH)/config.mk |
1176 | quiet_cmd_u-boot__ ?= LD $@ | 1180 | quiet_cmd_u-boot__ ?= LD $@ |
1177 | cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ | 1181 | cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ |
1178 | -T u-boot.lds $(u-boot-init) \ | 1182 | -T u-boot.lds $(u-boot-init) \ |
1179 | --start-group $(u-boot-main) --end-group \ | 1183 | --start-group $(u-boot-main) --end-group \ |
1180 | $(PLATFORM_LIBS) -Map u-boot.map | 1184 | $(PLATFORM_LIBS) -Map u-boot.map |
1181 | 1185 | ||
1182 | quiet_cmd_smap = GEN common/system_map.o | 1186 | quiet_cmd_smap = GEN common/system_map.o |
1183 | cmd_smap = \ | 1187 | cmd_smap = \ |
1184 | smap=`$(call SYSTEM_MAP,u-boot) | \ | 1188 | smap=`$(call SYSTEM_MAP,u-boot) | \ |
1185 | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ | 1189 | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ |
1186 | $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \ | 1190 | $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \ |
1187 | -c $(srctree)/common/system_map.c -o common/system_map.o | 1191 | -c $(srctree)/common/system_map.c -o common/system_map.o |
1188 | 1192 | ||
1189 | u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds FORCE | 1193 | u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds FORCE |
1190 | $(call if_changed,u-boot__) | 1194 | $(call if_changed,u-boot__) |
1191 | ifeq ($(CONFIG_KALLSYMS),y) | 1195 | ifeq ($(CONFIG_KALLSYMS),y) |
1192 | $(call cmd,smap) | 1196 | $(call cmd,smap) |
1193 | $(call cmd,u-boot__) common/system_map.o | 1197 | $(call cmd,u-boot__) common/system_map.o |
1194 | endif | 1198 | endif |
1195 | 1199 | ||
1196 | quiet_cmd_sym ?= SYM $@ | 1200 | quiet_cmd_sym ?= SYM $@ |
1197 | cmd_sym ?= $(OBJDUMP) -t $< > $@ | 1201 | cmd_sym ?= $(OBJDUMP) -t $< > $@ |
1198 | u-boot.sym: u-boot FORCE | 1202 | u-boot.sym: u-boot FORCE |
1199 | $(call if_changed,sym) | 1203 | $(call if_changed,sym) |
1200 | 1204 | ||
1201 | # The actual objects are generated when descending, | 1205 | # The actual objects are generated when descending, |
1202 | # make sure no implicit rule kicks in | 1206 | # make sure no implicit rule kicks in |
1203 | $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; | 1207 | $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; |
1204 | 1208 | ||
1205 | # Handle descending into subdirectories listed in $(vmlinux-dirs) | 1209 | # Handle descending into subdirectories listed in $(vmlinux-dirs) |
1206 | # Preset locale variables to speed up the build process. Limit locale | 1210 | # Preset locale variables to speed up the build process. Limit locale |
1207 | # tweaks to this spot to avoid wrong language settings when running | 1211 | # tweaks to this spot to avoid wrong language settings when running |
1208 | # make menuconfig etc. | 1212 | # make menuconfig etc. |
1209 | # Error messages still appears in the original language | 1213 | # Error messages still appears in the original language |
1210 | 1214 | ||
1211 | PHONY += $(u-boot-dirs) | 1215 | PHONY += $(u-boot-dirs) |
1212 | $(u-boot-dirs): prepare scripts | 1216 | $(u-boot-dirs): prepare scripts |
1213 | $(Q)$(MAKE) $(build)=$@ | 1217 | $(Q)$(MAKE) $(build)=$@ |
1214 | 1218 | ||
1215 | tools: prepare | 1219 | tools: prepare |
1216 | # The "tools" are needed early | 1220 | # The "tools" are needed early |
1217 | $(filter-out tools, $(u-boot-dirs)): tools | 1221 | $(filter-out tools, $(u-boot-dirs)): tools |
1218 | # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC | 1222 | # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC |
1219 | # is "yes"), so compile examples after U-Boot is compiled. | 1223 | # is "yes"), so compile examples after U-Boot is compiled. |
1220 | examples: $(filter-out examples, $(u-boot-dirs)) | 1224 | examples: $(filter-out examples, $(u-boot-dirs)) |
1221 | 1225 | ||
1222 | define filechk_uboot.release | 1226 | define filechk_uboot.release |
1223 | echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" | 1227 | echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
1224 | endef | 1228 | endef |
1225 | 1229 | ||
1226 | # Store (new) UBOOTRELEASE string in include/config/uboot.release | 1230 | # Store (new) UBOOTRELEASE string in include/config/uboot.release |
1227 | include/config/uboot.release: include/config/auto.conf FORCE | 1231 | include/config/uboot.release: include/config/auto.conf FORCE |
1228 | $(call filechk,uboot.release) | 1232 | $(call filechk,uboot.release) |
1229 | 1233 | ||
1230 | 1234 | ||
1231 | # Things we need to do before we recursively start building the kernel | 1235 | # Things we need to do before we recursively start building the kernel |
1232 | # or the modules are listed in "prepare". | 1236 | # or the modules are listed in "prepare". |
1233 | # A multi level approach is used. prepareN is processed before prepareN-1. | 1237 | # A multi level approach is used. prepareN is processed before prepareN-1. |
1234 | # archprepare is used in arch Makefiles and when processed asm symlink, | 1238 | # archprepare is used in arch Makefiles and when processed asm symlink, |
1235 | # version.h and scripts_basic is processed / created. | 1239 | # version.h and scripts_basic is processed / created. |
1236 | 1240 | ||
1237 | # Listed in dependency order | 1241 | # Listed in dependency order |
1238 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | 1242 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 |
1239 | 1243 | ||
1240 | # prepare3 is used to check if we are building in a separate output directory, | 1244 | # prepare3 is used to check if we are building in a separate output directory, |
1241 | # and if so do: | 1245 | # and if so do: |
1242 | # 1) Check that make has not been executed in the kernel src $(srctree) | 1246 | # 1) Check that make has not been executed in the kernel src $(srctree) |
1243 | prepare3: include/config/uboot.release | 1247 | prepare3: include/config/uboot.release |
1244 | ifneq ($(KBUILD_SRC),) | 1248 | ifneq ($(KBUILD_SRC),) |
1245 | @$(kecho) ' Using $(srctree) as source for U-Boot' | 1249 | @$(kecho) ' Using $(srctree) as source for U-Boot' |
1246 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ | 1250 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
1247 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ | 1251 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ |
1248 | echo >&2 " in the '$(srctree)' directory.";\ | 1252 | echo >&2 " in the '$(srctree)' directory.";\ |
1249 | /bin/false; \ | 1253 | /bin/false; \ |
1250 | fi; | 1254 | fi; |
1251 | endif | 1255 | endif |
1252 | 1256 | ||
1253 | # prepare2 creates a makefile if using a separate output directory | 1257 | # prepare2 creates a makefile if using a separate output directory |
1254 | prepare2: prepare3 outputmakefile | 1258 | prepare2: prepare3 outputmakefile |
1255 | 1259 | ||
1256 | prepare1: prepare2 $(version_h) $(timestamp_h) \ | 1260 | prepare1: prepare2 $(version_h) $(timestamp_h) \ |
1257 | include/config/auto.conf | 1261 | include/config/auto.conf |
1258 | ifeq ($(wildcard $(LDSCRIPT)),) | 1262 | ifeq ($(wildcard $(LDSCRIPT)),) |
1259 | @echo >&2 " Could not find linker script." | 1263 | @echo >&2 " Could not find linker script." |
1260 | @/bin/false | 1264 | @/bin/false |
1261 | endif | 1265 | endif |
1262 | 1266 | ||
1263 | archprepare: prepare1 scripts_basic | 1267 | archprepare: prepare1 scripts_basic |
1264 | 1268 | ||
1265 | prepare0: archprepare FORCE | 1269 | prepare0: archprepare FORCE |
1266 | $(Q)$(MAKE) $(build)=. | 1270 | $(Q)$(MAKE) $(build)=. |
1267 | 1271 | ||
1268 | # All the preparing.. | 1272 | # All the preparing.. |
1269 | prepare: prepare0 | 1273 | prepare: prepare0 |
1270 | 1274 | ||
1271 | # Generate some files | 1275 | # Generate some files |
1272 | # --------------------------------------------------------------------------- | 1276 | # --------------------------------------------------------------------------- |
1273 | 1277 | ||
1274 | define filechk_version.h | 1278 | define filechk_version.h |
1275 | (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \ | 1279 | (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \ |
1276 | echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \ | 1280 | echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \ |
1277 | echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \ | 1281 | echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \ |
1278 | echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; ) | 1282 | echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; ) |
1279 | endef | 1283 | endef |
1280 | 1284 | ||
1281 | # The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date. | 1285 | # The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date. |
1282 | # The BSD date on the other hand behaves different and would produce errors | 1286 | # The BSD date on the other hand behaves different and would produce errors |
1283 | # with the misused '-d' switch. Respect that and search a working date with | 1287 | # with the misused '-d' switch. Respect that and search a working date with |
1284 | # well known pre- and suffixes for the GNU variant of date. | 1288 | # well known pre- and suffixes for the GNU variant of date. |
1285 | define filechk_timestamp.h | 1289 | define filechk_timestamp.h |
1286 | (if test -n "$${SOURCE_DATE_EPOCH}"; then \ | 1290 | (if test -n "$${SOURCE_DATE_EPOCH}"; then \ |
1287 | SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \ | 1291 | SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \ |
1288 | DATE=""; \ | 1292 | DATE=""; \ |
1289 | for date in gdate date.gnu date; do \ | 1293 | for date in gdate date.gnu date; do \ |
1290 | $${date} -u -d "$${SOURCE_DATE}" >/dev/null 2>&1 && DATE="$${date}"; \ | 1294 | $${date} -u -d "$${SOURCE_DATE}" >/dev/null 2>&1 && DATE="$${date}"; \ |
1291 | done; \ | 1295 | done; \ |
1292 | if test -n "$${DATE}"; then \ | 1296 | if test -n "$${DATE}"; then \ |
1293 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \ | 1297 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \ |
1294 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ | 1298 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ |
1295 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ | 1299 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ |
1296 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ | 1300 | LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ |
1297 | else \ | 1301 | else \ |
1298 | return 42; \ | 1302 | return 42; \ |
1299 | fi; \ | 1303 | fi; \ |
1300 | else \ | 1304 | else \ |
1301 | LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ | 1305 | LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ |
1302 | LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ | 1306 | LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ |
1303 | LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \ | 1307 | LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \ |
1304 | LC_ALL=C date +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ | 1308 | LC_ALL=C date +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ |
1305 | fi) | 1309 | fi) |
1306 | endef | 1310 | endef |
1307 | 1311 | ||
1308 | $(version_h): include/config/uboot.release FORCE | 1312 | $(version_h): include/config/uboot.release FORCE |
1309 | $(call filechk,version.h) | 1313 | $(call filechk,version.h) |
1310 | 1314 | ||
1311 | $(timestamp_h): $(srctree)/Makefile FORCE | 1315 | $(timestamp_h): $(srctree)/Makefile FORCE |
1312 | $(call filechk,timestamp.h) | 1316 | $(call filechk,timestamp.h) |
1313 | 1317 | ||
1314 | # --------------------------------------------------------------------------- | 1318 | # --------------------------------------------------------------------------- |
1315 | quiet_cmd_cpp_lds = LDS $@ | 1319 | quiet_cmd_cpp_lds = LDS $@ |
1316 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \ | 1320 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \ |
1317 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< | 1321 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< |
1318 | 1322 | ||
1319 | u-boot.lds: $(LDSCRIPT) prepare FORCE | 1323 | u-boot.lds: $(LDSCRIPT) prepare FORCE |
1320 | $(call if_changed_dep,cpp_lds) | 1324 | $(call if_changed_dep,cpp_lds) |
1321 | 1325 | ||
1322 | spl/u-boot-spl.bin: spl/u-boot-spl | 1326 | spl/u-boot-spl.bin: spl/u-boot-spl |
1323 | @: | 1327 | @: |
1324 | spl/u-boot-spl: tools prepare \ | 1328 | spl/u-boot-spl: tools prepare \ |
1325 | $(if $(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) | 1329 | $(if $(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) |
1326 | $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all | 1330 | $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all |
1327 | 1331 | ||
1328 | spl/sunxi-spl.bin: spl/u-boot-spl | 1332 | spl/sunxi-spl.bin: spl/u-boot-spl |
1329 | @: | 1333 | @: |
1330 | 1334 | ||
1331 | spl/u-boot-spl.sfp: spl/u-boot-spl | 1335 | spl/u-boot-spl.sfp: spl/u-boot-spl |
1332 | @: | 1336 | @: |
1333 | 1337 | ||
1334 | spl/boot.bin: spl/u-boot-spl | 1338 | spl/boot.bin: spl/u-boot-spl |
1335 | @: | 1339 | @: |
1336 | 1340 | ||
1337 | tpl/u-boot-tpl.bin: tools prepare | 1341 | tpl/u-boot-tpl.bin: tools prepare |
1338 | $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all | 1342 | $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all |
1339 | 1343 | ||
1340 | TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) | 1344 | TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) |
1341 | 1345 | ||
1342 | FIND := find | 1346 | FIND := find |
1343 | FINDFLAGS := -L | 1347 | FINDFLAGS := -L |
1344 | 1348 | ||
1345 | tags ctags: | 1349 | tags ctags: |
1346 | ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ | 1350 | ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
1347 | -name '*.[chS]' -print` | 1351 | -name '*.[chS]' -print` |
1348 | ln -s ctags tags | 1352 | ln -s ctags tags |
1349 | 1353 | ||
1350 | etags: | 1354 | etags: |
1351 | etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ | 1355 | etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ |
1352 | -name '*.[chS]' -print` | 1356 | -name '*.[chS]' -print` |
1353 | cscope: | 1357 | cscope: |
1354 | $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ | 1358 | $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ |
1355 | cscope.files | 1359 | cscope.files |
1356 | cscope -b -q -k | 1360 | cscope -b -q -k |
1357 | 1361 | ||
1358 | SYSTEM_MAP = \ | 1362 | SYSTEM_MAP = \ |
1359 | $(NM) $1 | \ | 1363 | $(NM) $1 | \ |
1360 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ | 1364 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ |
1361 | LC_ALL=C sort | 1365 | LC_ALL=C sort |
1362 | System.map: u-boot | 1366 | System.map: u-boot |
1363 | @$(call SYSTEM_MAP,$<) > $@ | 1367 | @$(call SYSTEM_MAP,$<) > $@ |
1364 | 1368 | ||
1365 | checkdtc: | 1369 | checkdtc: |
1366 | @if test $(call dtc-version) -lt 0104; then \ | 1370 | @if test $(call dtc-version) -lt 0104; then \ |
1367 | echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ | 1371 | echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ |
1368 | false; \ | 1372 | false; \ |
1369 | fi | 1373 | fi |
1370 | 1374 | ||
1371 | ######################################################################### | 1375 | ######################################################################### |
1372 | 1376 | ||
1373 | # ARM relocations should all be R_ARM_RELATIVE (32-bit) or | 1377 | # ARM relocations should all be R_ARM_RELATIVE (32-bit) or |
1374 | # R_AARCH64_RELATIVE (64-bit). | 1378 | # R_AARCH64_RELATIVE (64-bit). |
1375 | checkarmreloc: u-boot | 1379 | checkarmreloc: u-boot |
1376 | @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \ | 1380 | @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \ |
1377 | grep R_A | sort -u`"; \ | 1381 | grep R_A | sort -u`"; \ |
1378 | if test "$$RELOC" != "R_ARM_RELATIVE" -a \ | 1382 | if test "$$RELOC" != "R_ARM_RELATIVE" -a \ |
1379 | "$$RELOC" != "R_AARCH64_RELATIVE"; then \ | 1383 | "$$RELOC" != "R_AARCH64_RELATIVE"; then \ |
1380 | echo "$< contains unexpected relocations: $$RELOC"; \ | 1384 | echo "$< contains unexpected relocations: $$RELOC"; \ |
1381 | false; \ | 1385 | false; \ |
1382 | fi | 1386 | fi |
1383 | 1387 | ||
1384 | env: scripts_basic | 1388 | env: scripts_basic |
1385 | $(Q)$(MAKE) $(build)=tools/$@ | 1389 | $(Q)$(MAKE) $(build)=tools/$@ |
1386 | 1390 | ||
1387 | tools-only: scripts_basic $(version_h) $(timestamp_h) | 1391 | tools-only: scripts_basic $(version_h) $(timestamp_h) |
1388 | $(Q)$(MAKE) $(build)=tools | 1392 | $(Q)$(MAKE) $(build)=tools |
1389 | 1393 | ||
1390 | tools-all: export HOST_TOOLS_ALL=y | 1394 | tools-all: export HOST_TOOLS_ALL=y |
1391 | tools-all: env tools ; | 1395 | tools-all: env tools ; |
1392 | 1396 | ||
1393 | cross_tools: export CROSS_BUILD_TOOLS=y | 1397 | cross_tools: export CROSS_BUILD_TOOLS=y |
1394 | cross_tools: tools ; | 1398 | cross_tools: tools ; |
1395 | 1399 | ||
1396 | .PHONY : CHANGELOG | 1400 | .PHONY : CHANGELOG |
1397 | CHANGELOG: | 1401 | CHANGELOG: |
1398 | git log --no-merges U-Boot-1_1_5.. | \ | 1402 | git log --no-merges U-Boot-1_1_5.. | \ |
1399 | unexpand -a | sed -e 's/\s\s*$$//' > $@ | 1403 | unexpand -a | sed -e 's/\s\s*$$//' > $@ |
1400 | 1404 | ||
1401 | ######################################################################### | 1405 | ######################################################################### |
1402 | 1406 | ||
1403 | ### | 1407 | ### |
1404 | # Cleaning is done on three levels. | 1408 | # Cleaning is done on three levels. |
1405 | # make clean Delete most generated files | 1409 | # make clean Delete most generated files |
1406 | # Leave enough to build external modules | 1410 | # Leave enough to build external modules |
1407 | # make mrproper Delete the current configuration, and all generated files | 1411 | # make mrproper Delete the current configuration, and all generated files |
1408 | # make distclean Remove editor backup files, patch leftover files and the like | 1412 | # make distclean Remove editor backup files, patch leftover files and the like |
1409 | 1413 | ||
1410 | # Directories & files removed with 'make clean' | 1414 | # Directories & files removed with 'make clean' |
1411 | CLEAN_DIRS += $(MODVERDIR) \ | 1415 | CLEAN_DIRS += $(MODVERDIR) \ |
1412 | $(foreach d, spl tpl, $(patsubst %,$d/%, \ | 1416 | $(foreach d, spl tpl, $(patsubst %,$d/%, \ |
1413 | $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) | 1417 | $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) |
1414 | 1418 | ||
1415 | CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h include/license.h \ | 1419 | CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h include/license.h \ |
1416 | boot* u-boot* MLO* SPL System.map | 1420 | boot* u-boot* MLO* SPL System.map |
1417 | 1421 | ||
1418 | # Directories & files removed with 'make mrproper' | 1422 | # Directories & files removed with 'make mrproper' |
1419 | MRPROPER_DIRS += include/config include/generated spl tpl \ | 1423 | MRPROPER_DIRS += include/config include/generated spl tpl \ |
1420 | .tmp_objdiff | 1424 | .tmp_objdiff |
1421 | MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ | 1425 | MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ |
1422 | ctags etags tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS | 1426 | ctags etags tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS |
1423 | 1427 | ||
1424 | # clean - Delete most, but leave enough to build external modules | 1428 | # clean - Delete most, but leave enough to build external modules |
1425 | # | 1429 | # |
1426 | clean: rm-dirs := $(CLEAN_DIRS) | 1430 | clean: rm-dirs := $(CLEAN_DIRS) |
1427 | clean: rm-files := $(CLEAN_FILES) | 1431 | clean: rm-files := $(CLEAN_FILES) |
1428 | 1432 | ||
1429 | clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f)) | 1433 | clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f)) |
1430 | 1434 | ||
1431 | clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook) | 1435 | clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook) |
1432 | 1436 | ||
1433 | PHONY += $(clean-dirs) clean archclean | 1437 | PHONY += $(clean-dirs) clean archclean |
1434 | $(clean-dirs): | 1438 | $(clean-dirs): |
1435 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 1439 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1436 | 1440 | ||
1437 | # TODO: Do not use *.cfgtmp | 1441 | # TODO: Do not use *.cfgtmp |
1438 | clean: $(clean-dirs) | 1442 | clean: $(clean-dirs) |
1439 | $(call cmd,rmdirs) | 1443 | $(call cmd,rmdirs) |
1440 | $(call cmd,rmfiles) | 1444 | $(call cmd,rmfiles) |
1441 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ | 1445 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ |
1442 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1446 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1443 | -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ | 1447 | -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ |
1444 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1448 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
1445 | -o -name '*.symtypes' -o -name 'modules.order' \ | 1449 | -o -name '*.symtypes' -o -name 'modules.order' \ |
1446 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ | 1450 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ |
1447 | -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \ | 1451 | -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \ |
1448 | -o -name '*.gcno' \) -type f -print | xargs rm -f | 1452 | -o -name '*.gcno' \) -type f -print | xargs rm -f |
1449 | 1453 | ||
1450 | # mrproper - Delete all generated files, including .config | 1454 | # mrproper - Delete all generated files, including .config |
1451 | # | 1455 | # |
1452 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) | 1456 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) |
1453 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | 1457 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
1454 | mrproper-dirs := $(addprefix _mrproper_,scripts) | 1458 | mrproper-dirs := $(addprefix _mrproper_,scripts) |
1455 | 1459 | ||
1456 | PHONY += $(mrproper-dirs) mrproper archmrproper | 1460 | PHONY += $(mrproper-dirs) mrproper archmrproper |
1457 | $(mrproper-dirs): | 1461 | $(mrproper-dirs): |
1458 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) | 1462 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
1459 | 1463 | ||
1460 | mrproper: clean $(mrproper-dirs) | 1464 | mrproper: clean $(mrproper-dirs) |
1461 | $(call cmd,rmdirs) | 1465 | $(call cmd,rmdirs) |
1462 | $(call cmd,rmfiles) | 1466 | $(call cmd,rmfiles) |
1463 | @rm -f arch/*/include/asm/arch | 1467 | @rm -f arch/*/include/asm/arch |
1464 | 1468 | ||
1465 | # distclean | 1469 | # distclean |
1466 | # | 1470 | # |
1467 | PHONY += distclean | 1471 | PHONY += distclean |
1468 | 1472 | ||
1469 | distclean: mrproper | 1473 | distclean: mrproper |
1470 | @find $(srctree) $(RCS_FIND_IGNORE) \ | 1474 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
1471 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ | 1475 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ |
1472 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ | 1476 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ |
1473 | -o -name '.*.rej' -o -name '*%' -o -name 'core' \ | 1477 | -o -name '.*.rej' -o -name '*%' -o -name 'core' \ |
1474 | -o -name '*.pyc' \) \ | 1478 | -o -name '*.pyc' \) \ |
1475 | -type f -print | xargs rm -f | 1479 | -type f -print | xargs rm -f |
1476 | @rm -f boards.cfg | 1480 | @rm -f boards.cfg |
1477 | 1481 | ||
1478 | backup: | 1482 | backup: |
1479 | F=`basename $(srctree)` ; cd .. ; \ | 1483 | F=`basename $(srctree)` ; cd .. ; \ |
1480 | gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F | 1484 | gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F |
1481 | 1485 | ||
1482 | help: | 1486 | help: |
1483 | @echo 'Cleaning targets:' | 1487 | @echo 'Cleaning targets:' |
1484 | @echo ' clean - Remove most generated files but keep the config' | 1488 | @echo ' clean - Remove most generated files but keep the config' |
1485 | @echo ' mrproper - Remove all generated files + config + various backup files' | 1489 | @echo ' mrproper - Remove all generated files + config + various backup files' |
1486 | @echo ' distclean - mrproper + remove editor backup and patch files' | 1490 | @echo ' distclean - mrproper + remove editor backup and patch files' |
1487 | @echo '' | 1491 | @echo '' |
1488 | @echo 'Configuration targets:' | 1492 | @echo 'Configuration targets:' |
1489 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help | 1493 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help |
1490 | @echo '' | 1494 | @echo '' |
1491 | @echo 'Other generic targets:' | 1495 | @echo 'Other generic targets:' |
1492 | @echo ' all - Build all necessary images depending on configuration' | 1496 | @echo ' all - Build all necessary images depending on configuration' |
1493 | @echo ' tests - Build U-Boot for sandbox and run tests' | 1497 | @echo ' tests - Build U-Boot for sandbox and run tests' |
1494 | @echo '* u-boot - Build the bare u-boot' | 1498 | @echo '* u-boot - Build the bare u-boot' |
1495 | @echo ' dir/ - Build all files in dir and below' | 1499 | @echo ' dir/ - Build all files in dir and below' |
1496 | @echo ' dir/file.[oisS] - Build specified target only' | 1500 | @echo ' dir/file.[oisS] - Build specified target only' |
1497 | @echo ' dir/file.lst - Build specified mixed source/assembly target only' | 1501 | @echo ' dir/file.lst - Build specified mixed source/assembly target only' |
1498 | @echo ' (requires a recent binutils and recent build (System.map))' | 1502 | @echo ' (requires a recent binutils and recent build (System.map))' |
1499 | @echo ' tags/ctags - Generate ctags file for editors' | 1503 | @echo ' tags/ctags - Generate ctags file for editors' |
1500 | @echo ' etags - Generate etags file for editors' | 1504 | @echo ' etags - Generate etags file for editors' |
1501 | @echo ' cscope - Generate cscope index' | 1505 | @echo ' cscope - Generate cscope index' |
1502 | @echo ' ubootrelease - Output the release version string (use with make -s)' | 1506 | @echo ' ubootrelease - Output the release version string (use with make -s)' |
1503 | @echo ' ubootversion - Output the version stored in Makefile (use with make -s)' | 1507 | @echo ' ubootversion - Output the version stored in Makefile (use with make -s)' |
1504 | @echo " cfg - Don't build, just create the .cfg files" | 1508 | @echo " cfg - Don't build, just create the .cfg files" |
1505 | @echo '' | 1509 | @echo '' |
1506 | @echo 'Static analysers' | 1510 | @echo 'Static analysers' |
1507 | @echo ' checkstack - Generate a list of stack hogs' | 1511 | @echo ' checkstack - Generate a list of stack hogs' |
1508 | @echo '' | 1512 | @echo '' |
1509 | @echo 'Documentation targets:' | 1513 | @echo 'Documentation targets:' |
1510 | @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp | 1514 | @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp |
1511 | @echo '' | 1515 | @echo '' |
1512 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | 1516 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
1513 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' | 1517 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' |
1514 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | 1518 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
1515 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' | 1519 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' |
1516 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' | 1520 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
1517 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' | 1521 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' |
1518 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' | 1522 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' |
1519 | @echo ' 1: warnings which may be relevant and do not occur too often' | 1523 | @echo ' 1: warnings which may be relevant and do not occur too often' |
1520 | @echo ' 2: warnings which occur quite often but may still be relevant' | 1524 | @echo ' 2: warnings which occur quite often but may still be relevant' |
1521 | @echo ' 3: more obscure warnings, can most likely be ignored' | 1525 | @echo ' 3: more obscure warnings, can most likely be ignored' |
1522 | @echo ' Multiple levels can be combined with W=12 or W=123' | 1526 | @echo ' Multiple levels can be combined with W=12 or W=123' |
1523 | @echo '' | 1527 | @echo '' |
1524 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' | 1528 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' |
1525 | @echo 'For further info see the ./README file' | 1529 | @echo 'For further info see the ./README file' |
1526 | 1530 | ||
1527 | tests: | 1531 | tests: |
1528 | $(srctree)/test/run | 1532 | $(srctree)/test/run |
1529 | 1533 | ||
1530 | # Documentation targets | 1534 | # Documentation targets |
1531 | # --------------------------------------------------------------------------- | 1535 | # --------------------------------------------------------------------------- |
1532 | %docs: scripts_basic FORCE | 1536 | %docs: scripts_basic FORCE |
1533 | $(Q)$(MAKE) $(build)=scripts build_docproc | 1537 | $(Q)$(MAKE) $(build)=scripts build_docproc |
1534 | $(Q)$(MAKE) $(build)=doc/DocBook $@ | 1538 | $(Q)$(MAKE) $(build)=doc/DocBook $@ |
1535 | 1539 | ||
1536 | # Dummies... | 1540 | # Dummies... |
1537 | PHONY += prepare scripts | 1541 | PHONY += prepare scripts |
1538 | prepare: ; | 1542 | prepare: ; |
1539 | scripts: ; | 1543 | scripts: ; |
1540 | 1544 | ||
1541 | endif #ifeq ($(config-targets),1) | 1545 | endif #ifeq ($(config-targets),1) |
1542 | endif #ifeq ($(mixed-targets),1) | 1546 | endif #ifeq ($(mixed-targets),1) |
1543 | 1547 | ||
1544 | PHONY += checkstack ubootrelease ubootversion | 1548 | PHONY += checkstack ubootrelease ubootversion |
1545 | 1549 | ||
1546 | checkstack: | 1550 | checkstack: |
1547 | $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \ | 1551 | $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \ |
1548 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | 1552 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) |
1549 | 1553 | ||
1550 | ubootrelease: | 1554 | ubootrelease: |
1551 | @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" | 1555 | @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
1552 | 1556 | ||
1553 | ubootversion: | 1557 | ubootversion: |
1554 | @echo $(UBOOTVERSION) | 1558 | @echo $(UBOOTVERSION) |
1555 | 1559 | ||
1556 | # Single targets | 1560 | # Single targets |
1557 | # --------------------------------------------------------------------------- | 1561 | # --------------------------------------------------------------------------- |
1558 | # Single targets are compatible with: | 1562 | # Single targets are compatible with: |
1559 | # - build with mixed source and output | 1563 | # - build with mixed source and output |
1560 | # - build with separate output dir 'make O=...' | 1564 | # - build with separate output dir 'make O=...' |
1561 | # - external modules | 1565 | # - external modules |
1562 | # | 1566 | # |
1563 | # target-dir => where to store outputfile | 1567 | # target-dir => where to store outputfile |
1564 | # build-dir => directory in kernel source tree to use | 1568 | # build-dir => directory in kernel source tree to use |
1565 | 1569 | ||
1566 | ifeq ($(KBUILD_EXTMOD),) | 1570 | ifeq ($(KBUILD_EXTMOD),) |
1567 | build-dir = $(patsubst %/,%,$(dir $@)) | 1571 | build-dir = $(patsubst %/,%,$(dir $@)) |
1568 | target-dir = $(dir $@) | 1572 | target-dir = $(dir $@) |
1569 | else | 1573 | else |
1570 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) | 1574 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) |
1571 | build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) | 1575 | build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) |
1572 | target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) | 1576 | target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) |
1573 | endif | 1577 | endif |
1574 | 1578 | ||
1575 | %.s: %.c prepare scripts FORCE | 1579 | %.s: %.c prepare scripts FORCE |
1576 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1580 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1577 | %.i: %.c prepare scripts FORCE | 1581 | %.i: %.c prepare scripts FORCE |
1578 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1582 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1579 | %.o: %.c prepare scripts FORCE | 1583 | %.o: %.c prepare scripts FORCE |
1580 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1584 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1581 | %.lst: %.c prepare scripts FORCE | 1585 | %.lst: %.c prepare scripts FORCE |
1582 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1586 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1583 | %.s: %.S prepare scripts FORCE | 1587 | %.s: %.S prepare scripts FORCE |
1584 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1588 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1585 | %.o: %.S prepare scripts FORCE | 1589 | %.o: %.S prepare scripts FORCE |
1586 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1590 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1587 | %.symtypes: %.c prepare scripts FORCE | 1591 | %.symtypes: %.c prepare scripts FORCE |
1588 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1592 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1589 | 1593 | ||
1590 | # Modules | 1594 | # Modules |
1591 | /: prepare scripts FORCE | 1595 | /: prepare scripts FORCE |
1592 | $(cmd_crmodverdir) | 1596 | $(cmd_crmodverdir) |
1593 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1597 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1594 | $(build)=$(build-dir) | 1598 | $(build)=$(build-dir) |
1595 | %/: prepare scripts FORCE | 1599 | %/: prepare scripts FORCE |
1596 | $(cmd_crmodverdir) | 1600 | $(cmd_crmodverdir) |
1597 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1601 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1598 | $(build)=$(build-dir) | 1602 | $(build)=$(build-dir) |
1599 | %.ko: prepare scripts FORCE | 1603 | %.ko: prepare scripts FORCE |
1600 | $(cmd_crmodverdir) | 1604 | $(cmd_crmodverdir) |
1601 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1605 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1602 | $(build)=$(build-dir) $(@:.ko=.o) | 1606 | $(build)=$(build-dir) $(@:.ko=.o) |
1603 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1607 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1604 | 1608 | ||
1605 | # FIXME Should go into a make.lib or something | 1609 | # FIXME Should go into a make.lib or something |
1606 | # =========================================================================== | 1610 | # =========================================================================== |
1607 | 1611 | ||
1608 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) | 1612 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) |
1609 | cmd_rmdirs = rm -rf $(rm-dirs) | 1613 | cmd_rmdirs = rm -rf $(rm-dirs) |
1610 | 1614 | ||
1611 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) | 1615 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
1612 | cmd_rmfiles = rm -f $(rm-files) | 1616 | cmd_rmfiles = rm -f $(rm-files) |
1613 | 1617 | ||
1614 | # read all saved command lines | 1618 | # read all saved command lines |
1615 | 1619 | ||
1616 | targets := $(wildcard $(sort $(targets))) | 1620 | targets := $(wildcard $(sort $(targets))) |
1617 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | 1621 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) |
1618 | 1622 | ||
1619 | ifneq ($(cmd_files),) | 1623 | ifneq ($(cmd_files),) |
1620 | $(cmd_files): ; # Do not try to update included dependency files | 1624 | $(cmd_files): ; # Do not try to update included dependency files |
1621 | include $(cmd_files) | 1625 | include $(cmd_files) |
1622 | endif | 1626 | endif |
1623 | 1627 | ||
1624 | endif # skip-makefile | 1628 | endif # skip-makefile |
1625 | 1629 | ||
1626 | PHONY += FORCE | 1630 | PHONY += FORCE |
1627 | FORCE: | 1631 | FORCE: |
1628 | 1632 | ||
1629 | # Declare the contents of the .PHONY variable as phony. We keep that | 1633 | # Declare the contents of the .PHONY variable as phony. We keep that |
1630 | # information in a variable so we can use it in if_changed and friends. | 1634 | # information in a variable so we can use it in if_changed and friends. |
1631 | .PHONY: $(PHONY) | 1635 | .PHONY: $(PHONY) |
1632 | 1636 |
arch/arm/imx-common/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 | # (C) Copyright 2011 Freescale Semiconductor, Inc. | 5 | # (C) Copyright 2011 Freescale Semiconductor, Inc. |
6 | # | 6 | # |
7 | # SPDX-License-Identifier: GPL-2.0+ | 7 | # SPDX-License-Identifier: GPL-2.0+ |
8 | # | 8 | # |
9 | 9 | ||
10 | ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 vf610)) | 10 | ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 vf610)) |
11 | obj-y = iomux-v3.o | 11 | obj-y = iomux-v3.o |
12 | endif | 12 | endif |
13 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) | 13 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) |
14 | obj-y += timer.o cpu.o speed.o | 14 | obj-y += timer.o cpu.o speed.o |
15 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o | 15 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o |
16 | endif | 16 | endif |
17 | ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs)) | 17 | ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs)) |
18 | obj-y += misc.o | 18 | obj-y += misc.o |
19 | obj-$(CONFIG_SPL_BUILD) += spl.o | 19 | obj-$(CONFIG_SPL_BUILD) += spl.o |
20 | endif | 20 | endif |
21 | ifeq ($(SOC),$(filter $(SOC),mx7)) | 21 | ifeq ($(SOC),$(filter $(SOC),mx7)) |
22 | obj-y += cpu.o | 22 | obj-y += cpu.o |
23 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o | 23 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o |
24 | obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o | 24 | obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o |
25 | endif | 25 | endif |
26 | ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) | 26 | ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) |
27 | obj-y += cache.o init.o | 27 | obj-y += cache.o init.o |
28 | obj-$(CONFIG_CMD_SATA) += sata.o | 28 | obj-$(CONFIG_CMD_SATA) += sata.o |
29 | obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o | 29 | obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o |
30 | obj-$(CONFIG_IMX_RDC) += rdc-sema.o | 30 | obj-$(CONFIG_IMX_RDC) += rdc-sema.o |
31 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o | 31 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o |
32 | obj-$(CONFIG_SECURE_BOOT) += hab.o | 32 | obj-$(CONFIG_SECURE_BOOT) += hab.o |
33 | endif | 33 | endif |
34 | ifeq ($(SOC),$(filter $(SOC),vf610)) | 34 | ifeq ($(SOC),$(filter $(SOC),vf610)) |
35 | obj-y += ddrmc-vf610.o | 35 | obj-y += ddrmc-vf610.o |
36 | endif | 36 | endif |
37 | ifneq ($(CONFIG_SPL_BUILD),y) | 37 | ifneq ($(CONFIG_SPL_BUILD),y) |
38 | obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o | 38 | obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o |
39 | obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o | 39 | obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o |
40 | obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o | 40 | obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o |
41 | endif | 41 | endif |
42 | 42 | ||
43 | PLUGIN = board/$(BOARDDIR)/plugin | 43 | PLUGIN = board/$(BOARDDIR)/plugin |
44 | 44 | ||
45 | ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y) | 45 | ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y) |
46 | 46 | ||
47 | $(PLUGIN).o: $(PLUGIN).S FORCE | 47 | $(PLUGIN).o: $(PLUGIN).S FORCE |
48 | $(Q)mkdir -p $(dir $@) | 48 | $(Q)mkdir -p $(dir $@) |
49 | $(call if_changed_dep,as_o_S) | 49 | $(call if_changed_dep,as_o_S) |
50 | 50 | ||
51 | $(PLUGIN).bin: $(PLUGIN).o FORCE | 51 | $(PLUGIN).bin: $(PLUGIN).o FORCE |
52 | $(Q)mkdir -p $(dir $@) | 52 | $(Q)mkdir -p $(dir $@) |
53 | $(OBJCOPY) -O binary --gap-fill 0xff $< $@ | 53 | $(OBJCOPY) -O binary --gap-fill 0xff $< $@ |
54 | else | 54 | else |
55 | 55 | ||
56 | $(PLUGIN).bin: | 56 | $(PLUGIN).bin: |
57 | 57 | ||
58 | endif | 58 | endif |
59 | 59 | ||
60 | quiet_cmd_cpp_cfg = CFGS $@ | 60 | quiet_cmd_cpp_cfg = CFGS $@ |
61 | cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $< | 61 | cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $< |
62 | 62 | ||
63 | IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%).cfgtmp | 63 | IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%).cfgtmp |
64 | 64 | ||
65 | $(IMX_CONFIG): %.cfgtmp: % FORCE | 65 | $(IMX_CONFIG): %.cfgtmp: % FORCE |
66 | $(Q)mkdir -p $(dir $@) | 66 | $(Q)mkdir -p $(dir $@) |
67 | $(call if_changed_dep,cpp_cfg) | 67 | $(call if_changed_dep,cpp_cfg) |
68 | 68 | ||
69 | MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ | 69 | MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ |
70 | -e $(CONFIG_SYS_TEXT_BASE) | 70 | -e $(CONFIG_SYS_TEXT_BASE) |
71 | u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log | ||
71 | 72 | ||
72 | u-boot.imx: u-boot.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE | 73 | u-boot.imx: u-boot.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE |
73 | $(call if_changed,mkimage) | 74 | $(call if_changed,mkimage) |
74 | 75 | ||
75 | ifeq ($(CONFIG_OF_SEPARATE),y) | 76 | ifeq ($(CONFIG_OF_SEPARATE),y) |
76 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ | 77 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ |
77 | -e $(CONFIG_SYS_TEXT_BASE) | 78 | -e $(CONFIG_SYS_TEXT_BASE) |
79 | u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log | ||
78 | 80 | ||
79 | u-boot-dtb.imx: u-boot-dtb.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE | 81 | u-boot-dtb.imx: u-boot-dtb.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE |
80 | $(call if_changed,mkimage) | 82 | $(call if_changed,mkimage) |
81 | endif | 83 | endif |
82 | 84 | ||
83 | MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ | 85 | MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \ |
84 | -e $(CONFIG_SPL_TEXT_BASE) | 86 | -e $(CONFIG_SPL_TEXT_BASE) |
87 | |||
88 | SPL: MKIMAGEOUTPUT = SPL.log | ||
85 | 89 | ||
86 | SPL: spl/u-boot-spl.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE | 90 | SPL: spl/u-boot-spl.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE |
87 | $(call if_changed,mkimage) | 91 | $(call if_changed,mkimage) |
88 | 92 | ||
89 | MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \ | 93 | MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \ |
90 | -e $(CONFIG_SYS_TEXT_BASE) -C none -T firmware | 94 | -e $(CONFIG_SYS_TEXT_BASE) -C none -T firmware |
91 | 95 | ||
92 | u-boot.uim: u-boot.bin FORCE | 96 | u-boot.uim: u-boot.bin FORCE |
93 | $(call if_changed,mkimage) | 97 | $(call if_changed,mkimage) |
94 | 98 | ||
95 | OBJCOPYFLAGS += -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | 99 | OBJCOPYFLAGS += -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) |
96 | append = cat $(filter-out $< $(PHONY), $^) >> $@ | 100 | append = cat $(filter-out $< $(PHONY), $^) >> $@ |
97 | 101 | ||
98 | quiet_cmd_pad_cat = CAT $@ | 102 | quiet_cmd_pad_cat = CAT $@ |
99 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ | 103 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ |
100 | 104 | ||
101 | u-boot-with-spl.imx: SPL u-boot.uim FORCE | 105 | u-boot-with-spl.imx: SPL u-boot.uim FORCE |
102 | $(call if_changed,pad_cat) | 106 | $(call if_changed,pad_cat) |
103 | 107 | ||
104 | u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE | 108 | u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE |
105 | $(call if_changed,pad_cat) | 109 | $(call if_changed,pad_cat) |
106 | 110 | ||
107 | quiet_cmd_u-boot-nand-spl_imx = GEN $@ | 111 | quiet_cmd_u-boot-nand-spl_imx = GEN $@ |
108 | cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ | 112 | cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ |
109 | dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@ | 113 | dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@ |
110 | 114 | ||
111 | spl/u-boot-nand-spl.imx: SPL FORCE | 115 | spl/u-boot-nand-spl.imx: SPL FORCE |
112 | $(call if_changed,u-boot-nand-spl_imx) | 116 | $(call if_changed,u-boot-nand-spl_imx) |
113 | 117 | ||
114 | targets += $(addprefix ../../../,$(IMX_CONFIG) SPL u-boot.uim spl/u-boot-nand-spl.imx) | 118 | targets += $(addprefix ../../../,$(IMX_CONFIG) SPL u-boot.uim spl/u-boot-nand-spl.imx) |
115 | 119 |
doc/README.imx6
1 | U-Boot for Freescale i.MX6 | 1 | U-Boot for Freescale i.MX6 |
2 | 2 | ||
3 | This file contains information for the port of U-Boot to the Freescale i.MX6 | 3 | This file contains information for the port of U-Boot to the Freescale i.MX6 |
4 | SoC. | 4 | SoC. |
5 | 5 | ||
6 | 1. CONVENTIONS FOR FUSE ASSIGNMENTS | 6 | 1. CONVENTIONS FOR FUSE ASSIGNMENTS |
7 | ----------------------------------- | 7 | ----------------------------------- |
8 | 8 | ||
9 | 1.1 MAC Address: It is stored in fuse bank 4, with the 32 lsbs in word 2 and the | 9 | 1.1 MAC Address: It is stored in fuse bank 4, with the 32 lsbs in word 2 and the |
10 | 16 msbs in word 3[15:0]. | 10 | 16 msbs in word 3[15:0]. |
11 | For i.MX6SX and i.MX6UL, they have two MAC addresses. The second MAC address | 11 | For i.MX6SX and i.MX6UL, they have two MAC addresses. The second MAC address |
12 | is stored in fuse bank 4, with the 16 lsb in word 3[31:16] and the 32 msbs in | 12 | is stored in fuse bank 4, with the 16 lsb in word 3[31:16] and the 32 msbs in |
13 | word 4. | 13 | word 4. |
14 | 14 | ||
15 | Example: | 15 | Example: |
16 | 16 | ||
17 | For reading the MAC address fuses on a MX6Q: | 17 | For reading the MAC address fuses on a MX6Q: |
18 | 18 | ||
19 | - The MAC address is stored in two fuse addresses (the fuse addresses are | 19 | - The MAC address is stored in two fuse addresses (the fuse addresses are |
20 | described in the Fusemap Descriptions table from the mx6q Reference Manual): | 20 | described in the Fusemap Descriptions table from the mx6q Reference Manual): |
21 | 21 | ||
22 | 0x620[31:0] - MAC_ADDR[31:0] | 22 | 0x620[31:0] - MAC_ADDR[31:0] |
23 | 0x630[15:0] - MAC_ADDR[47:32] | 23 | 0x630[15:0] - MAC_ADDR[47:32] |
24 | 24 | ||
25 | In order to use the fuse API, we need to pass the bank and word values, which | 25 | In order to use the fuse API, we need to pass the bank and word values, which |
26 | are calculated as below: | 26 | are calculated as below: |
27 | 27 | ||
28 | Fuse address for the lower MAC address: 0x620 | 28 | Fuse address for the lower MAC address: 0x620 |
29 | Base address for the fuses: 0x400 | 29 | Base address for the fuses: 0x400 |
30 | 30 | ||
31 | (0x620 - 0x400)/0x10 = 0x22 = 34 decimal | 31 | (0x620 - 0x400)/0x10 = 0x22 = 34 decimal |
32 | 32 | ||
33 | As the fuses are arranged in banks of 8 words: | 33 | As the fuses are arranged in banks of 8 words: |
34 | 34 | ||
35 | 34 / 8 = 4 and the remainder is 2, so in this case: | 35 | 34 / 8 = 4 and the remainder is 2, so in this case: |
36 | 36 | ||
37 | bank = 4 | 37 | bank = 4 |
38 | word = 2 | 38 | word = 2 |
39 | 39 | ||
40 | And the U-Boot command would be: | 40 | And the U-Boot command would be: |
41 | 41 | ||
42 | => fuse read 4 2 | 42 | => fuse read 4 2 |
43 | Reading bank 4: | 43 | Reading bank 4: |
44 | 44 | ||
45 | Word 0x00000002: 9f027772 | 45 | Word 0x00000002: 9f027772 |
46 | 46 | ||
47 | Doing the same for the upper MAC address: | 47 | Doing the same for the upper MAC address: |
48 | 48 | ||
49 | Fuse address for the upper MAC address: 0x630 | 49 | Fuse address for the upper MAC address: 0x630 |
50 | Base address for the fuses: 0x400 | 50 | Base address for the fuses: 0x400 |
51 | 51 | ||
52 | (0x630 - 0x400)/0x10 = 0x23 = 35 decimal | 52 | (0x630 - 0x400)/0x10 = 0x23 = 35 decimal |
53 | 53 | ||
54 | As the fuses are arranged in banks of 8 words: | 54 | As the fuses are arranged in banks of 8 words: |
55 | 55 | ||
56 | 35 / 8 = 4 and the remainder is 3, so in this case: | 56 | 35 / 8 = 4 and the remainder is 3, so in this case: |
57 | 57 | ||
58 | bank = 4 | 58 | bank = 4 |
59 | word = 3 | 59 | word = 3 |
60 | 60 | ||
61 | And the U-Boot command would be: | 61 | And the U-Boot command would be: |
62 | 62 | ||
63 | => fuse read 4 3 | 63 | => fuse read 4 3 |
64 | Reading bank 4: | 64 | Reading bank 4: |
65 | 65 | ||
66 | Word 0x00000003: 00000004 | 66 | Word 0x00000003: 00000004 |
67 | 67 | ||
68 | ,which matches the ethaddr value: | 68 | ,which matches the ethaddr value: |
69 | => echo ${ethaddr} | 69 | => echo ${ethaddr} |
70 | 00:04:9f:02:77:72 | 70 | 00:04:9f:02:77:72 |
71 | 71 | ||
72 | Some other useful hints: | 72 | Some other useful hints: |
73 | 73 | ||
74 | - The 'bank' and 'word' numbers can be easily obtained from the mx6 Reference | 74 | - The 'bank' and 'word' numbers can be easily obtained from the mx6 Reference |
75 | Manual. For the mx6quad case, please check the "46.5 OCOTP Memory Map/Register | 75 | Manual. For the mx6quad case, please check the "46.5 OCOTP Memory Map/Register |
76 | Definition" from the "i.MX 6Dual/6Quad Applications Processor Reference Manual, | 76 | Definition" from the "i.MX 6Dual/6Quad Applications Processor Reference Manual, |
77 | Rev. 1, 04/2013" document. For example, for the MAC fuses we have: | 77 | Rev. 1, 04/2013" document. For example, for the MAC fuses we have: |
78 | 78 | ||
79 | Address: | 79 | Address: |
80 | 21B_C620 Value of OTP Bank4 Word2 (MAC Address)(OCOTP_MAC0) | 80 | 21B_C620 Value of OTP Bank4 Word2 (MAC Address)(OCOTP_MAC0) |
81 | 81 | ||
82 | 21B_C630 Value of OTP Bank4 Word3 (MAC Address)(OCOTP_MAC1) | 82 | 21B_C630 Value of OTP Bank4 Word3 (MAC Address)(OCOTP_MAC1) |
83 | 83 | ||
84 | - The command '=> fuse read 4 2 2' reads the whole MAC addresses at once: | 84 | - The command '=> fuse read 4 2 2' reads the whole MAC addresses at once: |
85 | 85 | ||
86 | => fuse read 4 2 2 | 86 | => fuse read 4 2 2 |
87 | Reading bank 4: | 87 | Reading bank 4: |
88 | 88 | ||
89 | Word 0x00000002: 9f027772 00000004 | 89 | Word 0x00000002: 9f027772 00000004 |
90 | 90 | ||
91 | 2. Using imx_usb_loader for first install with SPL | 91 | 2. Using imx_usb_loader for first install with SPL |
92 | -------------------------------------------------- | 92 | -------------------------------------------------- |
93 | 93 | ||
94 | imx_usb_loader is a very nice tool by Boundary Devices that | 94 | imx_usb_loader is a very nice tool by Boundary Devices that |
95 | allow to install U-Boot without a JTAG debugger, using | 95 | allow to install U-Boot without a JTAG debugger, using |
96 | the USB boot mode as described in the manual. It is | 96 | the USB boot mode as described in the manual. It is |
97 | a replacement for Freescale's MFGTOOLS. | 97 | a replacement for Freescale's MFGTOOLS. |
98 | 98 | ||
99 | The sources can be found here: | 99 | The sources can be found here: |
100 | 100 | ||
101 | https://github.com/boundarydevices/imx_usb_loader.git | 101 | https://github.com/boundarydevices/imx_usb_loader.git |
102 | 102 | ||
103 | Booting in USB mode, the i.MX6 announces itself to the Linux Host as: | 103 | Booting in USB mode, the i.MX6 announces itself to the Linux Host as: |
104 | 104 | ||
105 | Bus 001 Device 111: ID 15a2:0061 Freescale Semiconductor, Inc. | 105 | Bus 001 Device 111: ID 15a2:0061 Freescale Semiconductor, Inc. |
106 | 106 | ||
107 | imx_usb_loader is able to download a single file (u-boot.imx) | 107 | imx_usb_loader is able to download a single file (u-boot.imx) |
108 | to the board. For boards without SPL support, it is enough to | 108 | to the board. For boards without SPL support, it is enough to |
109 | issue the command: | 109 | issue the command: |
110 | 110 | ||
111 | sudo ../imx_usb_loader/imx_usb -v u-boot.imx | 111 | sudo ../imx_usb_loader/imx_usb -v u-boot.imx |
112 | 112 | ||
113 | Getting U-Boot when SPL support is active, it requires | 113 | Getting U-Boot when SPL support is active, it requires |
114 | two downloads. imx_usb_loader downloads the SPL into | 114 | two downloads. imx_usb_loader downloads the SPL into |
115 | OCRAM and starts it. SPL will check for a valid u-boot.img, and | 115 | OCRAM and starts it. SPL will check for a valid u-boot.img, and |
116 | because it is not found, it will wait for it using the y-modem | 116 | because it is not found, it will wait for it using the y-modem |
117 | protocol via the console. | 117 | protocol via the console. |
118 | 118 | ||
119 | A first install is then possible by combining imx_usb_loader with | 119 | A first install is then possible by combining imx_usb_loader with |
120 | another tool such as kermit. | 120 | another tool such as kermit. |
121 | 121 | ||
122 | sudo ../imx_usb_loader/imx_usb -v SPL | 122 | sudo ../imx_usb_loader/imx_usb -v SPL |
123 | kermit kermit_uboot | 123 | kermit kermit_uboot |
124 | 124 | ||
125 | and kermit_uboot contains something like this (set line should be adjusted): | 125 | and kermit_uboot contains something like this (set line should be adjusted): |
126 | 126 | ||
127 | set line /dev/ttyUSB1 | 127 | set line /dev/ttyUSB1 |
128 | set speed 115200 | 128 | set speed 115200 |
129 | SET CARRIER-WATCH OFF | 129 | SET CARRIER-WATCH OFF |
130 | set flow-control none | 130 | set flow-control none |
131 | set handshake none | 131 | set handshake none |
132 | set prefixing all | 132 | set prefixing all |
133 | set file type bin | 133 | set file type bin |
134 | set protocol ymodem | 134 | set protocol ymodem |
135 | send u-boot.img | 135 | send u-boot.img |
136 | c | 136 | c |
137 | 137 | ||
138 | The last "c" command tells kermit (from ckermit package in most distros) | 138 | The last "c" command tells kermit (from ckermit package in most distros) |
139 | to switch from command line mode to communication mode, and when the | 139 | to switch from command line mode to communication mode, and when the |
140 | script is finished, the U-Boot prompt is shown in the same shell. | 140 | script is finished, the U-Boot prompt is shown in the same shell. |
141 | 141 | ||
142 | 3. Using Secure Boot on i.MX6 machines with SPL support | 142 | 3. Using Secure Boot on i.MX6 machines with SPL support |
143 | ------------------------------------------------------- | 143 | ------------------------------------------------------- |
144 | 144 | ||
145 | This version of U-Boot is able to build a signable version of the SPL | 145 | This version of U-Boot is able to build a signable version of the SPL |
146 | as well as a signable version of the U-Boot image. The signature can | 146 | as well as a signable version of the U-Boot image. The signature can |
147 | be verified through High Assurance Boot (HAB). | 147 | be verified through High Assurance Boot (HAB). |
148 | 148 | ||
149 | CONFIG_SECURE_BOOT is needed to build those two binaries. | 149 | CONFIG_SECURE_BOOT is needed to build those two binaries. |
150 | After building, you need to create a command sequence file and use | 150 | After building, you need to create a command sequence file and use |
151 | Freescales Code Signing Tool to sign both binaries. After creation, | 151 | Freescales Code Signing Tool to sign both binaries. After creation, |
152 | the mkimage tool outputs the required information about the HAB Blocks | 152 | the mkimage tool outputs the required information about the HAB Blocks |
153 | parameter for the CSF. | 153 | parameter for the CSF. During the build, the information is preserved |
154 | in log files named as the binaries. (SPL.log and u-boot-ivt.log). | ||
154 | 155 | ||
155 | More information about the CSF and HAB can be found in the AN4581. | 156 | More information about the CSF and HAB can be found in the AN4581. |
156 | https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf | 157 | https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf |
157 | 158 | ||
158 | We don't want to explain how to create a PKI tree or SRK table as | 159 | We don't want to explain how to create a PKI tree or SRK table as |
159 | this is well explained in the Application Note. | 160 | this is well explained in the Application Note. |
160 | 161 | ||
161 | Example Output of the SPL (imximage) creation: | 162 | Example Output of the SPL (imximage) creation: |
162 | Image Type: Freescale IMX Boot Image | 163 | Image Type: Freescale IMX Boot Image |
163 | Image Ver: 2 (i.MX53/6/7 compatible) | 164 | Image Ver: 2 (i.MX53/6/7 compatible) |
164 | Mode: DCD | 165 | Mode: DCD |
165 | Data Size: 61440 Bytes = 60.00 kB = 0.06 MB | 166 | Data Size: 61440 Bytes = 60.00 kB = 0.06 MB |
166 | Load Address: 00907420 | 167 | Load Address: 00907420 |
167 | Entry Point: 00908000 | 168 | Entry Point: 00908000 |
168 | HAB Blocks: 00907400 00000000 0000cc00 | 169 | HAB Blocks: 00907400 00000000 0000cc00 |
169 | 170 | ||
170 | Example Output of the u-boot-ivt.img (firmware_ivt) creation: | 171 | Example Output of the u-boot-ivt.img (firmware_ivt) creation: |
171 | Image Name: U-Boot 2016.11-rc1-31589-g2a4411 | 172 | Image Name: U-Boot 2016.11-rc1-31589-g2a4411 |
172 | Created: Sat Nov 5 21:53:28 2016 | 173 | Created: Sat Nov 5 21:53:28 2016 |
173 | Image Type: ARM U-Boot Firmware with HABv4 IVT (uncompressed) | 174 | Image Type: ARM U-Boot Firmware with HABv4 IVT (uncompressed) |
174 | Data Size: 352192 Bytes = 343.94 kB = 0.34 MB | 175 | Data Size: 352192 Bytes = 343.94 kB = 0.34 MB |
175 | Load Address: 17800000 | 176 | Load Address: 17800000 |
176 | Entry Point: 00000000 | 177 | Entry Point: 00000000 |
177 | HAB Blocks: 0x177fffc0 0x0000 0x00054020 | 178 | HAB Blocks: 0x177fffc0 0x0000 0x00054020 |
178 | 179 | ||
179 | The CST (Code Signing Tool) can be downloaded from NXP. | 180 | The CST (Code Signing Tool) can be downloaded from NXP. |
180 | # Compile CSF and create signature | 181 | # Compile CSF and create signature |
181 | ./cst --o csf-u-boot.bin < command_sequence_uboot.csf | 182 | ./cst --o csf-u-boot.bin < command_sequence_uboot.csf |
182 | ./cst --o csf-SPL.bin < command_sequence_spl.csf | 183 | ./cst --o csf-SPL.bin < command_sequence_spl.csf |
183 | # Append compiled CSF to Binary | 184 | # Append compiled CSF to Binary |
184 | cat SPL csf-SPL.bin > SPL-signed | 185 | cat SPL csf-SPL.bin > SPL-signed |
185 | cat u-boot-ivt.img csf-u-boot.bin > u-boot-signed.img | 186 | cat u-boot-ivt.img csf-u-boot.bin > u-boot-signed.img |
186 | 187 | ||
187 | These two signed binaries can be used on an i.MX6 in closed | 188 | These two signed binaries can be used on an i.MX6 in closed |
188 | configuration when the according SRK Table Hash has been flashed. | 189 | configuration when the according SRK Table Hash has been flashed. |
scripts/Makefile.lib
1 | # | 1 | # |
2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
3 | # | 3 | # |
4 | # Backward compatibility | 4 | # Backward compatibility |
5 | asflags-y += $(EXTRA_AFLAGS) | 5 | asflags-y += $(EXTRA_AFLAGS) |
6 | ccflags-y += $(EXTRA_CFLAGS) | 6 | ccflags-y += $(EXTRA_CFLAGS) |
7 | cppflags-y += $(EXTRA_CPPFLAGS) | 7 | cppflags-y += $(EXTRA_CPPFLAGS) |
8 | ldflags-y += $(EXTRA_LDFLAGS) | 8 | ldflags-y += $(EXTRA_LDFLAGS) |
9 | 9 | ||
10 | # | 10 | # |
11 | # flags that take effect in sub directories | 11 | # flags that take effect in sub directories |
12 | export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y) | 12 | export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y) |
13 | export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y) | 13 | export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y) |
14 | 14 | ||
15 | # Figure out what we need to build from the various variables | 15 | # Figure out what we need to build from the various variables |
16 | # =========================================================================== | 16 | # =========================================================================== |
17 | 17 | ||
18 | # When an object is listed to be built compiled-in and modular, | 18 | # When an object is listed to be built compiled-in and modular, |
19 | # only build the compiled-in version | 19 | # only build the compiled-in version |
20 | 20 | ||
21 | obj-m := $(filter-out $(obj-y),$(obj-m)) | 21 | obj-m := $(filter-out $(obj-y),$(obj-m)) |
22 | 22 | ||
23 | # Libraries are always collected in one lib file. | 23 | # Libraries are always collected in one lib file. |
24 | # Filter out objects already built-in | 24 | # Filter out objects already built-in |
25 | 25 | ||
26 | lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) | 26 | lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) |
27 | 27 | ||
28 | 28 | ||
29 | # Handle objects in subdirs | 29 | # Handle objects in subdirs |
30 | # --------------------------------------------------------------------------- | 30 | # --------------------------------------------------------------------------- |
31 | # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o | 31 | # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o |
32 | # and add the directory to the list of dirs to descend into: $(subdir-y) | 32 | # and add the directory to the list of dirs to descend into: $(subdir-y) |
33 | # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) | 33 | # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) |
34 | # and add the directory to the list of dirs to descend into: $(subdir-m) | 34 | # and add the directory to the list of dirs to descend into: $(subdir-m) |
35 | 35 | ||
36 | # Determine modorder. | 36 | # Determine modorder. |
37 | # Unfortunately, we don't have information about ordering between -y | 37 | # Unfortunately, we don't have information about ordering between -y |
38 | # and -m subdirs. Just put -y's first. | 38 | # and -m subdirs. Just put -y's first. |
39 | modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) | 39 | modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) |
40 | 40 | ||
41 | __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) | 41 | __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) |
42 | subdir-y += $(__subdir-y) | 42 | subdir-y += $(__subdir-y) |
43 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) | 43 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) |
44 | subdir-m += $(__subdir-m) | 44 | subdir-m += $(__subdir-m) |
45 | obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) | 45 | obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) |
46 | obj-m := $(filter-out %/, $(obj-m)) | 46 | obj-m := $(filter-out %/, $(obj-m)) |
47 | 47 | ||
48 | # Subdirectories we need to descend into | 48 | # Subdirectories we need to descend into |
49 | 49 | ||
50 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) | 50 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) |
51 | 51 | ||
52 | # if $(foo-objs) exists, foo.o is a composite object | 52 | # if $(foo-objs) exists, foo.o is a composite object |
53 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 53 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) |
54 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 54 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) |
55 | multi-used := $(multi-used-y) $(multi-used-m) | 55 | multi-used := $(multi-used-y) $(multi-used-m) |
56 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | 56 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) |
57 | 57 | ||
58 | # Build list of the parts of our composite objects, our composite | 58 | # Build list of the parts of our composite objects, our composite |
59 | # objects depend on those (obviously) | 59 | # objects depend on those (obviously) |
60 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) | 60 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) |
61 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) | 61 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) |
62 | multi-objs := $(multi-objs-y) $(multi-objs-m) | 62 | multi-objs := $(multi-objs-y) $(multi-objs-m) |
63 | 63 | ||
64 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to | 64 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to |
65 | # tell kbuild to descend | 65 | # tell kbuild to descend |
66 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) | 66 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) |
67 | 67 | ||
68 | # $(obj-dirs) is a list of directories that contain object files | 68 | # $(obj-dirs) is a list of directories that contain object files |
69 | obj-dirs := $(dir $(multi-objs) $(obj-y)) | 69 | obj-dirs := $(dir $(multi-objs) $(obj-y)) |
70 | 70 | ||
71 | # Replace multi-part objects by their individual parts, look at local dir only | 71 | # Replace multi-part objects by their individual parts, look at local dir only |
72 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) | 72 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) |
73 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | 73 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) |
74 | 74 | ||
75 | # Add subdir path | 75 | # Add subdir path |
76 | 76 | ||
77 | extra-y := $(addprefix $(obj)/,$(extra-y)) | 77 | extra-y := $(addprefix $(obj)/,$(extra-y)) |
78 | always := $(addprefix $(obj)/,$(always)) | 78 | always := $(addprefix $(obj)/,$(always)) |
79 | targets := $(addprefix $(obj)/,$(targets)) | 79 | targets := $(addprefix $(obj)/,$(targets)) |
80 | modorder := $(addprefix $(obj)/,$(modorder)) | 80 | modorder := $(addprefix $(obj)/,$(modorder)) |
81 | obj-y := $(addprefix $(obj)/,$(obj-y)) | 81 | obj-y := $(addprefix $(obj)/,$(obj-y)) |
82 | obj-m := $(addprefix $(obj)/,$(obj-m)) | 82 | obj-m := $(addprefix $(obj)/,$(obj-m)) |
83 | lib-y := $(addprefix $(obj)/,$(lib-y)) | 83 | lib-y := $(addprefix $(obj)/,$(lib-y)) |
84 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) | 84 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) |
85 | real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) | 85 | real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) |
86 | real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) | 86 | real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) |
87 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) | 87 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) |
88 | multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) | 88 | multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) |
89 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) | 89 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) |
90 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) | 90 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) |
91 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) | 91 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) |
92 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | 92 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) |
93 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | 93 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) |
94 | 94 | ||
95 | # These flags are needed for modversions and compiling, so we define them here | 95 | # These flags are needed for modversions and compiling, so we define them here |
96 | # already | 96 | # already |
97 | # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will | 97 | # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will |
98 | # end up in (or would, if it gets compiled in) | 98 | # end up in (or would, if it gets compiled in) |
99 | # Note: Files that end up in two or more modules are compiled without the | 99 | # Note: Files that end up in two or more modules are compiled without the |
100 | # KBUILD_MODNAME definition. The reason is that any made-up name would | 100 | # KBUILD_MODNAME definition. The reason is that any made-up name would |
101 | # differ in different configs. | 101 | # differ in different configs. |
102 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) | 102 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) |
103 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | 103 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" |
104 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 104 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
105 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 105 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
106 | 106 | ||
107 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ | 107 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ |
108 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | 108 | $(ccflags-y) $(CFLAGS_$(basetarget).o) |
109 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 109 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
110 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ | 110 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ |
111 | $(asflags-y) $(AFLAGS_$(basetarget).o) | 111 | $(asflags-y) $(AFLAGS_$(basetarget).o) |
112 | _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) | 112 | _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) |
113 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | 113 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) |
114 | 114 | ||
115 | # | 115 | # |
116 | # Enable gcov profiling flags for a file, directory or for all files depending | 116 | # Enable gcov profiling flags for a file, directory or for all files depending |
117 | # on variables GCOV_PROFILE_obj.o, GCOV_PROFILE and CONFIG_GCOV_PROFILE_ALL | 117 | # on variables GCOV_PROFILE_obj.o, GCOV_PROFILE and CONFIG_GCOV_PROFILE_ALL |
118 | # (in this order) | 118 | # (in this order) |
119 | # | 119 | # |
120 | ifeq ($(CONFIG_GCOV_KERNEL),y) | 120 | ifeq ($(CONFIG_GCOV_KERNEL),y) |
121 | _c_flags += $(if $(patsubst n%,, \ | 121 | _c_flags += $(if $(patsubst n%,, \ |
122 | $(GCOV_PROFILE_$(basetarget).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \ | 122 | $(GCOV_PROFILE_$(basetarget).o)$(GCOV_PROFILE)$(CONFIG_GCOV_PROFILE_ALL)), \ |
123 | $(CFLAGS_GCOV)) | 123 | $(CFLAGS_GCOV)) |
124 | endif | 124 | endif |
125 | 125 | ||
126 | # | 126 | # |
127 | # Enable address sanitizer flags for kernel except some files or directories | 127 | # Enable address sanitizer flags for kernel except some files or directories |
128 | # we don't want to check (depends on variables KASAN_SANITIZE_obj.o, KASAN_SANITIZE) | 128 | # we don't want to check (depends on variables KASAN_SANITIZE_obj.o, KASAN_SANITIZE) |
129 | # | 129 | # |
130 | ifeq ($(CONFIG_KASAN),y) | 130 | ifeq ($(CONFIG_KASAN),y) |
131 | _c_flags += $(if $(patsubst n%,, \ | 131 | _c_flags += $(if $(patsubst n%,, \ |
132 | $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \ | 132 | $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \ |
133 | $(CFLAGS_KASAN)) | 133 | $(CFLAGS_KASAN)) |
134 | endif | 134 | endif |
135 | 135 | ||
136 | # If building the kernel in a separate objtree expand all occurrences | 136 | # If building the kernel in a separate objtree expand all occurrences |
137 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | 137 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). |
138 | 138 | ||
139 | ifeq ($(KBUILD_SRC),) | 139 | ifeq ($(KBUILD_SRC),) |
140 | __c_flags = $(_c_flags) | 140 | __c_flags = $(_c_flags) |
141 | __a_flags = $(_a_flags) | 141 | __a_flags = $(_a_flags) |
142 | __cpp_flags = $(_cpp_flags) | 142 | __cpp_flags = $(_cpp_flags) |
143 | else | 143 | else |
144 | 144 | ||
145 | # -I$(obj) locates generated .h files | 145 | # -I$(obj) locates generated .h files |
146 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files | 146 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files |
147 | # and locates generated .h files | 147 | # and locates generated .h files |
148 | # FIXME: Replace both with specific CFLAGS* statements in the makefiles | 148 | # FIXME: Replace both with specific CFLAGS* statements in the makefiles |
149 | __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) | 149 | __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) |
150 | __a_flags = $(call flags,_a_flags) | 150 | __a_flags = $(call flags,_a_flags) |
151 | __cpp_flags = $(call flags,_cpp_flags) | 151 | __cpp_flags = $(call flags,_cpp_flags) |
152 | endif | 152 | endif |
153 | 153 | ||
154 | # Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE | 154 | # Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE |
155 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ | 155 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ |
156 | $(__c_flags) $(modkern_cflags) \ | 156 | $(__c_flags) $(modkern_cflags) \ |
157 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) | 157 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) |
158 | 158 | ||
159 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ | 159 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ |
160 | $(__a_flags) $(modkern_aflags) | 160 | $(__a_flags) $(modkern_aflags) |
161 | 161 | ||
162 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ | 162 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ |
163 | $(__cpp_flags) | 163 | $(__cpp_flags) |
164 | 164 | ||
165 | ld_flags = $(LDFLAGS) $(ldflags-y) | 165 | ld_flags = $(LDFLAGS) $(ldflags-y) |
166 | 166 | ||
167 | dts_dir = $(srctree)/arch/$(ARCH)/dts | 167 | dts_dir = $(srctree)/arch/$(ARCH)/dts |
168 | 168 | ||
169 | # Try these files in order to find the U-Boot-specific .dtsi include file | 169 | # Try these files in order to find the U-Boot-specific .dtsi include file |
170 | u_boot_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ | 170 | u_boot_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \ |
171 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \ | 171 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \ |
172 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ | 172 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \ |
173 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ | 173 | $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \ |
174 | $(wildcard $(dts_dir)/u-boot.dtsi) | 174 | $(wildcard $(dts_dir)/u-boot.dtsi) |
175 | 175 | ||
176 | # Uncomment for debugging | 176 | # Uncomment for debugging |
177 | # $(warning u_boot_dtsi_options: $(u_boot_dtsi_options)) | 177 | # $(warning u_boot_dtsi_options: $(u_boot_dtsi_options)) |
178 | 178 | ||
179 | # We use the first match | 179 | # We use the first match |
180 | u_boot_dtsi = $(firstword $(u_boot_dtsi_options)) | 180 | u_boot_dtsi = $(firstword $(u_boot_dtsi_options)) |
181 | 181 | ||
182 | # Modified for U-Boot | 182 | # Modified for U-Boot |
183 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ | 183 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ |
184 | -I$(srctree)/arch/$(ARCH)/dts \ | 184 | -I$(srctree)/arch/$(ARCH)/dts \ |
185 | -I$(srctree)/arch/$(ARCH)/dts/include \ | 185 | -I$(srctree)/arch/$(ARCH)/dts/include \ |
186 | -Iinclude \ | 186 | -Iinclude \ |
187 | -I$(srctree)/include \ | 187 | -I$(srctree)/include \ |
188 | -I$(srctree)/arch/$(ARCH)/include \ | 188 | -I$(srctree)/arch/$(ARCH)/include \ |
189 | -include $(srctree)/include/linux/kconfig.h \ | 189 | -include $(srctree)/include/linux/kconfig.h \ |
190 | -D__ASSEMBLY__ \ | 190 | -D__ASSEMBLY__ \ |
191 | -undef -D__DTS__ | 191 | -undef -D__DTS__ |
192 | 192 | ||
193 | # Finds the multi-part object the current object will be linked into | 193 | # Finds the multi-part object the current object will be linked into |
194 | modname-multi = $(sort $(foreach m,$(multi-used),\ | 194 | modname-multi = $(sort $(foreach m,$(multi-used),\ |
195 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) | 195 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) |
196 | 196 | ||
197 | # Useful for describing the dependency of composite objects | 197 | # Useful for describing the dependency of composite objects |
198 | # Usage: | 198 | # Usage: |
199 | # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) | 199 | # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) |
200 | define multi_depend | 200 | define multi_depend |
201 | $(foreach m, $(notdir $1), \ | 201 | $(foreach m, $(notdir $1), \ |
202 | $(eval $(obj)/$m: \ | 202 | $(eval $(obj)/$m: \ |
203 | $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) | 203 | $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) |
204 | endef | 204 | endef |
205 | 205 | ||
206 | ifdef REGENERATE_PARSERS | 206 | ifdef REGENERATE_PARSERS |
207 | 207 | ||
208 | # GPERF | 208 | # GPERF |
209 | # --------------------------------------------------------------------------- | 209 | # --------------------------------------------------------------------------- |
210 | quiet_cmd_gperf = GPERF $@ | 210 | quiet_cmd_gperf = GPERF $@ |
211 | cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< | 211 | cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< |
212 | 212 | ||
213 | .PRECIOUS: $(src)/%.hash.c_shipped | 213 | .PRECIOUS: $(src)/%.hash.c_shipped |
214 | $(src)/%.hash.c_shipped: $(src)/%.gperf | 214 | $(src)/%.hash.c_shipped: $(src)/%.gperf |
215 | $(call cmd,gperf) | 215 | $(call cmd,gperf) |
216 | 216 | ||
217 | # LEX | 217 | # LEX |
218 | # --------------------------------------------------------------------------- | 218 | # --------------------------------------------------------------------------- |
219 | LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy) | 219 | LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy) |
220 | 220 | ||
221 | quiet_cmd_flex = LEX $@ | 221 | quiet_cmd_flex = LEX $@ |
222 | cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $< | 222 | cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $< |
223 | 223 | ||
224 | .PRECIOUS: $(src)/%.lex.c_shipped | 224 | .PRECIOUS: $(src)/%.lex.c_shipped |
225 | $(src)/%.lex.c_shipped: $(src)/%.l | 225 | $(src)/%.lex.c_shipped: $(src)/%.l |
226 | $(call cmd,flex) | 226 | $(call cmd,flex) |
227 | 227 | ||
228 | # YACC | 228 | # YACC |
229 | # --------------------------------------------------------------------------- | 229 | # --------------------------------------------------------------------------- |
230 | YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy) | 230 | YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy) |
231 | 231 | ||
232 | quiet_cmd_bison = YACC $@ | 232 | quiet_cmd_bison = YACC $@ |
233 | cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $< | 233 | cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $< |
234 | 234 | ||
235 | .PRECIOUS: $(src)/%.tab.c_shipped | 235 | .PRECIOUS: $(src)/%.tab.c_shipped |
236 | $(src)/%.tab.c_shipped: $(src)/%.y | 236 | $(src)/%.tab.c_shipped: $(src)/%.y |
237 | $(call cmd,bison) | 237 | $(call cmd,bison) |
238 | 238 | ||
239 | quiet_cmd_bison_h = YACC $@ | 239 | quiet_cmd_bison_h = YACC $@ |
240 | cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $< | 240 | cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $< |
241 | 241 | ||
242 | .PRECIOUS: $(src)/%.tab.h_shipped | 242 | .PRECIOUS: $(src)/%.tab.h_shipped |
243 | $(src)/%.tab.h_shipped: $(src)/%.y | 243 | $(src)/%.tab.h_shipped: $(src)/%.y |
244 | $(call cmd,bison_h) | 244 | $(call cmd,bison_h) |
245 | 245 | ||
246 | endif | 246 | endif |
247 | 247 | ||
248 | # Shipped files | 248 | # Shipped files |
249 | # =========================================================================== | 249 | # =========================================================================== |
250 | 250 | ||
251 | quiet_cmd_shipped = SHIPPED $@ | 251 | quiet_cmd_shipped = SHIPPED $@ |
252 | cmd_shipped = cat $< > $@ | 252 | cmd_shipped = cat $< > $@ |
253 | 253 | ||
254 | $(obj)/%: $(src)/%_shipped | 254 | $(obj)/%: $(src)/%_shipped |
255 | $(call cmd,shipped) | 255 | $(call cmd,shipped) |
256 | 256 | ||
257 | # Commands useful for building a boot image | 257 | # Commands useful for building a boot image |
258 | # =========================================================================== | 258 | # =========================================================================== |
259 | # | 259 | # |
260 | # Use as following: | 260 | # Use as following: |
261 | # | 261 | # |
262 | # target: source(s) FORCE | 262 | # target: source(s) FORCE |
263 | # $(if_changed,ld/objcopy/gzip) | 263 | # $(if_changed,ld/objcopy/gzip) |
264 | # | 264 | # |
265 | # and add target to extra-y so that we know we have to | 265 | # and add target to extra-y so that we know we have to |
266 | # read in the saved command line | 266 | # read in the saved command line |
267 | 267 | ||
268 | # Linking | 268 | # Linking |
269 | # --------------------------------------------------------------------------- | 269 | # --------------------------------------------------------------------------- |
270 | 270 | ||
271 | quiet_cmd_ld = LD $@ | 271 | quiet_cmd_ld = LD $@ |
272 | cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ | 272 | cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ |
273 | $(filter-out FORCE,$^) -o $@ | 273 | $(filter-out FORCE,$^) -o $@ |
274 | 274 | ||
275 | # Objcopy | 275 | # Objcopy |
276 | # --------------------------------------------------------------------------- | 276 | # --------------------------------------------------------------------------- |
277 | 277 | ||
278 | quiet_cmd_objcopy = OBJCOPY $@ | 278 | quiet_cmd_objcopy = OBJCOPY $@ |
279 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ | 279 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ |
280 | 280 | ||
281 | # Gzip | 281 | # Gzip |
282 | # --------------------------------------------------------------------------- | 282 | # --------------------------------------------------------------------------- |
283 | 283 | ||
284 | quiet_cmd_gzip = GZIP $@ | 284 | quiet_cmd_gzip = GZIP $@ |
285 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ | 285 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ |
286 | (rm -f $@ ; false) | 286 | (rm -f $@ ; false) |
287 | 287 | ||
288 | # DTC | 288 | # DTC |
289 | # --------------------------------------------------------------------------- | 289 | # --------------------------------------------------------------------------- |
290 | 290 | ||
291 | # Generate an assembly file to wrap the output of the device tree compiler | 291 | # Generate an assembly file to wrap the output of the device tree compiler |
292 | quiet_cmd_dt_S_dtb= DTB $@ | 292 | quiet_cmd_dt_S_dtb= DTB $@ |
293 | # Modified for U-Boot | 293 | # Modified for U-Boot |
294 | cmd_dt_S_dtb= \ | 294 | cmd_dt_S_dtb= \ |
295 | ( \ | 295 | ( \ |
296 | echo '.section .dtb.init.rodata,"a"'; \ | 296 | echo '.section .dtb.init.rodata,"a"'; \ |
297 | echo '.balign 16'; \ | 297 | echo '.balign 16'; \ |
298 | echo '.global __dtb_$(subst -,_,$(*F))_begin'; \ | 298 | echo '.global __dtb_$(subst -,_,$(*F))_begin'; \ |
299 | echo '__dtb_$(subst -,_,$(*F))_begin:'; \ | 299 | echo '__dtb_$(subst -,_,$(*F))_begin:'; \ |
300 | echo '.incbin "$<" '; \ | 300 | echo '.incbin "$<" '; \ |
301 | echo '__dtb_$(subst -,_,$(*F))_end:'; \ | 301 | echo '__dtb_$(subst -,_,$(*F))_end:'; \ |
302 | echo '.global __dtb_$(subst -,_,$(*F))_end'; \ | 302 | echo '.global __dtb_$(subst -,_,$(*F))_end'; \ |
303 | echo '.balign 16'; \ | 303 | echo '.balign 16'; \ |
304 | ) > $@ | 304 | ) > $@ |
305 | 305 | ||
306 | $(obj)/%.dtb.S: $(obj)/%.dtb | 306 | $(obj)/%.dtb.S: $(obj)/%.dtb |
307 | $(call cmd,dt_S_dtb) | 307 | $(call cmd,dt_S_dtb) |
308 | 308 | ||
309 | quiet_cmd_dtc = DTC $@ | 309 | quiet_cmd_dtc = DTC $@ |
310 | # Modified for U-Boot | 310 | # Modified for U-Boot |
311 | # Bring in any U-Boot-specific include after the '/dts-v1/;' header | 311 | # Bring in any U-Boot-specific include after the '/dts-v1/;' header |
312 | cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ | 312 | cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ |
313 | cat $< $(if $(u_boot_dtsi),\ | 313 | cat $< $(if $(u_boot_dtsi),\ |
314 | | sed 's%^/ {$$%\#include \"$(u_boot_dtsi)\"\n&%') | \ | 314 | | sed 's%^/ {$$%\#include \"$(u_boot_dtsi)\"\n&%') | \ |
315 | $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ | 315 | $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ |
316 | $(DTC) -O dtb -o $@ -b 0 \ | 316 | $(DTC) -O dtb -o $@ -b 0 \ |
317 | -i $(dir $<) $(DTC_FLAGS) \ | 317 | -i $(dir $<) $(DTC_FLAGS) \ |
318 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ | 318 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ |
319 | cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) | 319 | cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) |
320 | 320 | ||
321 | $(obj)/%.dtb: $(src)/%.dts FORCE | 321 | $(obj)/%.dtb: $(src)/%.dts FORCE |
322 | $(call if_changed_dep,dtc) | 322 | $(call if_changed_dep,dtc) |
323 | 323 | ||
324 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) | 324 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) |
325 | 325 | ||
326 | # Fonts | 326 | # Fonts |
327 | # --------------------------------------------------------------------------- | 327 | # --------------------------------------------------------------------------- |
328 | 328 | ||
329 | # Generate an assembly file to wrap the font data | 329 | # Generate an assembly file to wrap the font data |
330 | quiet_cmd_S_ttf= TTF $@ | 330 | quiet_cmd_S_ttf= TTF $@ |
331 | # Modified for U-Boot | 331 | # Modified for U-Boot |
332 | cmd_S_ttf= \ | 332 | cmd_S_ttf= \ |
333 | ( \ | 333 | ( \ |
334 | echo '.section .rodata.ttf.init,"a"'; \ | 334 | echo '.section .rodata.ttf.init,"a"'; \ |
335 | echo '.balign 16'; \ | 335 | echo '.balign 16'; \ |
336 | echo '.global __ttf_$(*F)_begin'; \ | 336 | echo '.global __ttf_$(*F)_begin'; \ |
337 | echo '__ttf_$(*F)_begin:'; \ | 337 | echo '__ttf_$(*F)_begin:'; \ |
338 | echo '.incbin "$<" '; \ | 338 | echo '.incbin "$<" '; \ |
339 | echo '__ttf_$(*F)_end:'; \ | 339 | echo '__ttf_$(*F)_end:'; \ |
340 | echo '.global __ttf_$(*F)_end'; \ | 340 | echo '.global __ttf_$(*F)_end'; \ |
341 | echo '.balign 16'; \ | 341 | echo '.balign 16'; \ |
342 | ) > $@ | 342 | ) > $@ |
343 | 343 | ||
344 | $(obj)/%.S: $(src)/%.ttf | 344 | $(obj)/%.S: $(src)/%.ttf |
345 | $(call cmd,S_ttf) | 345 | $(call cmd,S_ttf) |
346 | 346 | ||
347 | # EFI Hello World application | 347 | # EFI Hello World application |
348 | # --------------------------------------------------------------------------- | 348 | # --------------------------------------------------------------------------- |
349 | 349 | ||
350 | # Generate an assembly file to wrap the EFI app | 350 | # Generate an assembly file to wrap the EFI app |
351 | cmd_S_efi= \ | 351 | cmd_S_efi= \ |
352 | ( \ | 352 | ( \ |
353 | echo '.section .rodata.efi.init,"a"'; \ | 353 | echo '.section .rodata.efi.init,"a"'; \ |
354 | echo '.balign 16'; \ | 354 | echo '.balign 16'; \ |
355 | echo '.global __efi_hello_world_begin'; \ | 355 | echo '.global __efi_hello_world_begin'; \ |
356 | echo '__efi_hello_world_begin:'; \ | 356 | echo '__efi_hello_world_begin:'; \ |
357 | echo '.incbin "$<" '; \ | 357 | echo '.incbin "$<" '; \ |
358 | echo '__efi_hello_world_end:'; \ | 358 | echo '__efi_hello_world_end:'; \ |
359 | echo '.global __efi_hello_world_end'; \ | 359 | echo '.global __efi_hello_world_end'; \ |
360 | echo '.balign 16'; \ | 360 | echo '.balign 16'; \ |
361 | ) > $@ | 361 | ) > $@ |
362 | 362 | ||
363 | $(obj)/%_efi.S: $(obj)/%.efi | 363 | $(obj)/%_efi.S: $(obj)/%.efi |
364 | $(call cmd,S_efi) | 364 | $(call cmd,S_efi) |
365 | 365 | ||
366 | $(obj)/%.efi: $(obj)/%.so | 366 | $(obj)/%.efi: $(obj)/%.so |
367 | $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j .dynamic \ | 367 | $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j .dynamic \ |
368 | -j .dynsym -j .rel* -j .rela* -j .reloc \ | 368 | -j .dynsym -j .rel* -j .rela* -j .reloc \ |
369 | $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@ | 369 | $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@ |
370 | 370 | ||
371 | EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) | 371 | EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) |
372 | 372 | ||
373 | $(obj)/helloworld.so: $(EFI_LDS_PATH) | 373 | $(obj)/helloworld.so: $(EFI_LDS_PATH) |
374 | 374 | ||
375 | $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ | 375 | $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ |
376 | arch/$(ARCH)/lib/$(EFI_RELOC) | 376 | arch/$(ARCH)/lib/$(EFI_RELOC) |
377 | $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared -Bsymbolic \ | 377 | $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared -Bsymbolic \ |
378 | $^ -o $@ | 378 | $^ -o $@ |
379 | 379 | ||
380 | # ACPI | 380 | # ACPI |
381 | # --------------------------------------------------------------------------- | 381 | # --------------------------------------------------------------------------- |
382 | quiet_cmd_acpi_c_asl= ASL $< | 382 | quiet_cmd_acpi_c_asl= ASL $< |
383 | cmd_acpi_c_asl= \ | 383 | cmd_acpi_c_asl= \ |
384 | $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \ | 384 | $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \ |
385 | iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null); \ | 385 | iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null); \ |
386 | mv $(patsubst %.asl,%.hex,$<) $@ | 386 | mv $(patsubst %.asl,%.hex,$<) $@ |
387 | 387 | ||
388 | $(obj)/dsdt.c: $(src)/dsdt.asl | 388 | $(obj)/dsdt.c: $(src)/dsdt.asl |
389 | $(call cmd,acpi_c_asl) | 389 | $(call cmd,acpi_c_asl) |
390 | 390 | ||
391 | # Bzip2 | 391 | # Bzip2 |
392 | # --------------------------------------------------------------------------- | 392 | # --------------------------------------------------------------------------- |
393 | 393 | ||
394 | # Bzip2 and LZMA do not include size in file... so we have to fake that; | 394 | # Bzip2 and LZMA do not include size in file... so we have to fake that; |
395 | # append the size as a 32-bit littleendian number as gzip does. | 395 | # append the size as a 32-bit littleendian number as gzip does. |
396 | size_append = printf $(shell \ | 396 | size_append = printf $(shell \ |
397 | dec_size=0; \ | 397 | dec_size=0; \ |
398 | for F in $1; do \ | 398 | for F in $1; do \ |
399 | fsize=$$(stat -c "%s" $$F); \ | 399 | fsize=$$(stat -c "%s" $$F); \ |
400 | dec_size=$$(expr $$dec_size + $$fsize); \ | 400 | dec_size=$$(expr $$dec_size + $$fsize); \ |
401 | done; \ | 401 | done; \ |
402 | printf "%08x\n" $$dec_size | \ | 402 | printf "%08x\n" $$dec_size | \ |
403 | sed 's/\(..\)/\1 /g' | { \ | 403 | sed 's/\(..\)/\1 /g' | { \ |
404 | read ch0 ch1 ch2 ch3; \ | 404 | read ch0 ch1 ch2 ch3; \ |
405 | for ch in $$ch3 $$ch2 $$ch1 $$ch0; do \ | 405 | for ch in $$ch3 $$ch2 $$ch1 $$ch0; do \ |
406 | printf '%s%03o' '\\' $$((0x$$ch)); \ | 406 | printf '%s%03o' '\\' $$((0x$$ch)); \ |
407 | done; \ | 407 | done; \ |
408 | } \ | 408 | } \ |
409 | ) | 409 | ) |
410 | 410 | ||
411 | quiet_cmd_bzip2 = BZIP2 $@ | 411 | quiet_cmd_bzip2 = BZIP2 $@ |
412 | cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ | 412 | cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ |
413 | bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 413 | bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
414 | (rm -f $@ ; false) | 414 | (rm -f $@ ; false) |
415 | 415 | ||
416 | # Lzma | 416 | # Lzma |
417 | # --------------------------------------------------------------------------- | 417 | # --------------------------------------------------------------------------- |
418 | 418 | ||
419 | quiet_cmd_lzma = LZMA $@ | 419 | quiet_cmd_lzma = LZMA $@ |
420 | cmd_lzma = (cat $(filter-out FORCE,$^) | \ | 420 | cmd_lzma = (cat $(filter-out FORCE,$^) | \ |
421 | lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 421 | lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
422 | (rm -f $@ ; false) | 422 | (rm -f $@ ; false) |
423 | 423 | ||
424 | quiet_cmd_lzo = LZO $@ | 424 | quiet_cmd_lzo = LZO $@ |
425 | cmd_lzo = (cat $(filter-out FORCE,$^) | \ | 425 | cmd_lzo = (cat $(filter-out FORCE,$^) | \ |
426 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 426 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
427 | (rm -f $@ ; false) | 427 | (rm -f $@ ; false) |
428 | 428 | ||
429 | quiet_cmd_lz4 = LZ4 $@ | 429 | quiet_cmd_lz4 = LZ4 $@ |
430 | cmd_lz4 = (cat $(filter-out FORCE,$^) | \ | 430 | cmd_lz4 = (cat $(filter-out FORCE,$^) | \ |
431 | lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 431 | lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
432 | (rm -f $@ ; false) | 432 | (rm -f $@ ; false) |
433 | 433 | ||
434 | # U-Boot mkimage | 434 | # U-Boot mkimage |
435 | # --------------------------------------------------------------------------- | 435 | # --------------------------------------------------------------------------- |
436 | 436 | ||
437 | MKIMAGE := $(srctree)/scripts/mkuboot.sh | 437 | MKIMAGE := $(srctree)/scripts/mkuboot.sh |
438 | 438 | ||
439 | # SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces | 439 | # SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces |
440 | # the number of overrides in arch makefiles | 440 | # the number of overrides in arch makefiles |
441 | UIMAGE_ARCH ?= $(SRCARCH) | 441 | UIMAGE_ARCH ?= $(SRCARCH) |
442 | UIMAGE_COMPRESSION ?= $(if $(2),$(2),none) | 442 | UIMAGE_COMPRESSION ?= $(if $(2),$(2),none) |
443 | UIMAGE_OPTS-y ?= | 443 | UIMAGE_OPTS-y ?= |
444 | UIMAGE_TYPE ?= kernel | 444 | UIMAGE_TYPE ?= kernel |
445 | UIMAGE_LOADADDR ?= arch_must_set_this | 445 | UIMAGE_LOADADDR ?= arch_must_set_this |
446 | UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) | 446 | UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) |
447 | UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)' | 447 | UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)' |
448 | UIMAGE_IN ?= $< | 448 | UIMAGE_IN ?= $< |
449 | UIMAGE_OUT ?= $@ | 449 | UIMAGE_OUT ?= $@ |
450 | 450 | ||
451 | quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT) | 451 | quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT) |
452 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ | 452 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ |
453 | -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \ | 453 | -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \ |
454 | -T $(UIMAGE_TYPE) \ | 454 | -T $(UIMAGE_TYPE) \ |
455 | -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \ | 455 | -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \ |
456 | -n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT) | 456 | -n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT) |
457 | 457 | ||
458 | # XZ | 458 | # XZ |
459 | # --------------------------------------------------------------------------- | 459 | # --------------------------------------------------------------------------- |
460 | # Use xzkern to compress the kernel image and xzmisc to compress other things. | 460 | # Use xzkern to compress the kernel image and xzmisc to compress other things. |
461 | # | 461 | # |
462 | # xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage | 462 | # xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage |
463 | # of the kernel decompressor. A BCJ filter is used if it is available for | 463 | # of the kernel decompressor. A BCJ filter is used if it is available for |
464 | # the target architecture. xzkern also appends uncompressed size of the data | 464 | # the target architecture. xzkern also appends uncompressed size of the data |
465 | # using size_append. The .xz format has the size information available at | 465 | # using size_append. The .xz format has the size information available at |
466 | # the end of the file too, but it's in more complex format and it's good to | 466 | # the end of the file too, but it's in more complex format and it's good to |
467 | # avoid changing the part of the boot code that reads the uncompressed size. | 467 | # avoid changing the part of the boot code that reads the uncompressed size. |
468 | # Note that the bytes added by size_append will make the xz tool think that | 468 | # Note that the bytes added by size_append will make the xz tool think that |
469 | # the file is corrupt. This is expected. | 469 | # the file is corrupt. This is expected. |
470 | # | 470 | # |
471 | # xzmisc doesn't use size_append, so it can be used to create normal .xz | 471 | # xzmisc doesn't use size_append, so it can be used to create normal .xz |
472 | # files. xzmisc uses smaller LZMA2 dictionary than xzkern, because a very | 472 | # files. xzmisc uses smaller LZMA2 dictionary than xzkern, because a very |
473 | # big dictionary would increase the memory usage too much in the multi-call | 473 | # big dictionary would increase the memory usage too much in the multi-call |
474 | # decompression mode. A BCJ filter isn't used either. | 474 | # decompression mode. A BCJ filter isn't used either. |
475 | quiet_cmd_xzkern = XZKERN $@ | 475 | quiet_cmd_xzkern = XZKERN $@ |
476 | cmd_xzkern = (cat $(filter-out FORCE,$^) | \ | 476 | cmd_xzkern = (cat $(filter-out FORCE,$^) | \ |
477 | sh $(srctree)/scripts/xz_wrap.sh && \ | 477 | sh $(srctree)/scripts/xz_wrap.sh && \ |
478 | $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 478 | $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
479 | (rm -f $@ ; false) | 479 | (rm -f $@ ; false) |
480 | 480 | ||
481 | quiet_cmd_xzmisc = XZMISC $@ | 481 | quiet_cmd_xzmisc = XZMISC $@ |
482 | cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ | 482 | cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ |
483 | xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ | 483 | xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ |
484 | (rm -f $@ ; false) | 484 | (rm -f $@ ; false) |
485 | 485 | ||
486 | # Additional commands for U-Boot | 486 | # Additional commands for U-Boot |
487 | # | 487 | # |
488 | # mkimage | 488 | # mkimage |
489 | # --------------------------------------------------------------------------- | 489 | # --------------------------------------------------------------------------- |
490 | MKIMAGEOUTPUT ?= /dev/null | ||
490 | quiet_cmd_mkimage = MKIMAGE $@ | 491 | quiet_cmd_mkimage = MKIMAGE $@ |
491 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ | 492 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ |
492 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) | 493 | $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) |
493 | 494 |
scripts/Makefile.spl
1 | # | 1 | # |
2 | # (C) Copyright 2000-2011 | 2 | # (C) Copyright 2000-2011 |
3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | # | 4 | # |
5 | # (C) Copyright 2011 | 5 | # (C) Copyright 2011 |
6 | # Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. | 6 | # Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. |
7 | # | 7 | # |
8 | # (C) Copyright 2011 | 8 | # (C) Copyright 2011 |
9 | # Texas Instruments Incorporated - http://www.ti.com/ | 9 | # Texas Instruments Incorporated - http://www.ti.com/ |
10 | # Aneesh V <aneesh@ti.com> | 10 | # Aneesh V <aneesh@ti.com> |
11 | # | 11 | # |
12 | # SPDX-License-Identifier: GPL-2.0+ | 12 | # SPDX-License-Identifier: GPL-2.0+ |
13 | # | 13 | # |
14 | # Based on top-level Makefile. | 14 | # Based on top-level Makefile. |
15 | # | 15 | # |
16 | 16 | ||
17 | src := $(obj) | 17 | src := $(obj) |
18 | 18 | ||
19 | # Create output directory if not already present | 19 | # Create output directory if not already present |
20 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | 20 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) |
21 | 21 | ||
22 | include $(srctree)/scripts/Kbuild.include | 22 | include $(srctree)/scripts/Kbuild.include |
23 | 23 | ||
24 | -include include/config/auto.conf | 24 | -include include/config/auto.conf |
25 | -include $(obj)/include/autoconf.mk | 25 | -include $(obj)/include/autoconf.mk |
26 | 26 | ||
27 | KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD | 27 | KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD |
28 | ifeq ($(CONFIG_TPL_BUILD),y) | 28 | ifeq ($(CONFIG_TPL_BUILD),y) |
29 | KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD | 29 | KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD |
30 | endif | 30 | endif |
31 | 31 | ||
32 | ifeq ($(CONFIG_TPL_BUILD),y) | 32 | ifeq ($(CONFIG_TPL_BUILD),y) |
33 | SPL_BIN := u-boot-tpl | 33 | SPL_BIN := u-boot-tpl |
34 | else | 34 | else |
35 | SPL_BIN := u-boot-spl | 35 | SPL_BIN := u-boot-spl |
36 | endif | 36 | endif |
37 | 37 | ||
38 | include $(srctree)/config.mk | 38 | include $(srctree)/config.mk |
39 | include $(srctree)/arch/$(ARCH)/Makefile | 39 | include $(srctree)/arch/$(ARCH)/Makefile |
40 | 40 | ||
41 | # Enable garbage collection of un-used sections for SPL | 41 | # Enable garbage collection of un-used sections for SPL |
42 | KBUILD_CFLAGS += -ffunction-sections -fdata-sections | 42 | KBUILD_CFLAGS += -ffunction-sections -fdata-sections |
43 | LDFLAGS_FINAL += --gc-sections | 43 | LDFLAGS_FINAL += --gc-sections |
44 | 44 | ||
45 | # FIX ME | 45 | # FIX ME |
46 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ | 46 | cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ |
47 | $(NOSTDINC_FLAGS) | 47 | $(NOSTDINC_FLAGS) |
48 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) | 48 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) |
49 | 49 | ||
50 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) | 50 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) |
51 | 51 | ||
52 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) | 52 | libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) |
53 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | 53 | libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ |
54 | 54 | ||
55 | libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ | 55 | libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ |
56 | libs-y += common/init/ | 56 | libs-y += common/init/ |
57 | 57 | ||
58 | # Special handling for a few options which support SPL/TPL | 58 | # Special handling for a few options which support SPL/TPL |
59 | ifeq ($(CONFIG_TPL_BUILD),y) | 59 | ifeq ($(CONFIG_TPL_BUILD),y) |
60 | libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/ | 60 | libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/ |
61 | libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/ | 61 | libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/ |
62 | else | 62 | else |
63 | libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ | 63 | libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ |
64 | libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ | 64 | libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ |
65 | endif | 65 | endif |
66 | 66 | ||
67 | libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ | 67 | libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ |
68 | libs-y += drivers/ | 68 | libs-y += drivers/ |
69 | libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/ | 69 | libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/ |
70 | libs-y += dts/ | 70 | libs-y += dts/ |
71 | libs-y += fs/ | 71 | libs-y += fs/ |
72 | libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ | 72 | libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ |
73 | libs-$(CONFIG_SPL_NET_SUPPORT) += net/ | 73 | libs-$(CONFIG_SPL_NET_SUPPORT) += net/ |
74 | 74 | ||
75 | head-y := $(addprefix $(obj)/,$(head-y)) | 75 | head-y := $(addprefix $(obj)/,$(head-y)) |
76 | libs-y := $(addprefix $(obj)/,$(libs-y)) | 76 | libs-y := $(addprefix $(obj)/,$(libs-y)) |
77 | u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) | 77 | u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) |
78 | 78 | ||
79 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) | 79 | libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) |
80 | 80 | ||
81 | # Add GCC lib | 81 | # Add GCC lib |
82 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) | 82 | ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) |
83 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a | 83 | PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a |
84 | PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC) | 84 | PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC) |
85 | endif | 85 | endif |
86 | 86 | ||
87 | u-boot-spl-init := $(head-y) | 87 | u-boot-spl-init := $(head-y) |
88 | u-boot-spl-main := $(libs-y) | 88 | u-boot-spl-main := $(libs-y) |
89 | ifdef CONFIG_SPL_OF_PLATDATA | 89 | ifdef CONFIG_SPL_OF_PLATDATA |
90 | u-boot-spl-platdata := $(obj)/dts/dt-platdata.o | 90 | u-boot-spl-platdata := $(obj)/dts/dt-platdata.o |
91 | endif | 91 | endif |
92 | 92 | ||
93 | # Linker Script | 93 | # Linker Script |
94 | ifdef CONFIG_SPL_LDSCRIPT | 94 | ifdef CONFIG_SPL_LDSCRIPT |
95 | # need to strip off double quotes | 95 | # need to strip off double quotes |
96 | LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_SPL_LDSCRIPT:"%"=%)) | 96 | LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_SPL_LDSCRIPT:"%"=%)) |
97 | endif | 97 | endif |
98 | 98 | ||
99 | ifeq ($(wildcard $(LDSCRIPT)),) | 99 | ifeq ($(wildcard $(LDSCRIPT)),) |
100 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot-spl.lds | 100 | LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot-spl.lds |
101 | endif | 101 | endif |
102 | ifeq ($(wildcard $(LDSCRIPT)),) | 102 | ifeq ($(wildcard $(LDSCRIPT)),) |
103 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot-spl.lds | 103 | LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot-spl.lds |
104 | endif | 104 | endif |
105 | ifeq ($(wildcard $(LDSCRIPT)),) | 105 | ifeq ($(wildcard $(LDSCRIPT)),) |
106 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot-spl.lds | 106 | LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot-spl.lds |
107 | endif | 107 | endif |
108 | ifeq ($(wildcard $(LDSCRIPT)),) | 108 | ifeq ($(wildcard $(LDSCRIPT)),) |
109 | $(error could not find linker script) | 109 | $(error could not find linker script) |
110 | endif | 110 | endif |
111 | 111 | ||
112 | # Special flags for CPP when processing the linker script. | 112 | # Special flags for CPP when processing the linker script. |
113 | # Pass the version down so we can handle backwards compatibility | 113 | # Pass the version down so we can handle backwards compatibility |
114 | # on the fly. | 114 | # on the fly. |
115 | LDPPFLAGS += \ | 115 | LDPPFLAGS += \ |
116 | -include $(srctree)/include/u-boot/u-boot.lds.h \ | 116 | -include $(srctree)/include/u-boot/u-boot.lds.h \ |
117 | -include $(objtree)/include/config.h \ | 117 | -include $(objtree)/include/config.h \ |
118 | -DCPUDIR=$(CPUDIR) \ | 118 | -DCPUDIR=$(CPUDIR) \ |
119 | $(shell $(LD) --version | \ | 119 | $(shell $(LD) --version | \ |
120 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') | 120 | sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') |
121 | 121 | ||
122 | MKIMAGEOUTPUT ?= /dev/null | ||
123 | |||
122 | quiet_cmd_mkimage = MKIMAGE $@ | 124 | quiet_cmd_mkimage = MKIMAGE $@ |
123 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ | 125 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ |
124 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) | 126 | $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) |
125 | 127 | ||
126 | MKIMAGEFLAGS_MLO = -T omapimage -a $(CONFIG_SPL_TEXT_BASE) | 128 | MKIMAGEFLAGS_MLO = -T omapimage -a $(CONFIG_SPL_TEXT_BASE) |
127 | 129 | ||
128 | MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE) | 130 | MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE) |
129 | 131 | ||
130 | MLO MLO.byteswap: $(obj)/u-boot-spl.bin FORCE | 132 | MLO MLO.byteswap: $(obj)/u-boot-spl.bin FORCE |
131 | $(call if_changed,mkimage) | 133 | $(call if_changed,mkimage) |
132 | 134 | ||
133 | ifeq ($(CONFIG_SYS_SOC),"at91") | 135 | ifeq ($(CONFIG_SYS_SOC),"at91") |
134 | MKIMAGEFLAGS_boot.bin = -T atmelimage | 136 | MKIMAGEFLAGS_boot.bin = -T atmelimage |
135 | 137 | ||
136 | ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) | 138 | ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) |
137 | MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) | 139 | MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) |
138 | 140 | ||
139 | boot.bin: $(obj)/../tools/atmel_pmecc_params | 141 | boot.bin: $(obj)/../tools/atmel_pmecc_params |
140 | endif | 142 | endif |
141 | 143 | ||
142 | boot.bin: $(obj)/u-boot-spl.bin FORCE | 144 | boot.bin: $(obj)/u-boot-spl.bin FORCE |
143 | $(call if_changed,mkimage) | 145 | $(call if_changed,mkimage) |
144 | else | 146 | else |
145 | ifdef CONFIG_ARCH_ZYNQ | 147 | ifdef CONFIG_ARCH_ZYNQ |
146 | MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) | 148 | MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) |
147 | endif | 149 | endif |
148 | ifdef CONFIG_ARCH_ZYNQMP | 150 | ifdef CONFIG_ARCH_ZYNQMP |
149 | MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) | 151 | MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) |
150 | endif | 152 | endif |
151 | 153 | ||
152 | spl/boot.bin: $(obj)/u-boot-spl.bin FORCE | 154 | spl/boot.bin: $(obj)/u-boot-spl.bin FORCE |
153 | $(call if_changed,mkimage) | 155 | $(call if_changed,mkimage) |
154 | endif | 156 | endif |
155 | 157 | ||
156 | ALL-y += $(obj)/$(SPL_BIN).bin | 158 | ALL-y += $(obj)/$(SPL_BIN).bin |
157 | 159 | ||
158 | ifdef CONFIG_SAMSUNG | 160 | ifdef CONFIG_SAMSUNG |
159 | ALL-y += $(obj)/$(BOARD)-spl.bin | 161 | ALL-y += $(obj)/$(BOARD)-spl.bin |
160 | endif | 162 | endif |
161 | 163 | ||
162 | ifdef CONFIG_ARCH_SOCFPGA | 164 | ifdef CONFIG_ARCH_SOCFPGA |
163 | ALL-y += $(obj)/$(SPL_BIN).sfp | 165 | ALL-y += $(obj)/$(SPL_BIN).sfp |
164 | endif | 166 | endif |
165 | 167 | ||
166 | ifdef CONFIG_ARCH_SUNXI | 168 | ifdef CONFIG_ARCH_SUNXI |
167 | ALL-y += $(obj)/sunxi-spl.bin | 169 | ALL-y += $(obj)/sunxi-spl.bin |
168 | endif | 170 | endif |
169 | 171 | ||
170 | ifeq ($(CONFIG_SYS_SOC),"at91") | 172 | ifeq ($(CONFIG_SYS_SOC),"at91") |
171 | ALL-y += boot.bin | 173 | ALL-y += boot.bin |
172 | endif | 174 | endif |
173 | 175 | ||
174 | ALL-$(CONFIG_ARCH_ZYNQ) += $(obj)/boot.bin | 176 | ALL-$(CONFIG_ARCH_ZYNQ) += $(obj)/boot.bin |
175 | ALL-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin | 177 | ALL-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin |
176 | 178 | ||
177 | all: $(ALL-y) | 179 | all: $(ALL-y) |
178 | 180 | ||
179 | quiet_cmd_cat = CAT $@ | 181 | quiet_cmd_cat = CAT $@ |
180 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ | 182 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ |
181 | 183 | ||
182 | quiet_cmd_copy = COPY $@ | 184 | quiet_cmd_copy = COPY $@ |
183 | cmd_copy = cp $< $@ | 185 | cmd_copy = cp $< $@ |
184 | 186 | ||
185 | ifeq ($(CONFIG_SPL_OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),yy) | 187 | ifeq ($(CONFIG_SPL_OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),yy) |
186 | $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin $(obj)/$(SPL_BIN)-pad.bin \ | 188 | $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin $(obj)/$(SPL_BIN)-pad.bin \ |
187 | $(obj)/$(SPL_BIN).dtb FORCE | 189 | $(obj)/$(SPL_BIN).dtb FORCE |
188 | $(call if_changed,cat) | 190 | $(call if_changed,cat) |
189 | 191 | ||
190 | $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE | 192 | $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE |
191 | $(call if_changed,copy) | 193 | $(call if_changed,copy) |
192 | else | 194 | else |
193 | $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE | 195 | $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE |
194 | $(call if_changed,copy) | 196 | $(call if_changed,copy) |
195 | endif | 197 | endif |
196 | 198 | ||
197 | # Create a file that pads from the end of u-boot-spl-nodtb.bin to bss_end | 199 | # Create a file that pads from the end of u-boot-spl-nodtb.bin to bss_end |
198 | $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) | 200 | $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) |
199 | @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ | 201 | @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ |
200 | dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; | 202 | dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; |
201 | 203 | ||
202 | # Pass the original device tree file through fdtgrep twice. The first pass | 204 | # Pass the original device tree file through fdtgrep twice. The first pass |
203 | # removes any unwanted nodes (i.e. those which don't have the | 205 | # removes any unwanted nodes (i.e. those which don't have the |
204 | # 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second | 206 | # 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second |
205 | # pass removes various unused properties from the remaining nodes. | 207 | # pass removes various unused properties from the remaining nodes. |
206 | # The output is typically a much smaller device tree file. | 208 | # The output is typically a much smaller device tree file. |
207 | quiet_cmd_fdtgrep = FDTGREP $@ | 209 | quiet_cmd_fdtgrep = FDTGREP $@ |
208 | cmd_fdtgrep = $(objtree)/tools/fdtgrep -b u-boot,dm-pre-reloc -RT $< \ | 210 | cmd_fdtgrep = $(objtree)/tools/fdtgrep -b u-boot,dm-pre-reloc -RT $< \ |
209 | -n /chosen -O dtb | \ | 211 | -n /chosen -O dtb | \ |
210 | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ | 212 | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ |
211 | $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS))) | 213 | $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS))) |
212 | 214 | ||
213 | $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE | 215 | $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE |
214 | $(call if_changed,fdtgrep) | 216 | $(call if_changed,fdtgrep) |
215 | 217 | ||
216 | pythonpath = PYTHONPATH=tools | 218 | pythonpath = PYTHONPATH=tools |
217 | 219 | ||
218 | quiet_cmd_dtocc = DTOC C $@ | 220 | quiet_cmd_dtocc = DTOC C $@ |
219 | cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata | 221 | cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata |
220 | 222 | ||
221 | quiet_cmd_dtoch = DTOC H $@ | 223 | quiet_cmd_dtoch = DTOC H $@ |
222 | cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct | 224 | cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct |
223 | 225 | ||
224 | quiet_cmd_plat = PLAT $@ | 226 | quiet_cmd_plat = PLAT $@ |
225 | cmd_plat = $(CC) $(c_flags) -c $< -o $@ | 227 | cmd_plat = $(CC) $(c_flags) -c $< -o $@ |
226 | 228 | ||
227 | $(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c include/generated/dt-structs.h | 229 | $(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c include/generated/dt-structs.h |
228 | $(call if_changed,plat) | 230 | $(call if_changed,plat) |
229 | 231 | ||
230 | PHONY += dts_dir | 232 | PHONY += dts_dir |
231 | dts_dir: | 233 | dts_dir: |
232 | $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) | 234 | $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) |
233 | 235 | ||
234 | include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc | 236 | include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc |
235 | $(call if_changed,dtoch) | 237 | $(call if_changed,dtoch) |
236 | 238 | ||
237 | $(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc | 239 | $(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc |
238 | $(call if_changed,dtocc) | 240 | $(call if_changed,dtocc) |
239 | 241 | ||
240 | dtoc: #$(objtree)/tools/_libfdt.so | 242 | dtoc: #$(objtree)/tools/_libfdt.so |
241 | 243 | ||
242 | ifdef CONFIG_SAMSUNG | 244 | ifdef CONFIG_SAMSUNG |
243 | ifdef CONFIG_VAR_SIZE_SPL | 245 | ifdef CONFIG_VAR_SIZE_SPL |
244 | VAR_SIZE_PARAM = --vs | 246 | VAR_SIZE_PARAM = --vs |
245 | else | 247 | else |
246 | VAR_SIZE_PARAM = | 248 | VAR_SIZE_PARAM = |
247 | endif | 249 | endif |
248 | $(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin | 250 | $(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin |
249 | $(if $(wildcard $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl),\ | 251 | $(if $(wildcard $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl),\ |
250 | $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl,\ | 252 | $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl,\ |
251 | $(objtree)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $< $@ | 253 | $(objtree)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $< $@ |
252 | endif | 254 | endif |
253 | 255 | ||
254 | quiet_cmd_objcopy = OBJCOPY $@ | 256 | quiet_cmd_objcopy = OBJCOPY $@ |
255 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ | 257 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ |
256 | 258 | ||
257 | OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary | 259 | OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary |
258 | 260 | ||
259 | $(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE | 261 | $(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE |
260 | $(call if_changed,objcopy) | 262 | $(call if_changed,objcopy) |
261 | 263 | ||
262 | LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL) | 264 | LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL) |
263 | ifneq ($(CONFIG_SPL_TEXT_BASE),) | 265 | ifneq ($(CONFIG_SPL_TEXT_BASE),) |
264 | LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) | 266 | LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) |
265 | endif | 267 | endif |
266 | 268 | ||
267 | MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage | 269 | MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage |
268 | $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE | 270 | $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE |
269 | $(call if_changed,mkimage) | 271 | $(call if_changed,mkimage) |
270 | 272 | ||
271 | quiet_cmd_mksunxiboot = MKSUNXI $@ | 273 | quiet_cmd_mksunxiboot = MKSUNXI $@ |
272 | cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ | 274 | cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ |
273 | $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE | 275 | $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE |
274 | $(call if_changed,mksunxiboot) | 276 | $(call if_changed,mksunxiboot) |
275 | 277 | ||
276 | # Rule to link u-boot-spl | 278 | # Rule to link u-boot-spl |
277 | # May be overridden by arch/$(ARCH)/config.mk | 279 | # May be overridden by arch/$(ARCH)/config.mk |
278 | quiet_cmd_u-boot-spl ?= LD $@ | 280 | quiet_cmd_u-boot-spl ?= LD $@ |
279 | cmd_u-boot-spl ?= (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ | 281 | cmd_u-boot-spl ?= (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ |
280 | $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \ | 282 | $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \ |
281 | $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ | 283 | $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ |
282 | $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \ | 284 | $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \ |
283 | --end-group \ | 285 | --end-group \ |
284 | $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN)) | 286 | $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN)) |
285 | 287 | ||
286 | $(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \ | 288 | $(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \ |
287 | $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE | 289 | $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE |
288 | $(call if_changed,u-boot-spl) | 290 | $(call if_changed,u-boot-spl) |
289 | 291 | ||
290 | $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ; | 292 | $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ; |
291 | 293 | ||
292 | PHONY += $(u-boot-spl-dirs) | 294 | PHONY += $(u-boot-spl-dirs) |
293 | $(u-boot-spl-dirs): $(u-boot-spl-platdata) | 295 | $(u-boot-spl-dirs): $(u-boot-spl-platdata) |
294 | $(Q)$(MAKE) $(build)=$@ | 296 | $(Q)$(MAKE) $(build)=$@ |
295 | 297 | ||
296 | quiet_cmd_cpp_lds = LDS $@ | 298 | quiet_cmd_cpp_lds = LDS $@ |
297 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ | 299 | cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ |
298 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< | 300 | -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $< |
299 | 301 | ||
300 | $(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE | 302 | $(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE |
301 | $(call if_changed_dep,cpp_lds) | 303 | $(call if_changed_dep,cpp_lds) |
302 | 304 | ||
303 | # read all saved command lines | 305 | # read all saved command lines |
304 | 306 | ||
305 | targets := $(wildcard $(sort $(targets))) | 307 | targets := $(wildcard $(sort $(targets))) |
306 | cmd_files := $(wildcard $(obj)/.*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | 308 | cmd_files := $(wildcard $(obj)/.*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) |
307 | 309 | ||
308 | ifneq ($(cmd_files),) | 310 | ifneq ($(cmd_files),) |
309 | $(cmd_files): ; # Do not try to update included dependency files | 311 | $(cmd_files): ; # Do not try to update included dependency files |
310 | include $(cmd_files) | 312 | include $(cmd_files) |
311 | endif | 313 | endif |
312 | 314 | ||
313 | PHONY += FORCE | 315 | PHONY += FORCE |
314 | FORCE: | 316 | FORCE: |
315 | 317 | ||
316 | # Declare the contents of the .PHONY variable as phony. We keep that | 318 | # Declare the contents of the .PHONY variable as phony. We keep that |
317 | # information in a variable so we can use it in if_changed and friends. | 319 | # information in a variable so we can use it in if_changed and friends. |
318 | .PHONY: $(PHONY) | 320 | .PHONY: $(PHONY) |
319 | 321 |