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" and "archdep" for cleaning up and making dependencies for
15 # Select the object file format to substitute into the linker script.
17 ifdef CONFIG_CPU_LITTLE_ENDIAN
18 tool-prefix = mips64el-linux-
20 tool-prefix = mips64-linux-
23 ifdef CONFIG_CROSSCOMPILE
24 CROSS_COMPILE = $(tool-prefix)
28 # The ELF GCC uses -G 0 -mabicalls -fpic as default. We don't need PIC
29 # code in the kernel since it only slows down the whole thing. For the
30 # old GCC these options are just the defaults. At some point we might
31 # make use of global pointer optimizations.
33 # The DECStation requires an ECOFF kernel for remote booting, other MIPS
34 # machines may also. Since BFD is incredibly buggy with respect to
35 # crossformat linking we rely on the elf2ecoff tool for format conversion.
37 GCCFLAGS := -I $(TOPDIR)/include/asm/gcc
38 GCCFLAGS += -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
39 LINKFLAGS += -G 0 -static # -N
40 MODFLAGS += -mlong-calls
42 ifdef CONFIG_REMOTE_DEBUG
47 # CPU-dependent compiler/assembler options for optimization.
49 ifdef CONFIG_CPU_R4300
50 GCCFLAGS += -mcpu=r4300 -mips3
52 ifdef CONFIG_CPU_R4X00
53 GCCFLAGS += -mcpu=r4600 -mips3
55 ifdef CONFIG_CPU_R5000
56 GCCFLAGS += -mcpu=r8000 -mips4
58 ifdef CONFIG_CPU_NEVADA
59 GCCFLAGS += -mcpu=r8000 -mips3 -mmad
61 ifdef CONFIG_CPU_R8000
62 GCCFLAGS += -mcpu=r8000 -mips4
64 ifdef CONFIG_CPU_R10000
65 GCCFLAGS += -mcpu=r8000 -mips4
68 GCCFLAGS += -mcpu=r8000 -mips4
70 ifdef CONFIG_CPU_MIPS64
71 #CFLAGS += -mips64 # Should be used then we get a MIPS64 compiler
72 CFLAGS += -mcpu=r8000 -mips4
76 # We unconditionally build the math emulator
78 CORE_FILES += arch/mips/math-emu/fpu_emulator.o
79 SUBDIRS += arch/mips/math-emu
83 # Board-dependent options and extra files
89 ifdef CONFIG_MIPS_ATLAS
90 LIBS += arch/mips/mips-boards/atlas/atlas.o \
91 arch/mips/mips-boards/generic/mipsboards.o
92 SUBDIRS += arch/mips/mips-boards/generic arch/mips/mips-boards/atlas
93 LOADADDR := 0x80100000
99 ifdef CONFIG_MIPS_MALTA
100 LIBS += arch/mips/mips-boards/malta/malta.o \
101 arch/mips/mips-boards/generic/mipsboards.o
102 SUBDIRS += arch/mips/mips-boards/malta arch/mips/mips-boards/generic
103 LOADADDR := 0x80100000
109 ifdef CONFIG_MIPS_SEAD
110 LIBS += arch/mips/mips-boards/sead/sead.o \
111 arch/mips/mips-boards/generic/mipsboards.o
112 SUBDIRS += arch/mips/mips-boards/generic arch/mips/mips-boards/sead
113 LOADADDR := 0x80100000
117 # SGI IP22 (Indy/Indigo2)
119 ifdef CONFIG_SGI_IP22
120 CORE_FILES += arch/mips/sgi-ip22/ip22-kern.o
121 LIBS += arch/mips/arc/arclib.a
122 SUBDIRS += arch/mips/sgi-ip22 arch/mips/arc
124 # Set LOADADDR to >= 0x88069000 if you want to leave space for symmon,
125 # 0x88004000 for production kernels. Note that the value must be
126 # 16kb aligned or the handling of the current variable will break.
128 LOADADDR := 0x88004000
132 # SGI-IP27 (Origin200/2000)
134 ifdef CONFIG_SGI_IP27
135 CORE_FILES += arch/mips/sgi-ip27/ip27.o
136 LIBS += arch/mips/arc/arclib.a
137 SUBDIRS += arch/mips/sgi-ip27 arch/mips/arc
139 # Set LOADADDR to >= 0xc000000000300000 if you want to leave space for
140 # symmon, 0xc00000000001c000 for production kernels. Note that the value
141 # must be 16kb aligned or the handling of the current variable will break.
143 #LOADADDR := 0xa80000000001c000
144 ifdef CONFIG_MAPPED_KERNEL
145 LOADADDR := 0xc001c000
147 LOADADDR := 0x8001c000
154 ifdef CONFIG_SGI_IP32
155 CORE_FILES += arch/mips/sgi-ip32/ip32-kern.a
156 LIBS += arch/mips/arc/arclib.a
157 SUBDIRS += arch/mips/sgi-ip32 arch/mips/arc
159 # Set LOADADDR to >= 0x????????? if you want to leave space for symmon,
160 # 0x80002000 for production kernels. Note that the value must be
161 # 16kb aligned or the handling of the current variable will break.
163 LOADADDR := 0x80002000
169 ifdef CONFIG_SIBYTE_SB1250
170 # This is a LIB so that it links at the end, and initcalls are later
171 # the sequence; but it is built as an object so that modules don't get
172 # removed (as happens, even if they have __initcall/module_init)
173 LIBS += arch/mips/sibyte/sb1250/sb1250.o
174 SUBDIRS += arch/mips/sibyte/sb1250
180 ifdef CONFIG_SIBYTE_SWARM
181 LIBS += arch/mips/sibyte/swarm/sbswarm.a
182 SUBDIRS += arch/mips/sibyte/swarm
183 LOADADDR := 0x80100000
187 # Sibyte CFE firmware
189 ifdef CONFIG_SIBYTE_CFE
190 LIBS += arch/mips/sibyte/cfe/cfe.a
191 SUBDIRS += arch/mips/sibyte/cfe
195 # SB1 Cache Error handler
197 ifdef CONFIG_SB1_CACHE_ERROR
198 LIBS += arch/mips/sibyte/sb1/sb1kern.a
199 SUBDIRS += arch/mips/sibyte/sb1
204 # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
205 # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
206 # convert to ECOFF using elf2ecoff.
208 ifdef CONFIG_BOOT_ELF32
210 LINKFLAGS += -T arch/mips64/ld.script.elf32
213 # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
214 # ELF files from 32-bit files by conversion.
216 ifdef CONFIG_BOOT_ELF64
218 LINKFLAGS += -T arch/mips64/ld.script.elf32
221 #LINKFLAGS += -T arch/mips64/ld.script.elf64
225 AFLAGS += $(GCCFLAGS)
226 CFLAGS += $(GCCFLAGS)
229 LINKFLAGS += -Ttext $(LOADADDR)
231 HEAD := arch/mips64/kernel/head.o arch/mips64/kernel/init_task.o
233 SUBDIRS := $(addprefix arch/mips/, tools) $(SUBDIRS) $(addprefix arch/mips64/, kernel mm lib)
234 CORE_FILES := arch/mips64/kernel/kernel.o arch/mips64/mm/mm.o $(CORE_FILES)
235 LIBS := arch/mips64/lib/lib.a $(LIBS)
237 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
239 ifdef CONFIG_CPU_LITTLE_ENDIAN
240 64bit-bfd = elf64-littlemips
242 64bit-bfd = elf64-bigmips
245 vmlinux: arch/mips64/ld.script.elf32
246 arch/mips64/ld.script.elf32: arch/mips64/ld.script.elf32.S
247 $(CPP) -C -P -I$(HPATH) -imacros $(HPATH)/asm-mips64/sn/mapped_kernel.h -Umips arch/mips64/ld.script.elf32.S > arch/mips64/ld.script.elf32
249 ifdef CONFIG_MAPPED_KERNEL
251 $(OBJCOPY) -O $(64bit-bfd) --change-addresses=0xbfffffff40000000 $< $@
254 $(OBJCOPY) -O $(64bit-bfd) --change-addresses=0xa7ffffff80000000 $< $@
267 $(MAKE) -C arch/mips/tools clean
268 rm -f vmlinux.64 arch/$(ARCH)/ld.script.elf32
271 @$(MAKEBOOT) mrproper
272 $(MAKE) -C arch/mips/tools mrproper
275 if [ ! -f $(TOPDIR)/include/asm-$(ARCH)/offset.h ]; then \
276 touch $(TOPDIR)/include/asm-$(ARCH)/offset.h; \