Blame view

arch/powerpc/Makefile 7.99 KB
14cf11af6   Paul Mackerras   powerpc: Merge en...
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   Paul Mackerras   powerpc: Merge en...
14
  HAS_BIARCH	:= $(call cc-option-yn, -m32)
14cf11af6   Paul Mackerras   powerpc: Merge en...
15
16
17
18
  # Set default 32 bits cross compilers for vdso and boot wrapper
  CROSS32_COMPILE ?=
  
  CROSS32CC		:= $(CROSS32_COMPILE)gcc
2bf118197   Paul Mackerras   [POWERPC] Create ...
19
  CROSS32AR		:= $(CROSS32_COMPILE)ar
14cf11af6   Paul Mackerras   powerpc: Merge en...
20
21
22
23
  
  ifeq ($(HAS_BIARCH),y)
  ifeq ($(CROSS32_COMPILE),)
  CROSS32CC	:= $(CC) -m32
8995ac870   Segher Boessenkool   [POWERPC] Specify...
24
  CROSS32AR	:= GNUTARGET=elf32-powerpc $(AR)
14cf11af6   Paul Mackerras   powerpc: Merge en...
25
26
  endif
  endif
1976aef97   Segher Boessenkool   powerpc: Get rid ...
27
  export CROSS32CC CROSS32AR
14cf11af6   Paul Mackerras   powerpc: Merge en...
28

ca786f83a   Adrian Bunk   [POWERPC] Select ...
29
  ifeq ($(CROSS_COMPILE),)
8a5abdf80   Paul Mackerras   powerpc: Move def...
30
  KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
ca786f83a   Adrian Bunk   [POWERPC] Select ...
31
32
33
  else
  KBUILD_DEFCONFIG := ppc64_defconfig
  endif
8a5abdf80   Paul Mackerras   powerpc: Move def...
34

94b212c29   Paul Mackerras   powerpc: Move ppc...
35
36
  ifeq ($(CONFIG_PPC64),y)
  OLDARCH	:= ppc64
94b212c29   Paul Mackerras   powerpc: Move ppc...
37

14cf11af6   Paul Mackerras   powerpc: Merge en...
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   Stephen Rothwell   powerpc: clean up...
45
  OLDARCH	:= ppc
2578bfae8   Stephen Rothwell   [POWERPC] Create ...
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   Paul Mackerras   powerpc: Merge en...
52
  endif
190554db7   Stephen Rothwell   powerpc: fix unam...
53
  UTS_MACHINE := $(OLDARCH)
14cf11af6   Paul Mackerras   powerpc: Merge en...
54
  ifeq ($(HAS_BIARCH),y)
2578bfae8   Stephen Rothwell   [POWERPC] Create ...
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   Paul Mackerras   powerpc: Merge en...
59
  endif
549e8152d   Paul Mackerras   powerpc: Make the...
60
61
62
  LDFLAGS_vmlinux-yy := -Bstatic
  LDFLAGS_vmlinux-$(CONFIG_PPC64)$(CONFIG_RELOCATABLE) := -pie
  LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-yy)
14cf11af6   Paul Mackerras   powerpc: Merge en...
63

af9719c30   Anton Blanchard   powerpc: Use -mtr...
64
  CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc -mtraceback=no -mcall-aixdesc
1993cbf4a   Kumar Gala   [POWERPC] Provide...
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   Sam Ravnborg   kbuild: enable 'm...
69
  CPP		= $(CC) -E $(KBUILD_CFLAGS)
14cf11af6   Paul Mackerras   powerpc: Merge en...
70

2578bfae8   Stephen Rothwell   [POWERPC] Create ...
71
  CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
14cf11af6   Paul Mackerras   powerpc: Merge en...
72
73
  
  ifeq ($(CONFIG_PPC64),y)
f7d4f68d9   Frans Pop   powerpc: Makefile...
74
  GCC_BROKEN_VEC	:= $(call cc-ifversion, -lt, 0400, y)
14cf11af6   Paul Mackerras   powerpc: Merge en...
75
76
77
78
  
  ifeq ($(CONFIG_POWER4_ONLY),y)
  ifeq ($(CONFIG_ALTIVEC),y)
  ifeq ($(GCC_BROKEN_VEC),y)
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
79
  	KBUILD_CFLAGS += $(call cc-option,-mcpu=970)
14cf11af6   Paul Mackerras   powerpc: Merge en...
80
  else
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
81
  	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
