Blame view
arch/powerpc/Makefile
7.99 KB
14cf11af6
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# This file is included by the global makefile so that you can add your own # architecture-specific flags and dependencies. Remember to do have actions # for "archclean" and "archdep" for cleaning up and making dependencies for # this architecture. # # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. # # Copyright (C) 1994 by Linus Torvalds # Changes for PPC by Gary Thomas # Rewritten by Cort Dougan and Paul Mackerras # |
14cf11af6
|
14 |
HAS_BIARCH := $(call cc-option-yn, -m32) |
14cf11af6
|
15 16 17 18 |
# Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= CROSS32CC := $(CROSS32_COMPILE)gcc |
2bf118197
|
19 |
CROSS32AR := $(CROSS32_COMPILE)ar |
14cf11af6
|
20 21 22 23 |
ifeq ($(HAS_BIARCH),y) ifeq ($(CROSS32_COMPILE),) CROSS32CC := $(CC) -m32 |
8995ac870
|
24 |
CROSS32AR := GNUTARGET=elf32-powerpc $(AR) |
14cf11af6
|
25 26 |
endif endif |
1976aef97
|
27 |
export CROSS32CC CROSS32AR |
14cf11af6
|
28 |
|
ca786f83a
|
29 |
ifeq ($(CROSS_COMPILE),) |
8a5abdf80
|
30 |
KBUILD_DEFCONFIG := $(shell uname -m)_defconfig |
ca786f83a
|
31 32 33 |
else KBUILD_DEFCONFIG := ppc64_defconfig endif |
8a5abdf80
|
34 |
|
94b212c29
|
35 36 |
ifeq ($(CONFIG_PPC64),y) OLDARCH := ppc64 |
94b212c29
|
37 |
|
14cf11af6
|
38 39 40 41 42 43 44 |
new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) ifeq ($(new_nm),y) NM := $(NM) --synthetic endif else |
bbeb3f4c5
|
45 |
OLDARCH := ppc |
2578bfae8
|
46 47 48 49 50 51 |
endif # It seems there are times we use this Makefile without # including the config file, but this replicates the old behaviour ifeq ($(CONFIG_WORD_SIZE),) CONFIG_WORD_SIZE := 32 |
14cf11af6
|
52 |
endif |
190554db7
|
53 |
UTS_MACHINE := $(OLDARCH) |
14cf11af6
|
54 |
ifeq ($(HAS_BIARCH),y) |
2578bfae8
|
55 56 57 58 |
override AS += -a$(CONFIG_WORD_SIZE) override LD += -m elf$(CONFIG_WORD_SIZE)ppc override CC += -m$(CONFIG_WORD_SIZE) override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR) |
14cf11af6
|
59 |
endif |
549e8152d
|
60 61 62 |
LDFLAGS_vmlinux-yy := -Bstatic LDFLAGS_vmlinux-$(CONFIG_PPC64)$(CONFIG_RELOCATABLE) := -pie LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-yy) |
14cf11af6
|
63 |
|
af9719c30
|
64 |
CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=no -mcall-aixdesc |
1993cbf4a
|
65 66 67 68 |
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple KBUILD_CPPFLAGS += -Iarch/$(ARCH) KBUILD_AFLAGS += -Iarch/$(ARCH) KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) |
a0f97e06a
|
69 |
CPP = $(CC) -E $(KBUILD_CFLAGS) |
14cf11af6
|
70 |
|
2578bfae8
|
71 |
CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ |
14cf11af6
|
72 73 |
ifeq ($(CONFIG_PPC64),y) |
f7d4f68d9
|
74 |
GCC_BROKEN_VEC := $(call cc-ifversion, -lt, 0400, y) |
14cf11af6
|
75 76 77 78 |
ifeq ($(CONFIG_POWER4_ONLY),y) ifeq ($(CONFIG_ALTIVEC),y) ifeq ($(GCC_BROKEN_VEC),y) |
a0f97e06a
|
79 |
KBUILD_CFLAGS += $(call cc-option,-mcpu=970) |
14cf11af6
|
80 |
else |
a0f97e06a
|
81 |
KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) |
14cf11af6
|
82 83 |
endif else |
a0f97e06a
|
84 |
KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) |
14cf11af6
|
85 86 |
endif else |
a0f97e06a
|
87 |
KBUILD_CFLAGS += $(call cc-option,-mtune=power4) |
14cf11af6
|
88 89 |
endif endif |
772320e84
|
90 |
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o |
7fca5dc8a
|
91 |
|
3164cccdc
|
92 |
ifeq ($(CONFIG_TUNE_CELL),y) |
a0f97e06a
|
93 |
KBUILD_CFLAGS += $(call cc-option,-mtune=cell) |
3164cccdc
|
94 |
endif |
d3f67fbb9
|
95 |
# No AltiVec instruction when building kernel |
a0f97e06a
|
96 |
KBUILD_CFLAGS += $(call cc-option,-mno-altivec) |
d3f67fbb9
|
97 |
|
0197cd2e3
|
98 |
# No SPE instruction when building kernel |
ce400c010
|
99 |
# (We use all available options to help semi-broken compilers) |
0197cd2e3
|
100 |
KBUILD_CFLAGS += $(call cc-option,-mno-spe) |
ce400c010
|
101 |
KBUILD_CFLAGS += $(call cc-option,-mspe=no) |
0197cd2e3
|
102 |
|
14cf11af6
|
103 104 |
# Enable unit-at-a-time mode when possible. It shrinks the # kernel considerably. |
a0f97e06a
|
105 |
KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) |
14cf11af6
|
106 |
|
d0679c730
|
107 108 109 110 |
# FIXME: the module load should be taught about the additional relocs # generated by this. # revert to pre-gcc-4.4 behaviour of .eh_frame KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) |
57647a4da
|
111 112 |
# Never use string load/store instructions as they are # often slow when they are implemented at all |
a0f97e06a
|
113 |
KBUILD_CFLAGS += -mno-string |
14cf11af6
|
114 |
|
f48b8296b
|
115 |
ifeq ($(CONFIG_6xx),y) |
a0f97e06a
|
116 |
KBUILD_CFLAGS += -mcpu=powerpc |
f48b8296b
|
117 |
endif |
7563dc645
|
118 |
# Work around a gcc code-gen bug with -fno-omit-frame-pointer. |
606576ce8
|
119 |
ifeq ($(CONFIG_FUNCTION_TRACER),y) |
7563dc645
|
120 121 |
KBUILD_CFLAGS += -mno-sched-epilog endif |
14cf11af6
|
122 123 124 125 126 |
cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivec cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec cpu-as-$(CONFIG_E500) += -Wa,-me500 cpu-as-$(CONFIG_E200) += -Wa,-me200 |
222d394d3
|
127 |
KBUILD_AFLAGS += $(cpu-as-y) |
a0f97e06a
|
128 |
KBUILD_CFLAGS += $(cpu-as-y) |
14cf11af6
|
129 |
|
2578bfae8
|
130 |
head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o |
14cf11af6
|
131 |
head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o |
15f6527e8
|
132 |
head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o |
14cf11af6
|
133 134 |
head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o head-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o |
9994a3386
|
135 |
head-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o |
14cf11af6
|
136 |
head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o |
e821ea70f
|
137 |
head-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o |
14cf11af6
|
138 |
|
daec962e2
|
139 |
core-y += arch/powerpc/kernel/ \ |
daec962e2
|
140 141 142 |
arch/powerpc/mm/ \ arch/powerpc/lib/ \ arch/powerpc/sysdev/ \ |
1a3d1fc22
|
143 |
arch/powerpc/platforms/ \ |
0ca87f05b
|
144 145 |
arch/powerpc/math-emu/ \ arch/powerpc/net/ |
f78541dce
|
146 |
core-$(CONFIG_XMON) += arch/powerpc/xmon/ |
bbf45ba57
|
147 |
core-$(CONFIG_KVM) += arch/powerpc/kvm/ |
14cf11af6
|
148 149 |
drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ |
135f0b17a
|
150 |
# Default to zImage, override when needed |
254313338
|
151 |
all: zImage |
14cf11af6
|
152 |
|
e32e78c5e
|
153 |
# With make 3.82 we cannot mix normal and wildcard targets |
c686ecf50
|
154 |
BOOT_TARGETS1 := zImage zImage.initrd uImage |
e32e78c5e
|
155 |
BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% |
cabb55871
|
156 |
|
e32e78c5e
|
157 |
PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) |
cabb55871
|
158 |
|
94b212c29
|
159 |
boot := arch/$(ARCH)/boot |
14cf11af6
|
160 |
|
144ef909c
|
161 162 163 164 165 166 167 168 169 170 |
ifeq ($(CONFIG_RELOCATABLE),y) quiet_cmd_relocs_check = CALL $< cmd_relocs_check = perl $< "$(OBJDUMP)" "$(obj)/vmlinux" PHONY += relocs_check relocs_check: arch/powerpc/relocs_check.pl vmlinux $(call cmd,relocs_check) zImage: relocs_check endif |
e32e78c5e
|
171 172 173 174 175 176 177 |
$(BOOT_TARGETS1): vmlinux $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) $(BOOT_TARGETS2): vmlinux $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) bootwrapper_install: |
20f629549
|
178 |
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
773f76b16
|
179 |
|
e32e78c5e
|
180 |
%.dtb: |
773f76b16
|
181 |
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
14cf11af6
|
182 183 |
define archhelp |
70bf0333d
|
184 185 186 187 188 189 190 191 |
@echo '* zImage - Build default images selected by kernel config' @echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' @echo ' uImage - U-Boot native image format' @echo ' cuImage.<dt> - Backwards compatible U-Boot image for older' @echo ' versions which do not support device trees' @echo ' dtbImage.<dt> - zImage with an embedded device tree blob' @echo ' simpleImage.<dt> - Firmware independent image.' @echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' |
14cf11af6
|
192 |
@echo ' install - Install kernel using' |
caa27b66b
|
193 194 |
@echo ' (your) ~/bin/$(INSTALLKERNEL) or' @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' |
14cf11af6
|
195 |
@echo ' install to $$(INSTALL_PATH) and run lilo' |
437a58db5
|
196 |
@echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' |
70bf0333d
|
197 198 199 200 201 202 |
@echo '' @echo ' Targets with <dt> embed a device tree blob inside the image' @echo ' These targets support board with firmware that does not' @echo ' support passing a device tree directly. Replace <dt> with the' @echo ' name of a dts file from the arch/$(ARCH)/boot/dts/ directory' @echo ' (minus the .dts extension).' |
14cf11af6
|
203 |
endef |
3f85d63ea
|
204 |
install: |
254313338
|
205 |
$(Q)$(MAKE) $(build)=$(boot) install |
928370c67
|
206 |
|
8150caad0
|
207 208 209 210 211 |
vdso_install: ifeq ($(CONFIG_PPC64),y) $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ endif $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ |
14cf11af6
|
212 |
archclean: |
a3a9e99e3
|
213 |
$(Q)$(MAKE) $(clean)=$(boot) |
705672935
|
214 |
|
14cf11af6
|
215 |
archprepare: checkbin |
14cf11af6
|
216 217 218 219 220 221 |
# Use the file '.tmp_gas_check' for binutils tests, as gas won't output # to stdout and these checks are run even on install targets. TOUT := .tmp_gas_check # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec # instructions. # gcc-3.4 and binutils-2.14 are a fatal combination. |
14cf11af6
|
222 223 |
checkbin: |
ad14336de
|
224 |
@if test "$(call cc-version)" = "0304" ; then \ |
14cf11af6
|
225 226 227 228 229 230 231 |
if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ echo 'correctly with gcc-3.4 and your version of binutils.'; \ echo '*** Please upgrade your binutils or downgrade your gcc'; \ false; \ fi ; \ fi |
f5e83fa4c
|
232 233 234 235 236 237 238 239 |
@if test "$(call cc-fullversion)" = "040200" \ && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ echo 'kernel with modules enabled.' ; \ echo -n '*** Please use a different GCC version or ' ; \ echo 'disable kernel modules' ; \ false ; \ fi |
14cf11af6
|
240 241 |
CLEAN_FILES += $(TOUT) |