1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.  See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 1994, 95, 96, 2003 by Ralf Baechle
7# DECStation modifications by Paul M. Antoine, 1996
8# Copyright (C) 2002, 2003, 2004  Maciej W. Rozycki
9#
10# This file is included by the global makefile so that you can add your own
11# architecture-specific flags and dependencies. Remember to do have actions
12# for "archclean" cleaning up for this architecture.
13#
14
15cflags-y :=
16
17#
18# Select the object file format to substitute into the linker script.
19#
20ifdef CONFIG_CPU_LITTLE_ENDIAN
2132bit-tool-prefix	= mipsel-linux-
2264bit-tool-prefix	= mips64el-linux-
2332bit-bfd		= elf32-tradlittlemips
2464bit-bfd		= elf64-tradlittlemips
2532bit-emul		= elf32ltsmip
2664bit-emul		= elf64ltsmip
27else
2832bit-tool-prefix	= mips-linux-
2964bit-tool-prefix	= mips64-linux-
3032bit-bfd		= elf32-tradbigmips
3164bit-bfd		= elf64-tradbigmips
3232bit-emul		= elf32btsmip
3364bit-emul		= elf64btsmip
34endif
35
36ifdef CONFIG_32BIT
37tool-prefix		= $(32bit-tool-prefix)
38UTS_MACHINE		:= mips
39endif
40ifdef CONFIG_64BIT
41tool-prefix		= $(64bit-tool-prefix)
42UTS_MACHINE		:= mips64
43endif
44
45ifdef CONFIG_CROSSCOMPILE
46CROSS_COMPILE		?= $(tool-prefix)
47endif
48
49ifdef CONFIG_32BIT
50ld-emul			= $(32bit-emul)
51vmlinux-32		= vmlinux
52vmlinux-64		= vmlinux.64
53
54cflags-y		+= -mabi=32
55endif
56
57ifdef CONFIG_64BIT
58ld-emul			= $(64bit-emul)
59vmlinux-32		= vmlinux.32
60vmlinux-64		= vmlinux
61
62cflags-y		+= -mabi=64
63ifdef CONFIG_BUILD_ELF64
64cflags-y		+= $(call cc-option,-mno-explicit-relocs)
65else
66cflags-y		+= $(call cc-option,-msym32)
67endif
68endif
69
70
71#
72# GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
73# code since it only slows down the whole thing.  At some point we might make
74# use of global pointer optimizations but their use of $28 conflicts with
75# the current pointer optimization.
76#
77# The DECStation requires an ECOFF kernel for remote booting, other MIPS
78# machines may also.  Since BFD is incredibly buggy with respect to
79# crossformat linking we rely on the elf2ecoff tool for format conversion.
80#
81cflags-y			+= -G 0 -mno-abicalls -fno-pic -pipe
82cflags-y			+= -msoft-float
83LDFLAGS_vmlinux			+= -G 0 -static -n -nostdlib
84MODFLAGS			+= -mlong-calls -fno-common
85
86# Always compile with debug symbols. They will be stripped by the router
87# makefile to produce the final kernel. Debug versions of kernel and brcm
88# kernel modules will be kept with the extension dbgsym attached to their
89# names.
90cflags-y += -ggdb
91
92cflags-y += -ffreestanding
93
94#
95# We explicitly add the endianness specifier if needed, this allows
96# to compile kernels with a toolchain for the other endianness. We
97# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
98# when fed the toolchain default!
99#
100# Certain gcc versions upto gcc 4.1.1 (probably 4.2-subversion as of
101# 2006-10-10 don't properly change the predefined symbols if -EB / -EL
102# are used, so we kludge that here.  A bug has been filed at
103# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.
104#
105undef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
106undef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
107predef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
108predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
109cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
110cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
111
112cflags-$(CONFIG_CPU_HAS_SMARTMIPS)	+= $(call cc-option,-msmartmips)
113
114cflags-$(CONFIG_SB1XXX_CORELIS)	+= $(call cc-option,-mno-sched-prolog) \
115				   -fno-omit-frame-pointer
116
117#
118# CPU-dependent compiler/assembler options for optimization.
119#
120cflags-$(CONFIG_CPU_R3000)	+= -march=r3000
121cflags-$(CONFIG_CPU_TX39XX)	+= -march=r3900
122cflags-$(CONFIG_CPU_R6000)	+= -march=r6000 -Wa,--trap
123cflags-$(CONFIG_CPU_R4300)	+= -march=r4300 -Wa,--trap
124cflags-$(CONFIG_CPU_VR41XX)	+= -march=r4100 -Wa,--trap
125cflags-$(CONFIG_CPU_R4X00)	+= -march=r4600 -Wa,--trap
126cflags-$(CONFIG_CPU_TX49XX)	+= -march=r4600 -Wa,--trap
127cflags-$(CONFIG_CPU_MIPS32_R1)	+= $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
128			-Wa,-mips32 -Wa,--trap
129cflags-$(CONFIG_CPU_MIPS32_R2)	+= $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
130			-Wa,-mips32r2 -Wa,--trap
131cflags-$(CONFIG_CPU_MIPS64_R1)	+= $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
132			-Wa,-mips64 -Wa,--trap
133cflags-$(CONFIG_CPU_MIPS64_R2)	+= $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
134			-Wa,-mips64r2 -Wa,--trap
135cflags-$(CONFIG_CPU_R5000)	+= -march=r5000 -Wa,--trap
136cflags-$(CONFIG_CPU_R5432)	+= $(call cc-option,-march=r5400,-march=r5000) \
137			-Wa,--trap
138cflags-$(CONFIG_CPU_NEVADA)	+= $(call cc-option,-march=rm5200,-march=r5000) \
139			-Wa,--trap
140cflags-$(CONFIG_CPU_RM7000)	+= $(call cc-option,-march=rm7000,-march=r5000) \
141			-Wa,--trap
142cflags-$(CONFIG_CPU_RM9000)	+= $(call cc-option,-march=rm9000,-march=r5000) \
143			-Wa,--trap
144cflags-$(CONFIG_CPU_SB1)	+= $(call cc-option,-march=sb1,-march=r5000) \
145			-Wa,--trap
146cflags-$(CONFIG_CPU_R8000)	+= -march=r8000 -Wa,--trap
147cflags-$(CONFIG_CPU_R10000)	+= $(call cc-option,-march=r10000,-march=r8000) \
148			-Wa,--trap
149
150ifdef CONFIG_CPU_SB1
151ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
152MODFLAGS	+= -msb1-pass1-workarounds
153endif
154endif
155
156cflags-y += $(call check_gcc, -m4710a0kern, )
157
158#
159# Firmware support
160#
161libs-$(CONFIG_ARC)		+= arch/mips/arc/
162libs-$(CONFIG_SIBYTE_CFE)	+= arch/mips/sibyte/cfe/
163
164#
165# Board-dependent options and extra files
166#
167
168#
169# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
170#
171core-$(CONFIG_MACH_JAZZ)	+= arch/mips/jazz/
172cflags-$(CONFIG_MACH_JAZZ)	+= -Iinclude/asm-mips/mach-jazz
173load-$(CONFIG_MACH_JAZZ)	+= 0xffffffff80080000
174
175#
176# Common Alchemy Au1x00 stuff
177#
178core-$(CONFIG_SOC_AU1X00)	+= arch/mips/au1000/common/
179cflags-$(CONFIG_SOC_AU1X00)	+= -Iinclude/asm-mips/mach-au1x00
180
181#
182# AMD Alchemy Pb1000 eval board
183#
184libs-$(CONFIG_MIPS_PB1000)	+= arch/mips/au1000/pb1000/
185cflags-$(CONFIG_MIPS_PB1000)	+= -Iinclude/asm-mips/mach-pb1x00
186load-$(CONFIG_MIPS_PB1000)	+= 0xffffffff80100000
187
188#
189# AMD Alchemy Pb1100 eval board
190#
191libs-$(CONFIG_MIPS_PB1100)	+= arch/mips/au1000/pb1100/
192cflags-$(CONFIG_MIPS_PB1100)	+= -Iinclude/asm-mips/mach-pb1x00
193load-$(CONFIG_MIPS_PB1100)	+= 0xffffffff80100000
194
195#
196# AMD Alchemy Pb1500 eval board
197#
198libs-$(CONFIG_MIPS_PB1500)	+= arch/mips/au1000/pb1500/
199cflags-$(CONFIG_MIPS_PB1500)	+= -Iinclude/asm-mips/mach-pb1x00
200load-$(CONFIG_MIPS_PB1500)	+= 0xffffffff80100000
201
202#
203# AMD Alchemy Pb1550 eval board
204#
205libs-$(CONFIG_MIPS_PB1550)	+= arch/mips/au1000/pb1550/
206cflags-$(CONFIG_MIPS_PB1550)	+= -Iinclude/asm-mips/mach-pb1x00
207load-$(CONFIG_MIPS_PB1550)	+= 0xffffffff80100000
208
209#
210# AMD Alchemy Pb1200 eval board
211#
212libs-$(CONFIG_MIPS_PB1200)	+= arch/mips/au1000/pb1200/
213cflags-$(CONFIG_MIPS_PB1200)	+= -Iinclude/asm-mips/mach-pb1x00
214load-$(CONFIG_MIPS_PB1200)	+= 0xffffffff80100000
215
216#
217# AMD Alchemy Db1000 eval board
218#
219libs-$(CONFIG_MIPS_DB1000)	+= arch/mips/au1000/db1x00/
220cflags-$(CONFIG_MIPS_DB1000)	+= -Iinclude/asm-mips/mach-db1x00
221load-$(CONFIG_MIPS_DB1000)	+= 0xffffffff80100000
222
223#
224# AMD Alchemy Db1100 eval board
225#
226libs-$(CONFIG_MIPS_DB1100)	+= arch/mips/au1000/db1x00/
227cflags-$(CONFIG_MIPS_DB1100)	+= -Iinclude/asm-mips/mach-db1x00
228load-$(CONFIG_MIPS_DB1100)	+= 0xffffffff80100000
229
230#
231# AMD Alchemy Db1500 eval board
232#
233libs-$(CONFIG_MIPS_DB1500)	+= arch/mips/au1000/db1x00/
234cflags-$(CONFIG_MIPS_DB1500)	+= -Iinclude/asm-mips/mach-db1x00
235load-$(CONFIG_MIPS_DB1500)	+= 0xffffffff80100000
236
237#
238# AMD Alchemy Db1550 eval board
239#
240libs-$(CONFIG_MIPS_DB1550)	+= arch/mips/au1000/db1x00/
241cflags-$(CONFIG_MIPS_DB1550)	+= -Iinclude/asm-mips/mach-db1x00
242load-$(CONFIG_MIPS_DB1550)	+= 0xffffffff80100000
243
244#
245# AMD Alchemy Db1200 eval board
246#
247libs-$(CONFIG_MIPS_DB1200)	+= arch/mips/au1000/pb1200/
248cflags-$(CONFIG_MIPS_DB1200)	+= -Iinclude/asm-mips/mach-db1x00
249load-$(CONFIG_MIPS_DB1200)	+= 0xffffffff80100000
250
251#
252# AMD Alchemy Bosporus eval board
253#
254libs-$(CONFIG_MIPS_BOSPORUS)	+= arch/mips/au1000/db1x00/
255cflags-$(CONFIG_MIPS_BOSPORUS)	+= -Iinclude/asm-mips/mach-db1x00
256load-$(CONFIG_MIPS_BOSPORUS)	+= 0xffffffff80100000
257
258#
259# AMD Alchemy Mirage eval board
260#
261libs-$(CONFIG_MIPS_MIRAGE)	+= arch/mips/au1000/db1x00/
262cflags-$(CONFIG_MIPS_MIRAGE)	+= -Iinclude/asm-mips/mach-db1x00
263load-$(CONFIG_MIPS_MIRAGE)	+= 0xffffffff80100000
264
265#
266# 4G-Systems eval board
267#
268libs-$(CONFIG_MIPS_MTX1)	+= arch/mips/au1000/mtx-1/
269load-$(CONFIG_MIPS_MTX1)	+= 0xffffffff80100000
270
271#
272# MyCable eval board
273#
274libs-$(CONFIG_MIPS_XXS1500)	+= arch/mips/au1000/xxs1500/
275load-$(CONFIG_MIPS_XXS1500)	+= 0xffffffff80100000
276
277#
278# Cobalt Server
279#
280core-$(CONFIG_MIPS_COBALT)	+= arch/mips/cobalt/
281cflags-$(CONFIG_MIPS_COBALT)	+= -Iinclude/asm-mips/mach-cobalt
282load-$(CONFIG_MIPS_COBALT)	+= 0xffffffff80080000
283
284#
285# DECstation family
286#
287core-$(CONFIG_MACH_DECSTATION)	+= arch/mips/dec/
288cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec
289libs-$(CONFIG_MACH_DECSTATION)	+= arch/mips/dec/prom/
290load-$(CONFIG_MACH_DECSTATION)	+= 0xffffffff80040000
291CLEAN_FILES			+= drivers/tc/lk201-map.c
292
293#
294# Galileo EV64120 Board
295#
296core-$(CONFIG_MIPS_EV64120)	+= arch/mips/gt64120/ev64120/
297core-$(CONFIG_MIPS_EV64120)	+= arch/mips/gt64120/common/
298cflags-$(CONFIG_MIPS_EV64120)	+= -Iinclude/asm-mips/mach-ev64120
299load-$(CONFIG_MIPS_EV64120)	+= 0xffffffff80100000
300
301#
302# Wind River PPMC Board (4KC + GT64120)
303#
304core-$(CONFIG_WR_PPMC)		+= arch/mips/gt64120/wrppmc/
305cflags-$(CONFIG_WR_PPMC)		+= -Iinclude/asm-mips/mach-wrppmc
306load-$(CONFIG_WR_PPMC)		+= 0xffffffff80100000
307
308#
309# For all MIPS, Inc. eval boards
310#
311core-$(CONFIG_MIPS_BOARDS_GEN)	+= arch/mips/mips-boards/generic/
312
313#
314# MIPS Atlas board
315#
316core-$(CONFIG_MIPS_ATLAS)	+= arch/mips/mips-boards/atlas/
317cflags-$(CONFIG_MIPS_ATLAS)	+= -Iinclude/asm-mips/mach-atlas
318cflags-$(CONFIG_MIPS_ATLAS)	+= -Iinclude/asm-mips/mach-mips
319load-$(CONFIG_MIPS_ATLAS)	+= 0xffffffff80100000
320
321#
322# MIPS Malta board
323#
324core-$(CONFIG_MIPS_MALTA)	+= arch/mips/mips-boards/malta/
325cflags-$(CONFIG_MIPS_MALTA)	+= -Iinclude/asm-mips/mach-mips
326load-$(CONFIG_MIPS_MALTA)	+= 0xffffffff80100000
327
328#
329# MIPS SEAD board
330#
331core-$(CONFIG_MIPS_SEAD)	+= arch/mips/mips-boards/sead/
332cflags-$(CONFIG_MIPS_SEAD)	+= -Iinclude/asm-mips/mach-mips
333load-$(CONFIG_MIPS_SEAD)	+= 0xffffffff80100000
334
335#
336# MIPS SIM
337#
338core-$(CONFIG_MIPS_SIM)		+= arch/mips/mips-boards/sim/
339cflags-$(CONFIG_MIPS_SIM)	+= -Iinclude/asm-mips/mach-sim
340load-$(CONFIG_MIPS_SIM)		+= 0x80100000
341
342#
343# Momentum Ocelot board
344#
345# The Ocelot setup.o must be linked early - it does the ioremap() for the
346# mips_io_port_base.
347#
348core-$(CONFIG_MOMENCO_OCELOT)	+= arch/mips/gt64120/common/ \
349				   arch/mips/gt64120/momenco_ocelot/
350cflags-$(CONFIG_MOMENCO_OCELOT)	+= -Iinclude/asm-mips/mach-ocelot
351load-$(CONFIG_MOMENCO_OCELOT)	+= 0xffffffff80100000
352
353#
354# Momentum Ocelot-C and -CS boards
355#
356# The Ocelot-C[S] setup.o must be linked early - it does the ioremap() for the
357# mips_io_port_base.
358core-$(CONFIG_MOMENCO_OCELOT_C)	+= arch/mips/momentum/ocelot_c/
359load-$(CONFIG_MOMENCO_OCELOT_C)	+= 0xffffffff80100000
360
361#
362# PMC-Sierra Yosemite
363#
364core-$(CONFIG_PMC_YOSEMITE)	+= arch/mips/pmc-sierra/yosemite/
365cflags-$(CONFIG_PMC_YOSEMITE)	+= -Iinclude/asm-mips/mach-yosemite
366load-$(CONFIG_PMC_YOSEMITE)	+= 0xffffffff80100000
367
368#
369# Qemu simulating MIPS32 4Kc
370#
371core-$(CONFIG_QEMU)		+= arch/mips/qemu/
372cflags-$(CONFIG_QEMU)		+= -Iinclude/asm-mips/mach-qemu
373load-$(CONFIG_QEMU)		+= 0xffffffff80010000
374
375#
376# Momentum Ocelot-3
377#
378core-$(CONFIG_MOMENCO_OCELOT_3) 	+= arch/mips/momentum/ocelot_3/
379cflags-$(CONFIG_MOMENCO_OCELOT_3)	+= -Iinclude/asm-mips/mach-ocelot3
380load-$(CONFIG_MOMENCO_OCELOT_3) 	+= 0xffffffff80100000
381
382#
383# Basler eXcite
384#
385core-$(CONFIG_BASLER_EXCITE)	+= arch/mips/basler/excite/
386cflags-$(CONFIG_BASLER_EXCITE)	+= -Iinclude/asm-mips/mach-excite
387load-$(CONFIG_BASLER_EXCITE)	+= 0x80100000
388
389#
390# NEC DDB
391#
392core-$(CONFIG_DDB5XXX_COMMON)	+= arch/mips/ddb5xxx/common/
393
394#
395# NEC DDB Vrc-5477
396#
397core-$(CONFIG_DDB5477)		+= arch/mips/ddb5xxx/ddb5477/
398load-$(CONFIG_DDB5477)		+= 0xffffffff80100000
399
400core-$(CONFIG_LASAT)		+= arch/mips/lasat/
401cflags-$(CONFIG_LASAT)		+= -Iinclude/asm-mips/mach-lasat
402load-$(CONFIG_LASAT)		+= 0xffffffff80000000
403
404#
405# Common VR41xx
406#
407core-$(CONFIG_MACH_VR41XX)	+= arch/mips/vr41xx/common/
408cflags-$(CONFIG_MACH_VR41XX)	+= -Iinclude/asm-mips/mach-vr41xx
409
410#
411# NEC VR4133
412#
413core-$(CONFIG_NEC_CMBVR4133)	+= arch/mips/vr41xx/nec-cmbvr4133/
414load-$(CONFIG_NEC_CMBVR4133)	+= 0xffffffff80100000
415
416#
417# ZAO Networks Capcella (VR4131)
418#
419load-$(CONFIG_ZAO_CAPCELLA)	+= 0xffffffff80000000
420
421#
422# Victor MP-C303/304 (VR4122)
423#
424load-$(CONFIG_VICTOR_MPC30X)	+= 0xffffffff80001000
425
426#
427# IBM WorkPad z50 (VR4121)
428#
429core-$(CONFIG_IBM_WORKPAD)	+= arch/mips/vr41xx/ibm-workpad/
430load-$(CONFIG_IBM_WORKPAD)	+= 0xffffffff80004000
431
432#
433# CASIO CASSIPEIA E-55/65 (VR4111)
434#
435core-$(CONFIG_CASIO_E55)	+= arch/mips/vr41xx/casio-e55/
436load-$(CONFIG_CASIO_E55)	+= 0xffffffff80004000
437
438#
439# TANBAC VR4131 multichip module(TB0225) and TANBAC VR4131DIMM(TB0229) (VR4131)
440#
441load-$(CONFIG_TANBAC_TB022X)	+= 0xffffffff80000000
442
443#
444# Common Philips PNX8550
445#
446core-$(CONFIG_SOC_PNX8550)	+= arch/mips/philips/pnx8550/common/
447cflags-$(CONFIG_SOC_PNX8550)	+= -Iinclude/asm-mips/mach-pnx8550
448
449#
450# Philips PNX8550 JBS board
451#
452libs-$(CONFIG_PNX8550_JBS)	+= arch/mips/philips/pnx8550/jbs/
453#cflags-$(CONFIG_PNX8550_JBS)	+= -Iinclude/asm-mips/mach-pnx8550
454load-$(CONFIG_PNX8550_JBS)	+= 0xffffffff80060000
455
456# Philips PNX8550 STB810 board
457#
458libs-$(CONFIG_PNX8550_STB810)	+= arch/mips/philips/pnx8550/stb810/
459load-$(CONFIG_PNX8550_STB810)	+= 0xffffffff80060000
460
461# NEC EMMA2RH boards
462#
463core-$(CONFIG_EMMA2RH)          += arch/mips/emma2rh/common/
464cflags-$(CONFIG_EMMA2RH)        += -Iinclude/asm-mips/mach-emma2rh
465
466# NEC EMMA2RH Mark-eins
467core-$(CONFIG_MARKEINS)         += arch/mips/emma2rh/markeins/
468load-$(CONFIG_MARKEINS)         += 0xffffffff88100000
469
470#
471# SGI IP22 (Indy/Indigo2)
472#
473# Set the load address to >= 0xffffffff88069000 if you want to leave space for
474# symmon, 0xffffffff80002000 for production kernels.  Note that the value must
475# be aligned to a multiple of the kernel stack size or the handling of the
476# current variable will break so for 64-bit kernels we have to raise the start
477# address by 8kb.
478#
479core-$(CONFIG_SGI_IP22)		+= arch/mips/sgi-ip22/
480cflags-$(CONFIG_SGI_IP22)	+= -Iinclude/asm-mips/mach-ip22
481ifdef CONFIG_32BIT
482load-$(CONFIG_SGI_IP22)		+= 0xffffffff88002000
483endif
484ifdef CONFIG_64BIT
485load-$(CONFIG_SGI_IP22)		+= 0xffffffff88004000
486endif
487
488#
489# SGI-IP27 (Origin200/2000)
490#
491# Set the load address to >= 0xc000000000300000 if you want to leave space for
492# symmon, 0xc00000000001c000 for production kernels.  Note that the value must
493# be 16kb aligned or the handling of the current variable will break.
494#
495ifdef CONFIG_SGI_IP27
496core-$(CONFIG_SGI_IP27)		+= arch/mips/sgi-ip27/
497cflags-$(CONFIG_SGI_IP27)	+= -Iinclude/asm-mips/mach-ip27
498ifdef CONFIG_MAPPED_KERNEL
499load-$(CONFIG_SGI_IP27)		+= 0xc00000004001c000
500OBJCOPYFLAGS			:= --change-addresses=0x3fffffff80000000
501dataoffset-$(CONFIG_SGI_IP27)	+= 0x01000000
502else
503load-$(CONFIG_SGI_IP27)		+= 0xa80000000001c000
504OBJCOPYFLAGS			:= --change-addresses=0x57ffffff80000000
505endif
506endif
507
508#
509# SGI-IP32 (O2)
510#
511# Set the load address to >= 80069000 if you want to leave space for symmon,
512# 0xffffffff80004000 for production kernels.  Note that the value must be aligned to
513# a multiple of the kernel stack size or the handling of the current variable
514# will break.
515#
516core-$(CONFIG_SGI_IP32)		+= arch/mips/sgi-ip32/
517cflags-$(CONFIG_SGI_IP32)	+= -Iinclude/asm-mips/mach-ip32
518load-$(CONFIG_SGI_IP32)		+= 0xffffffff80004000
519
520#
521# Sibyte SB1250/BCM1480 SOC
522#
523# This is a LIB so that it links at the end, and initcalls are later
524# the sequence; but it is built as an object so that modules don't get
525# removed (as happens, even if they have __initcall/module_init)
526#
527core-$(CONFIG_SIBYTE_BCM112X)	+= arch/mips/sibyte/sb1250/
528core-$(CONFIG_SIBYTE_BCM112X)	+= arch/mips/sibyte/common/
529cflags-$(CONFIG_SIBYTE_BCM112X)	+= -Iinclude/asm-mips/mach-sibyte \
530			-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
531
532core-$(CONFIG_SIBYTE_SB1250)	+= arch/mips/sibyte/sb1250/
533core-$(CONFIG_SIBYTE_SB1250)	+= arch/mips/sibyte/common/
534cflags-$(CONFIG_SIBYTE_SB1250)	+= -Iinclude/asm-mips/mach-sibyte \
535			-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
536
537core-$(CONFIG_SIBYTE_BCM1x55)	+= arch/mips/sibyte/bcm1480/
538core-$(CONFIG_SIBYTE_BCM1x55)	+= arch/mips/sibyte/common/
539cflags-$(CONFIG_SIBYTE_BCM1x55)	+= -Iinclude/asm-mips/mach-sibyte \
540			-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
541
542core-$(CONFIG_SIBYTE_BCM1x80)	+= arch/mips/sibyte/bcm1480/
543core-$(CONFIG_SIBYTE_BCM1x80)	+= arch/mips/sibyte/common/
544cflags-$(CONFIG_SIBYTE_BCM1x80)	+= -Iinclude/asm-mips/mach-sibyte \
545			-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
546
547#
548# Sibyte BCM91120x (Carmel) board
549# Sibyte BCM91120C (CRhine) board
550# Sibyte BCM91125C (CRhone) board
551# Sibyte BCM91125E (Rhone) board
552# Sibyte SWARM board
553# Sibyte BCM91x80 (BigSur) board
554#
555libs-$(CONFIG_SIBYTE_CARMEL)	+= arch/mips/sibyte/swarm/
556load-$(CONFIG_SIBYTE_CARMEL)	:= 0xffffffff80100000
557libs-$(CONFIG_SIBYTE_CRHINE)	+= arch/mips/sibyte/swarm/
558load-$(CONFIG_SIBYTE_CRHINE)	:= 0xffffffff80100000
559libs-$(CONFIG_SIBYTE_CRHONE)	+= arch/mips/sibyte/swarm/
560load-$(CONFIG_SIBYTE_CRHONE)	:= 0xffffffff80100000
561libs-$(CONFIG_SIBYTE_RHONE)	+= arch/mips/sibyte/swarm/
562load-$(CONFIG_SIBYTE_RHONE)	:= 0xffffffff80100000
563libs-$(CONFIG_SIBYTE_SENTOSA)	+= arch/mips/sibyte/swarm/
564load-$(CONFIG_SIBYTE_SENTOSA)	:= 0xffffffff80100000
565libs-$(CONFIG_SIBYTE_SWARM)	+= arch/mips/sibyte/swarm/
566load-$(CONFIG_SIBYTE_SWARM)	:= 0xffffffff80100000
567libs-$(CONFIG_SIBYTE_BIGSUR)	+= arch/mips/sibyte/swarm/
568load-$(CONFIG_SIBYTE_BIGSUR)	:= 0xffffffff80100000
569
570#
571# SNI RM
572#
573core-$(CONFIG_SNI_RM)		+= arch/mips/sni/
574cflags-$(CONFIG_SNI_RM)		+= -Iinclude/asm-mips/mach-rm
575load-$(CONFIG_SNI_RM)		+= 0xffffffff80600000
576
577#
578# Toshiba JMR-TX3927 board
579#
580core-$(CONFIG_TOSHIBA_JMR3927)	+= arch/mips/jmr3927/rbhma3100/ \
581				   arch/mips/jmr3927/common/
582cflags-$(CONFIG_TOSHIBA_JMR3927) += -Iinclude/asm-mips/mach-jmr3927
583load-$(CONFIG_TOSHIBA_JMR3927)	+= 0xffffffff80050000
584
585#
586# Toshiba RBTX4927 board or
587# Toshiba RBTX4937 board
588#
589core-$(CONFIG_TOSHIBA_RBTX4927)	+= arch/mips/tx4927/toshiba_rbtx4927/
590core-$(CONFIG_TOSHIBA_RBTX4927)	+= arch/mips/tx4927/common/
591load-$(CONFIG_TOSHIBA_RBTX4927)	+= 0xffffffff80020000
592
593#
594# Toshiba RBTX4938 board
595#
596core-$(CONFIG_TOSHIBA_RBTX4938) += arch/mips/tx4938/toshiba_rbtx4938/
597core-$(CONFIG_TOSHIBA_RBTX4938) += arch/mips/tx4938/common/
598load-$(CONFIG_TOSHIBA_RBTX4938) += 0xffffffff80100000
599
600cflags-y			+= -Iinclude/asm-mips/mach-generic
601drivers-$(CONFIG_PCI)		+= arch/mips/pci/
602
603#
604# Broadcom BCM947XX variants
605#
606ifdef CONFIG_BCM947XX
607core-$(CONFIG_BCM947XX) += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm947xx/
608load-$(CONFIG_BCM947XX) := 0xffffffff80001000
609zImage: vmlinux
610endif
611
612ifdef CONFIG_32BIT
613ifdef CONFIG_CPU_LITTLE_ENDIAN
614JIFFIES			= jiffies_64
615else
616JIFFIES			= jiffies_64 + 4
617endif
618else
619JIFFIES			= jiffies_64
620endif
621
622AFLAGS		+= $(cflags-y)
623ASFLAGS		+= $(cflags-y)
624CFLAGS		+= $(cflags-y)
625
626LDFLAGS			+= -m $(ld-emul)
627
628ifdef CONFIG_MIPS
629CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \
630	egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
631	sed -e 's/^\#define /-D/' -e "s/ /='/" -e "s/$$/'/")
632ifdef CONFIG_64BIT
633CHECKFLAGS		+= -m64
634endif
635endif
636
637OBJCOPYFLAGS		+= --remove-section=.reginfo
638
639#
640# Choosing incompatible machines durings configuration will result in
641# error messages during linking.  Select a default linkscript if
642# none has been choosen above.
643#
644
645CPPFLAGS_vmlinux.lds := \
646	$(CFLAGS) \
647	-D"LOADADDR=$(load-y)" \
648	-D"JIFFIES=$(JIFFIES)" \
649	-D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
650
651head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
652
653libs-y			+= arch/mips/lib/
654libs-$(CONFIG_32BIT)	+= arch/mips/lib-32/
655libs-$(CONFIG_64BIT)	+= arch/mips/lib-64/
656
657core-y			+= arch/mips/kernel/ arch/mips/mm/ arch/mips/math-emu/
658
659drivers-$(CONFIG_OPROFILE)	+= arch/mips/oprofile/
660
661ifdef CONFIG_LASAT
662rom.bin rom.sw: vmlinux
663	$(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
664endif
665
666#
667# Some machines like the Indy need 32-bit ELF binaries for booting purposes.
668# Other need ECOFF, so we build a 32-bit ELF binary for them which we then
669# convert to ECOFF using elf2ecoff.
670#
671vmlinux.32: vmlinux
672	$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
673
674#
675# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
676# ELF files from 32-bit files by conversion.
677#
678vmlinux.64: vmlinux
679	$(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
680
681makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
682
683ifdef CONFIG_BOOT_ELF32
684all:	$(vmlinux-32)
685endif
686
687ifdef CONFIG_BOOT_ELF64
688all:	$(vmlinux-64)
689endif
690
691ifdef CONFIG_MIPS_ATLAS
692all:	vmlinux.srec
693endif
694
695ifdef CONFIG_MIPS_MALTA
696all:	vmlinux.srec
697endif
698
699ifdef CONFIG_MIPS_SEAD
700all:	vmlinux.srec
701endif
702
703ifdef CONFIG_QEMU
704all:	vmlinux.bin
705endif
706
707ifdef CONFIG_SNI_RM
708all:	vmlinux.ecoff
709endif
710
711vmlinux.bin: $(vmlinux-32)
712	+@$(call makeboot,$@)
713
714vmlinux.ecoff: $(vmlinux-32)
715	+@$(call makeboot,$@)
716
717vmlinux.srec: $(vmlinux-32)
718	+@$(call makeboot,$@)
719
720CLEAN_FILES += vmlinux.ecoff \
721	       vmlinux.srec
722
723archprepare:
724ifdef CONFIG_MIPS32_N32
725	@echo '  Checking missing-syscalls for N32'
726	$(Q)$(MAKE) $(build)=. missing-syscalls EXTRA_CFLAGS="-mabi=n32"
727endif
728ifdef CONFIG_MIPS32_O32
729	@echo '  Checking missing-syscalls for O32'
730	$(Q)$(MAKE) $(build)=. missing-syscalls EXTRA_CFLAGS="-mabi=32"
731endif
732
733archclean:
734	@$(MAKE) $(clean)=arch/mips/boot
735	@$(MAKE) $(clean)=arch/mips/lasat
736
737CLEAN_FILES += vmlinux.32 \
738	       vmlinux.64 \
739	       vmlinux.ecoff
740