14cf11af6   Paul Mackerras   powerpc: Merge en...
82
83
  endif
  else
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
84
  	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
14cf11af6   Paul Mackerras   powerpc: Merge en...
85
86
  endif
  else
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
87
  	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
14cf11af6   Paul Mackerras   powerpc: Merge en...
88
89
  endif
  endif
772320e84   Michal Marek   Merge commit 'v2....
90
  KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
7fca5dc8a   Stephen Rothwell   powerpc: Fix modu...
91

3164cccdc   Arnd Bergmann   [POWERPC] add Kco...
92
  ifeq ($(CONFIG_TUNE_CELL),y)
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
93
  	KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
3164cccdc   Arnd Bergmann   [POWERPC] add Kco...
94
  endif
d3f67fbb9   Paul Mackerras   powerpc: Add -mno...
95
  # No AltiVec instruction when building kernel
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
96
  KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
d3f67fbb9   Paul Mackerras   powerpc: Add -mno...
97

0197cd2e3   Kumar Gala   [POWERPC] Add -mn...
98
  # No SPE instruction when building kernel
ce400c010   Thiemo Seufer   powerpc: Enforce ...
99
  # (We use all available options to help semi-broken compilers)
0197cd2e3   Kumar Gala   [POWERPC] Add -mn...
100
  KBUILD_CFLAGS += $(call cc-option,-mno-spe)
ce400c010   Thiemo Seufer   powerpc: Enforce ...
101
  KBUILD_CFLAGS += $(call cc-option,-mspe=no)
0197cd2e3   Kumar Gala   [POWERPC] Add -mn...
102

14cf11af6   Paul Mackerras   powerpc: Merge en...
103
104
  # Enable unit-at-a-time mode when possible. It shrinks the
  # kernel considerably.
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
105
  KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
14cf11af6   Paul Mackerras   powerpc: Merge en...
106

d0679c730   Andi Kleen   kbuild: move -fno...
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   Benjamin Herrenschmidt   [POWERPC] Always ...
111
112
  # Never use string load/store instructions as they are
  # often slow when they are implemented at all
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
113
  KBUILD_CFLAGS		+= -mno-string
14cf11af6   Paul Mackerras   powerpc: Merge en...
114

f48b8296b   Olaf Hering   [PATCH] powerpc32...
115
  ifeq ($(CONFIG_6xx),y)
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
116
  KBUILD_CFLAGS		+= -mcpu=powerpc
f48b8296b   Olaf Hering   [PATCH] powerpc32...
117
  endif
7563dc645   Tony Breeds   powerpc: Work aro...
118
  # Work around a gcc code-gen bug with -fno-omit-frame-pointer.
606576ce8   Steven Rostedt   ftrace: rename FT...
119
  ifeq ($(CONFIG_FUNCTION_TRACER),y)
7563dc645   Tony Breeds   powerpc: Work aro...
120
121
  KBUILD_CFLAGS		+= -mno-sched-epilog
  endif
14cf11af6   Paul Mackerras   powerpc: Merge en...
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   Sam Ravnborg   kbuild: enable 'm...
127
  KBUILD_AFLAGS += $(cpu-as-y)
a0f97e06a   Sam Ravnborg   kbuild: enable 'm...
128
  KBUILD_CFLAGS += $(cpu-as-y)
14cf11af6   Paul Mackerras   powerpc: Merge en...
129

2578bfae8   Stephen Rothwell   [POWERPC] Create ...
130
  head-y				:= arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o
14cf11af6   Paul Mackerras   powerpc: Merge en...
131
  head-$(CONFIG_8xx)		:= arch/powerpc/kernel/head_8xx.o
15f6527e8   Josh Boyer   [POWERPC] Rename ...
132
  head-$(CONFIG_40x)		:= arch/powerpc/kernel/head_40x.o
14cf11af6   Paul Mackerras   powerpc: Merge en...
133
134
  head-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
  head-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
9994a3386   Paul Mackerras   powerpc: Introduc...
135
  head-$(CONFIG_PPC64)		+= arch/powerpc/kernel/entry_64.o
14cf11af6   Paul Mackerras   powerpc: Merge en...
136
  head-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
e821ea70f   Benjamin Herrenschmidt   powerpc: Move VMX...
137
  head-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
14cf11af6   Paul Mackerras   powerpc: Merge en...
138

daec962e2   Paul Mackerras   powerpc: Use arch...
139
  core-y				+= arch/powerpc/kernel/ \
