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
6 # Copyright (C) 2002 Maciej W. Rozycki
8 # This file is included by the global makefile so that you can add your own
9 # architecture-specific flags and dependencies. Remember to do have actions
10 # for "archclean" cleaning up for this architecture.
14 # Select the object file format to substitute into the linker script.
16 ifdef CONFIG_CPU_LITTLE_ENDIAN
17 tool-prefix
= mips64el-linux-
18 32bit-bfd
= elf32-tradlittlemips
19 64bit-bfd
= elf64-tradlittlemips
21 tool-prefix
= mips64-linux-
22 32bit-bfd
= elf32-tradbigmips
23 64bit-bfd
= elf64-tradbigmips
26 ifdef CONFIG_CROSSCOMPILE
27 CROSS_COMPILE
= $(tool-prefix
)
31 # The ELF GCC uses -G 0 -mabicalls -fpic as default. We don't need PIC
32 # code in the kernel since it only slows down the whole thing. For the
33 # old GCC these options are just the defaults. At some point we might
34 # make use of global pointer optimizations.
36 # The DECStation requires an ECOFF kernel for remote booting, other MIPS
37 # machines may also. Since BFD is incredibly buggy with respect to
38 # crossformat linking we rely on the elf2ecoff tool for format conversion.
40 cflags-y
:= -I
$(TOPDIR
)/include/asm
/gcc
41 cflags-y
+= -mabi
=64 -G
0 -mno-abicalls
-fno-pic
-Wa
,--trap
-pipe
42 LDFLAGS_vmlinux
+= -G
0 -static
# -N
43 MODFLAGS
+= -mlong-calls
45 cflags-
$(CONFIG_KGDB
) += -g
46 cflags-
$(CONFIG_SB1XXX_CORELIS
) += -mno-sched-prolog
-fno-omit-frame-pointer
48 check_gcc
= $(shell if
$(AS
) $(1) -o
/dev
/null
-xc
/dev
/null
> /dev
/null
2>&1; then echo
"$(1)"; else echo
"$(2)"; fi
)
49 check_warning
= $(shell if
$(CC
) $(1) -c
-o
/dev
/null
-xc
/dev
/null
> /dev
/null
2>&1; then echo
"$(1)"; else echo
"$(2)"; fi
)
52 # CPU-dependent compiler/assembler options for optimization.
54 cflags-
$(CONFIG_CPU_R4300
) += -mcpu
=r4300
-mips3
55 cflags-
$(CONFIG_CPU_R4X00
) += -mcpu
=r4600
-mips3
56 cflags-
$(CONFIG_CPU_R5000
) += -mcpu
=r8000
-mips4
57 cflags-
$(CONFIG_CPU_NEVADA
) += -mcpu
=r8000
-mips3
-mmad
58 cflags-
$(CONFIG_CPU_RM7000
) += $(call check_gcc
, -mcpu
=r7000
, -mcpu
=r5000
) \
60 cflags-
$(CONFIG_CPU_SB1
) += $(call check_gcc
, -mcpu
=sb1
, -mcpu
=r8000
) \
61 $(call check_gcc
, -mips64
, -mips4
)
62 cflags-
$(CONFIG_CPU_R8000
) += -mcpu
=r8000
-mips4
63 cflags-
$(CONFIG_CPU_R10000
) += -mcpu
=r8000
-mips4
65 ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
66 MODFLAGS
+= -msb1-pass1-workarounds
69 # Should be used then we get a MIPS64 compiler
70 #cflags-$(CONFIG_CPU_MIPS64) += -mips64
71 cflags-
$(CONFIG_CPU_MIPS64
) += -mcpu
=r8000
-mips4
74 # ramdisk/initrd support
75 # You need a compressed ramdisk image, named ramdisk.gz in
78 ifdef CONFIG_EMBEDDED_RAMDISK
79 CORE_FILES
+= arch
/mips
/ramdisk
/ramdisk.o
80 SUBDIRS
+= arch
/mips
/ramdisk
86 libs-
$(CONFIG_ARC
) += arch
/mips
/arc
/
87 libs-
$(CONFIG_SIBYTE_CFE
) += arch
/mips
/sibyte
/cfe
/
90 # Board-dependent options and extra files
96 ifdef CONFIG_DECSTATION
97 CORE_FILES
+= arch
/mips
/dec
/dec.o
98 SUBDIRS
+= arch
/mips
/dec arch
/mips
/dec
/prom
99 LIBS
+= arch
/mips
/dec
/prom
/rexlib.a
100 LOADADDR
:= 0x80040000
106 core-
$(CONFIG_MIPS_BOARDS_GEN
) += arch
/mips
/mips-boards
/generic
/
107 core-
$(CONFIG_MIPS_ATLAS
) += arch
/mips
/mips-boards
/atlas
/
108 load-
$(CONFIG_MIPS_ATLAS
) += 0x80100000
113 core-
$(CONFIG_MIPS_MALTA
) += arch
/mips
/mips-boards
/malta
/
114 load-
$(CONFIG_MIPS_MALTA
) += 0x80100000
119 core-
$(CONFIG_MIPS_SEAD
) += arch
/mips
/mips-boards
/sead
/
120 load-
$(CONFIG_MIPS_SEAD
) += 0x80100000
123 # Momentum Ocelot board
125 # The Ocelot setup.o must be linked early - it does the ioremap() for the
128 core-
$(CONFIG_MOMENCO_OCELOT
) += arch
/mips
/gt64120
/common
/ \
129 arch
/mips
/gt64120
/momenco_ocelot
/
130 load-
$(CONFIG_MOMENCO_OCELOT
) += 0x80100000
133 # Momentum Ocelot-G board
135 # The Ocelot-G setup.o must be linked early - it does the ioremap() for the
138 core-
$(CONFIG_MOMENCO_OCELOT_G
) += arch
/mips
/momentum
/ocelot_g
/
139 load-
$(CONFIG_MOMENCO_OCELOT_G
) += 0x80100000
142 # Momentum Ocelot-C and -CS boards
144 # The Ocelot-C[S] setup.o must be linked early - it does the ioremap() for the
146 core-
$(CONFIG_MOMENCO_OCELOT_C
) += arch
/mips
/momentum
/ocelot_c
/
147 load-
$(CONFIG_MOMENCO_OCELOT_C
) += 0x80100000
150 # SGI IP22 (Indy/Indigo2)
152 # Set the load address to >= 0x88069000 if you want to leave space for symmon,
153 # 0x88004000 for production kernels. Note that the value must be 16kb aligned
154 # or the handling of the current variable will break.
156 core-
$(CONFIG_SGI_IP22
) += arch
/mips
/sgi-ip22
/
157 load-
$(CONFIG_SGI_IP22
) += 0x88004000
160 # SGI-IP27 (Origin200/2000)
162 # Set the load address to >= 0xc000000000300000 if you want to leave space for
163 # symmon, 0xc00000000001c000 for production kernels. Note that the value
164 # must be 16kb aligned or the handling of the current variable will break.
166 ifdef CONFIG_SGI_IP27
167 core-
$(CONFIG_SGI_IP27
) += arch
/mips
/sgi-ip27
/
168 #load-$(CONFIG_SGI_IP27) += 0xa80000000001c000
169 ifdef CONFIG_MAPPED_KERNEL
170 load-
$(CONFIG_SGI_IP27
) += 0xc001c000
172 load-
$(CONFIG_SGI_IP27
) += 0x8001c000
179 # Set the load address to >= 0x????????? if you want to leave space for symmon,
180 # 0x80002000 for production kernels. Note that the value must be 16kb aligned
181 # or the handling of the current variable will break.
183 core-
$(CONFIG_SGI_IP32
) += arch
/mips
/sgi-ip32
/
184 load-
$(CONFIG_SGI_IP32
) += 0x80002000
189 # This is a LIB so that it links at the end, and initcalls are later
190 # the sequence; but it is built as an object so that modules don't get
191 # removed (as happens, even if they have __initcall/module_init)
193 core-
$(CONFIG_SIBYTE_SB1250
) += arch
/mips
/sibyte
/sb1250
/
194 ifdef CONFIG_SIBYTE_BCM112X
195 ifdef CONFIG_MIPS_UNCACHED
201 ifdef CONFIG_SIBYTE_SB1250
202 ifdef CONFIG_MIPS_UNCACHED
210 # Sibyte BCM91120x (Carmel) board
211 # Sibyte BCM91120C (CRhine) board
212 # Sibyte BCM91125C (CRhone) board
213 # Sibyte BCM91125E (Rhone) board
216 libs-
$(CONFIG_SIBYTE_CARMEL
) += arch
/mips
/sibyte
/swarm
/
217 load-
$(CONFIG_SIBYTE_CARMEL
) := 0x80100000
218 libs-
$(CONFIG_SIBYTE_CRHINE
) += arch
/mips
/sibyte
/swarm
/
219 load-
$(CONFIG_SIBYTE_CRHINE
) := 0x80100000
220 libs-
$(CONFIG_SIBYTE_CRHONE
) += arch
/mips
/sibyte
/swarm
/
221 load-
$(CONFIG_SIBYTE_CRHONE
) := 0x80100000
222 libs-
$(CONFIG_SIBYTE_RHONE
) += arch
/mips
/sibyte
/swarm
/
223 load-
$(CONFIG_SIBYTE_RHONE
) := 0x80100000
224 libs-
$(CONFIG_SIBYTE_SENTOSA
) += arch
/mips
/sibyte
/swarm
/
225 load-
$(CONFIG_SIBYTE_SENTOSA
) := 0x80100000
226 libs-
$(CONFIG_SIBYTE_SWARM
) += arch
/mips
/sibyte
/swarm
/
227 load-
$(CONFIG_SIBYTE_SWARM
) := 0x80100000
232 core-
$(CONFIG_SNI_RM200_PCI
) += arch
/mips
/sni
/
233 load-
$(CONFIG_SNI_RM200_PCI
) += 0x80080000
235 drivers-
$(CONFIG_PCI
) += arch
/mips
/pci
/
238 # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
239 # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
240 # convert to ECOFF using elf2ecoff.
242 # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
243 # ELF files from 32-bit files by conversion.
246 #LDFLAGS += -m elf64bmip
247 cflags-
$(CONFIG_BOOT_ELF32
) += -Wa
,-32
248 cflags-
$(CONFIG_BOOT_ELF64
) += -Wa
,-32
251 cflags-
$(CONFIG_BOOT_ELF32
) += -Wa
,-32 $(call check_warning
, $(GRRR
),)
252 cflags-
$(CONFIG_BOOT_ELF64
) += -Wa
,-32 $(call check_warning
, $(GRRR
),)
254 AFLAGS_vmlinux.lds.o
:= -imacros
$(srctree
)/include/asm-mips64
/sn
/mapped_kernel.h \
255 -D
"LOADADDR=$(load-y)"
257 AFLAGS
+= $(cflags-y
)
258 CFLAGS
+= $(cflags-y
)
260 LDFLAGS
+= --oformat
$(32bit-bfd
)
261 LDFLAGS_BLOB
:= --format binary
--oformat
$(64bit-bfd
)
263 head-y
:= arch
/mips64
/kernel
/head.o arch
/mips64
/kernel
/init_task.o
265 libs-y
+= arch
/mips64
/lib
/
266 core-y
+= arch
/mips64
/kernel
/ arch
/mips64
/mm
/ arch
/mips
/math-emu
/
268 MAKEBOOT
= $(MAKE
) -C arch
/$(ARCH
)/boot
270 ifdef CONFIG_MAPPED_KERNEL
272 $(OBJCOPY
) -O
$(64bit-bfd
) --change-addresses
=0xbfffffff40000000 $< $@
275 $(OBJCOPY
) -O
$(64bit-bfd
) --change-addresses
=0xa7ffffff80000000 $< $@
278 makeboot
=$(Q
)$(MAKE
) -f scripts
/Makefile.build obj
=arch
/mips
/boot
$(1)
281 # SNI firmware is f*cked in interesting ways ...
283 ifdef CONFIG_SNI_RM200_PCI
287 vmlinux.ecoff vmlinux.rm200
: vmlinux
288 +@
$(call makeboot
,$@
)
290 CLEAN_FILES
+= vmlinux.ecoff \
295 @
$(MAKE
) -f scripts
/Makefile.
clean obj
=arch
/mips
/boot
296 @
$(MAKE
) -f scripts
/Makefile.
clean obj
=arch
/mips
/baget
297 @
$(MAKE
) -f scripts
/Makefile.
clean obj
=arch
/mips
/lasat
300 @
$(MAKEBOOT
) mrproper
302 # Generate <asm/offset.h
304 # The default rule is suffering from funny problems on MIPS so we using our
307 # ---------------------------------------------------------------------------
309 define filechk_gen-asm-offset.h
311 echo
"#ifndef __ASM_OFFSET_H"; \
312 echo
"#define __ASM_OFFSET_H"; \
314 echo
" * DO NOT MODIFY."; \
316 echo
" * This file was generated by arch/$(ARCH)/Makefile"; \
320 sed
-ne
"/^@@@/s///p"; \
321 echo
"#endif /* __ASM_OFFSET_H */" )
324 prepare
: include/asm-
$(ARCH
)/offset.h
326 arch
/$(ARCH
)/kernel
/offset.s
: include/asm
include/linux
/version.h \
327 include/config
/MARKER
329 include/asm-
$(ARCH
)/offset.h
: arch
/$(ARCH
)/kernel
/offset.s
330 $(call filechk
,gen-asm-offset.h
)
332 CLEAN_FILES
+= include/asm-
$(ARCH
)/offset.h.tmp \
333 include/asm-
$(ARCH
)/offset.h