.. | .. |
---|
17 | 17 | # Set default 32 bits cross compilers for vdso and boot wrapper |
---|
18 | 18 | CROSS32_COMPILE ?= |
---|
19 | 19 | |
---|
20 | | -ifeq ($(HAS_BIARCH),y) |
---|
21 | | -ifeq ($(CROSS32_COMPILE),) |
---|
22 | | -ifdef CONFIG_PPC32 |
---|
23 | | -# These options will be overridden by any -mcpu option that the CPU |
---|
24 | | -# or platform code sets later on the command line, but they are needed |
---|
25 | | -# to set a sane 32-bit cpu target for the 64-bit cross compiler which |
---|
26 | | -# may default to the wrong ISA. |
---|
27 | | -KBUILD_CFLAGS += -mcpu=powerpc |
---|
28 | | -KBUILD_AFLAGS += -mcpu=powerpc |
---|
29 | | -endif |
---|
30 | | -endif |
---|
31 | | -endif |
---|
| 20 | +# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use |
---|
| 21 | +# ppc64_defconfig because we have nothing better to go on. |
---|
| 22 | +uname := $(shell uname -m) |
---|
| 23 | +KBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64)_defconfig |
---|
32 | 24 | |
---|
33 | | -ifeq ($(CROSS_COMPILE),) |
---|
34 | | -KBUILD_DEFCONFIG := $(shell uname -m)_defconfig |
---|
35 | | -else |
---|
36 | | -KBUILD_DEFCONFIG := ppc64_defconfig |
---|
37 | | -endif |
---|
38 | | - |
---|
39 | | -ifdef CONFIG_PPC64 |
---|
40 | 25 | new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) |
---|
41 | 26 | |
---|
42 | 27 | ifeq ($(new_nm),y) |
---|
43 | 28 | NM := $(NM) --synthetic |
---|
44 | | -endif |
---|
45 | 29 | endif |
---|
46 | 30 | |
---|
47 | 31 | # BITS is used as extension for files which are available in a 32 bit |
---|
.. | .. |
---|
64 | 48 | ifdef CONFIG_PPC32 |
---|
65 | 49 | KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o |
---|
66 | 50 | else |
---|
67 | | -KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds |
---|
68 | 51 | ifeq ($(call ld-ifversion, -ge, 225000000, y),y) |
---|
69 | 52 | # Have the linker provide sfpr if possible. |
---|
70 | 53 | # There is a corresponding test in arch/powerpc/lib/Makefile |
---|
.. | .. |
---|
98 | 81 | endif |
---|
99 | 82 | endif |
---|
100 | 83 | |
---|
101 | | -ifneq ($(cc-name),clang) |
---|
| 84 | +ifndef CONFIG_CC_IS_CLANG |
---|
102 | 85 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align |
---|
103 | 86 | endif |
---|
104 | 87 | |
---|
.. | .. |
---|
111 | 94 | KBUILD_CFLAGS += -m$(BITS) |
---|
112 | 95 | KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) |
---|
113 | 96 | KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) |
---|
114 | | -KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) |
---|
| 97 | +endif |
---|
| 98 | + |
---|
| 99 | +cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls |
---|
| 100 | +ifdef CONFIG_PPC64 |
---|
| 101 | +cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13 |
---|
| 102 | +else |
---|
| 103 | +cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2 |
---|
115 | 104 | endif |
---|
116 | 105 | |
---|
117 | 106 | LDFLAGS_vmlinux-y := -Bstatic |
---|
118 | 107 | LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie |
---|
119 | 108 | LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) |
---|
120 | | -LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn) |
---|
121 | 109 | |
---|
122 | 110 | ifdef CONFIG_PPC64 |
---|
123 | 111 | ifeq ($(call cc-option-yn,-mcmodel=medium),y) |
---|
.. | .. |
---|
165 | 153 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) |
---|
166 | 154 | else |
---|
167 | 155 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) |
---|
168 | | -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) |
---|
| 156 | +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 |
---|
169 | 157 | endif |
---|
170 | | -else |
---|
| 158 | +else ifdef CONFIG_PPC_BOOK3E_64 |
---|
171 | 159 | CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 |
---|
172 | 160 | endif |
---|
173 | 161 | |
---|
.. | .. |
---|
179 | 167 | # Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8 |
---|
180 | 168 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199 |
---|
181 | 169 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828 |
---|
182 | | -ifneq ($(cc-name),clang) |
---|
| 170 | +ifndef CONFIG_CC_IS_CLANG |
---|
183 | 171 | CC_FLAGS_FTRACE += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog) |
---|
184 | 172 | endif |
---|
185 | 173 | endif |
---|
186 | 174 | |
---|
187 | 175 | CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) |
---|
| 176 | +AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) |
---|
188 | 177 | |
---|
189 | 178 | # Altivec option not allowed with e500mc64 in GCC. |
---|
190 | 179 | ifdef CONFIG_ALTIVEC |
---|
.. | .. |
---|
195 | 184 | CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) |
---|
196 | 185 | CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) |
---|
197 | 186 | |
---|
198 | | -ifdef CONFIG_PPC32 |
---|
199 | | -ifdef CONFIG_PPC_E500MC |
---|
200 | | -CFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc) |
---|
201 | | -else |
---|
202 | | -CFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc) |
---|
203 | | -endif |
---|
204 | | -endif |
---|
205 | | - |
---|
206 | 187 | asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) |
---|
207 | 188 | |
---|
208 | | -KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) |
---|
209 | | -KBUILD_AFLAGS += -Iarch/$(ARCH) $(AFLAGS-y) |
---|
| 189 | +KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) |
---|
| 190 | +KBUILD_AFLAGS += $(AFLAGS-y) |
---|
210 | 191 | KBUILD_CFLAGS += $(call cc-option,-msoft-float) |
---|
211 | | -KBUILD_CFLAGS += -pipe -Iarch/$(ARCH) $(CFLAGS-y) |
---|
| 192 | +KBUILD_CFLAGS += -pipe $(CFLAGS-y) |
---|
212 | 193 | CPP = $(CC) -E $(KBUILD_CFLAGS) |
---|
213 | 194 | |
---|
214 | 195 | CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ |
---|
.. | .. |
---|
232 | 213 | KBUILD_CFLAGS += $(call cc-option,-mno-spe) |
---|
233 | 214 | KBUILD_CFLAGS += $(call cc-option,-mspe=no) |
---|
234 | 215 | |
---|
235 | | -# Enable unit-at-a-time mode when possible. It shrinks the |
---|
236 | | -# kernel considerably. |
---|
237 | | -KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) |
---|
238 | | - |
---|
239 | | -# FIXME: the module load should be taught about the additional relocs |
---|
240 | | -# generated by this. |
---|
241 | | -# revert to pre-gcc-4.4 behaviour of .eh_frame |
---|
242 | | -KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) |
---|
| 216 | +# Don't emit .eh_frame since we have no use for it |
---|
| 217 | +KBUILD_CFLAGS += -fno-asynchronous-unwind-tables |
---|
243 | 218 | |
---|
244 | 219 | # Never use string load/store instructions as they are |
---|
245 | 220 | # often slow when they are implemented at all |
---|
246 | 221 | KBUILD_CFLAGS += $(call cc-option,-mno-string) |
---|
247 | 222 | |
---|
248 | | -ifdef CONFIG_6xx |
---|
249 | | -KBUILD_CFLAGS += -mcpu=powerpc |
---|
250 | | -endif |
---|
251 | | - |
---|
252 | | -cpu-as-$(CONFIG_4xx) += -Wa,-m405 |
---|
| 223 | +cpu-as-$(CONFIG_40x) += -Wa,-m405 |
---|
| 224 | +cpu-as-$(CONFIG_44x) += -Wa,-m440 |
---|
253 | 225 | cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) |
---|
254 | 226 | cpu-as-$(CONFIG_E500) += -Wa,-me500 |
---|
255 | 227 | |
---|
.. | .. |
---|
265 | 237 | KBUILD_AFLAGS += $(aflags-y) |
---|
266 | 238 | KBUILD_CFLAGS += $(cflags-y) |
---|
267 | 239 | |
---|
268 | | -head-y := arch/powerpc/kernel/head_$(BITS).o |
---|
| 240 | +head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o |
---|
| 241 | +head-$(CONFIG_PPC_BOOK3S_32) := arch/powerpc/kernel/head_book3s_32.o |
---|
269 | 242 | head-$(CONFIG_PPC_8xx) := arch/powerpc/kernel/head_8xx.o |
---|
270 | 243 | head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o |
---|
271 | 244 | head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o |
---|
.. | .. |
---|
276 | 249 | head-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o |
---|
277 | 250 | head-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o |
---|
278 | 251 | |
---|
279 | | -core-y += arch/powerpc/kernel/ \ |
---|
280 | | - arch/powerpc/mm/ \ |
---|
281 | | - arch/powerpc/lib/ \ |
---|
282 | | - arch/powerpc/sysdev/ \ |
---|
283 | | - arch/powerpc/platforms/ \ |
---|
284 | | - arch/powerpc/math-emu/ \ |
---|
285 | | - arch/powerpc/crypto/ \ |
---|
286 | | - arch/powerpc/net/ |
---|
287 | | -core-$(CONFIG_XMON) += arch/powerpc/xmon/ |
---|
288 | | -core-$(CONFIG_KVM) += arch/powerpc/kvm/ |
---|
289 | | -core-$(CONFIG_PERF_EVENTS) += arch/powerpc/perf/ |
---|
290 | | -core-$(CONFIG_KEXEC_FILE) += arch/powerpc/purgatory/ |
---|
| 252 | +# See arch/powerpc/Kbuild for content of core part of the kernel |
---|
| 253 | +core-y += arch/powerpc/ |
---|
291 | 254 | |
---|
292 | 255 | drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ |
---|
293 | 256 | |
---|
.. | .. |
---|
308 | 271 | $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
---|
309 | 272 | |
---|
310 | 273 | |
---|
| 274 | +PHONY += bootwrapper_install |
---|
311 | 275 | bootwrapper_install: |
---|
312 | | - $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
---|
313 | | - |
---|
314 | | -%.dtb: scripts |
---|
315 | 276 | $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
---|
316 | 277 | |
---|
317 | 278 | # Used to create 'merged defconfigs' |
---|
.. | .. |
---|
333 | 294 | ppc64le_defconfig: |
---|
334 | 295 | $(call merge_into_defconfig,ppc64_defconfig,le) |
---|
335 | 296 | |
---|
| 297 | +PHONY += ppc64le_guest_defconfig |
---|
| 298 | +ppc64le_guest_defconfig: |
---|
| 299 | + $(call merge_into_defconfig,ppc64_defconfig,le guest) |
---|
| 300 | + |
---|
| 301 | +PHONY += ppc64_guest_defconfig |
---|
| 302 | +ppc64_guest_defconfig: |
---|
| 303 | + $(call merge_into_defconfig,ppc64_defconfig,be guest) |
---|
| 304 | + |
---|
336 | 305 | PHONY += powernv_be_defconfig |
---|
337 | 306 | powernv_be_defconfig: |
---|
338 | 307 | $(call merge_into_defconfig,powernv_defconfig,be) |
---|
339 | 308 | |
---|
340 | 309 | PHONY += mpc85xx_defconfig |
---|
341 | 310 | mpc85xx_defconfig: |
---|
342 | | - $(call merge_into_defconfig,mpc85xx_basic_defconfig,\ |
---|
| 311 | + $(call merge_into_defconfig,mpc85xx_base.config,\ |
---|
343 | 312 | 85xx-32bit 85xx-hw fsl-emb-nonhw) |
---|
344 | 313 | |
---|
345 | 314 | PHONY += mpc85xx_smp_defconfig |
---|
346 | 315 | mpc85xx_smp_defconfig: |
---|
347 | | - $(call merge_into_defconfig,mpc85xx_basic_defconfig,\ |
---|
| 316 | + $(call merge_into_defconfig,mpc85xx_base.config,\ |
---|
348 | 317 | 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw) |
---|
349 | 318 | |
---|
350 | 319 | PHONY += corenet32_smp_defconfig |
---|
351 | 320 | corenet32_smp_defconfig: |
---|
352 | | - $(call merge_into_defconfig,corenet_basic_defconfig,\ |
---|
| 321 | + $(call merge_into_defconfig,corenet_base.config,\ |
---|
353 | 322 | 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa) |
---|
354 | 323 | |
---|
355 | 324 | PHONY += corenet64_smp_defconfig |
---|
356 | 325 | corenet64_smp_defconfig: |
---|
357 | | - $(call merge_into_defconfig,corenet_basic_defconfig,\ |
---|
| 326 | + $(call merge_into_defconfig,corenet_base.config,\ |
---|
358 | 327 | 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa) |
---|
359 | 328 | |
---|
360 | 329 | PHONY += mpc86xx_defconfig |
---|
361 | 330 | mpc86xx_defconfig: |
---|
362 | | - $(call merge_into_defconfig,mpc86xx_basic_defconfig,\ |
---|
| 331 | + $(call merge_into_defconfig,mpc86xx_base.config,\ |
---|
363 | 332 | 86xx-hw fsl-emb-nonhw) |
---|
364 | 333 | |
---|
365 | 334 | PHONY += mpc86xx_smp_defconfig |
---|
366 | 335 | mpc86xx_smp_defconfig: |
---|
367 | | - $(call merge_into_defconfig,mpc86xx_basic_defconfig,\ |
---|
| 336 | + $(call merge_into_defconfig,mpc86xx_base.config,\ |
---|
368 | 337 | 86xx-smp 86xx-hw fsl-emb-nonhw) |
---|
369 | 338 | |
---|
370 | 339 | PHONY += ppc32_allmodconfig |
---|
371 | 340 | ppc32_allmodconfig: |
---|
372 | 341 | $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \ |
---|
373 | 342 | -f $(srctree)/Makefile allmodconfig |
---|
| 343 | + |
---|
| 344 | +PHONY += ppc_defconfig |
---|
| 345 | +ppc_defconfig: |
---|
| 346 | + $(call merge_into_defconfig,book3s_32.config,) |
---|
374 | 347 | |
---|
375 | 348 | PHONY += ppc64le_allmodconfig |
---|
376 | 349 | ppc64le_allmodconfig: |
---|
.. | .. |
---|
404 | 377 | @echo ' (minus the .dts extension).' |
---|
405 | 378 | endef |
---|
406 | 379 | |
---|
| 380 | +PHONY += install |
---|
407 | 381 | install: |
---|
408 | 382 | $(Q)$(MAKE) $(build)=$(boot) install |
---|
409 | 383 | |
---|
| 384 | +PHONY += vdso_install |
---|
410 | 385 | vdso_install: |
---|
411 | 386 | ifdef CONFIG_PPC64 |
---|
412 | 387 | $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ |
---|
.. | .. |
---|
420 | 395 | |
---|
421 | 396 | archprepare: checkbin |
---|
422 | 397 | |
---|
423 | | -# Use the file '.tmp_gas_check' for binutils tests, as gas won't output |
---|
424 | | -# to stdout and these checks are run even on install targets. |
---|
425 | | -TOUT := .tmp_gas_check |
---|
| 398 | +archheaders: |
---|
| 399 | + $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all |
---|
426 | 400 | |
---|
| 401 | +ifdef CONFIG_STACKPROTECTOR |
---|
| 402 | +prepare: stack_protector_prepare |
---|
| 403 | + |
---|
| 404 | +PHONY += stack_protector_prepare |
---|
| 405 | +stack_protector_prepare: prepare0 |
---|
| 406 | +ifdef CONFIG_PPC64 |
---|
| 407 | + $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) |
---|
| 408 | +else |
---|
| 409 | + $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h)) |
---|
| 410 | +endif |
---|
| 411 | +endif |
---|
| 412 | + |
---|
| 413 | +ifdef CONFIG_SMP |
---|
| 414 | +prepare: task_cpu_prepare |
---|
| 415 | + |
---|
| 416 | +PHONY += task_cpu_prepare |
---|
| 417 | +task_cpu_prepare: prepare0 |
---|
| 418 | + $(eval KBUILD_CFLAGS += -D_TASK_CPU=$(shell awk '{if ($$2 == "TASK_CPU") print $$3;}' include/generated/asm-offsets.h)) |
---|
| 419 | +endif |
---|
| 420 | + |
---|
| 421 | +PHONY += checkbin |
---|
427 | 422 | # Check toolchain versions: |
---|
428 | 423 | # - gcc-4.6 is the minimum kernel-wide version so nothing required. |
---|
429 | 424 | checkbin: |
---|
.. | .. |
---|
434 | 429 | echo -n '*** Please use a different binutils version.' ; \ |
---|
435 | 430 | false ; \ |
---|
436 | 431 | fi |
---|
437 | | - |
---|
438 | | - |
---|
439 | | -CLEAN_FILES += $(TOUT) |
---|
440 | | - |
---|