daec962e2   Paul Mackerras   powerpc: Use arch...
140
141
142
  				   arch/powerpc/mm/ \
  				   arch/powerpc/lib/ \
  				   arch/powerpc/sysdev/ \
1a3d1fc22   Liu Yu   powerpc/math-emu:...
143
  				   arch/powerpc/platforms/ \
0ca87f05b   Matt Evans   net: filter: BPF ...
144
145
  				   arch/powerpc/math-emu/ \
  				   arch/powerpc/net/
f78541dce   Paul Mackerras   powerpc: Merge xmon
146
  core-$(CONFIG_XMON)		+= arch/powerpc/xmon/
bbf45ba57   Hollis Blanchard   KVM: ppc: PowerPC...
147
  core-$(CONFIG_KVM) 		+= arch/powerpc/kvm/
14cf11af6   Paul Mackerras   powerpc: Merge en...
148
149
  
  drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
135f0b17a   Tom Rini   [PATCH] powerpc/b...
150
  # Default to zImage, override when needed
254313338   Grant Likely   [POWERPC] bootwra...
151
  all: zImage
14cf11af6   Paul Mackerras   powerpc: Merge en...
152

e32e78c5e   Sam Ravnborg   powerpc: fix buil...
153
  # With make 3.82 we cannot mix normal and wildcard targets
c686ecf50   Anatolij Gustschin   powerpc: Fix typo...
154
  BOOT_TARGETS1 := zImage zImage.initrd uImage
e32e78c5e   Sam Ravnborg   powerpc: fix buil...
155
  BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
cabb55871   Stephen Rothwell   powerpc: make iSe...
156

e32e78c5e   Sam Ravnborg   powerpc: fix buil...
157
  PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
cabb55871   Stephen Rothwell   powerpc: make iSe...
158

94b212c29   Paul Mackerras   powerpc: Move ppc...
159
  boot := arch/$(ARCH)/boot
14cf11af6   Paul Mackerras   powerpc: Merge en...
160

144ef909c   Tony Breeds   powerpc: Check fo...
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   Sam Ravnborg   powerpc: fix buil...
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   Paul Mackerras   powerpc: Make bui...
178
  	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
773f76b16   David Woodhouse   [POWERPC] Impleme...
179

e32e78c5e   Sam Ravnborg   powerpc: fix buil...
180
  %.dtb:
773f76b16   David Woodhouse   [POWERPC] Impleme...
181
  	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
14cf11af6   Paul Mackerras   powerpc: Merge en...
182
183
  
  define archhelp
70bf0333d   Grant Likely   powerpc/bootwrapp...
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   Paul Mackerras   powerpc: Merge en...
192
    @echo '  install         - Install kernel using'
caa27b66b   Sam Ravnborg   kbuild: use INSTA...
193
194
    @echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
    @echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
14cf11af6   Paul Mackerras   powerpc: Merge en...
195
    @echo '                    install to $$(INSTALL_PATH) and run lilo'
437a58db5   Paul Mackerras   powerpc: Move rem...
196
    @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
70bf0333d   Grant Likely   powerpc/bootwrapp...
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   Paul Mackerras   powerpc: Merge en...
203
  endef
3f85d63ea   Sam Ravnborg   x86: fix vdso_ins...
204
  install:
254313338   Grant Likely   [POWERPC] bootwra...
205
  	$(Q)$(MAKE) $(build)=$(boot) install
928370c67   Akinobu Mita   [POWERPC] Enable ...
206

8150caad0   Roland McGrath   [POWERPC] powerpc...
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   Paul Mackerras   powerpc: Merge en...
212
  archclean:
a3a9e99e3   Paul Mackerras   powerpc: Fix buil...
213
  	$(Q)$(MAKE) $(clean)=$(boot)
705672935   Andreas Gruenbacher   [PATCH] Fix build...
214

14cf11af6   Paul Mackerras   powerpc: Merge en...
215
  archprepare: checkbin
14cf11af6   Paul Mackerras   powerpc: Merge en...
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   Paul Mackerras   powerpc: Merge en...
222
223
  
  checkbin:
ad14336de   Sam Ravnborg   kbuild: remove GC...
224
  	@if test "$(call cc-version)" = "0304" ; then \
14cf11af6   Paul Mackerras   powerpc: Merge en...
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   Segher Boessenkool   powerpc: Refuse t...
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   Paul Mackerras   powerpc: Merge en...
240
241
  
  CLEAN_FILES += $(TOUT)