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, 1995, 1996 by Ralf Baechle 7# DECStation modifications by Paul M. Antoine, 1996 8# Copyright (C) 2002 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" and "archdep" for cleaning up and making dependencies for 13# this architecture 14# 15 16# 17# Select the object file format to substitute into the linker script. 18# 19ifdef CONFIG_CPU_LITTLE_ENDIAN 20tool-prefix = mipsel-linux- 21else 22tool-prefix = mips-linux- 23endif 24 25ifdef CONFIG_CROSSCOMPILE 26CROSS_COMPILE = $(tool-prefix) 27endif 28 29# 30# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 31# code since it only slows down the whole thing. At some point we might make 32# use of global pointer optimizations but their use of $28 conflicts with 33# the current pointer optimization. 34# 35# The DECStation requires an ECOFF kernel for remote booting, other MIPS 36# machines may also. Since BFD is incredibly buggy with respect to 37# crossformat linking we rely on the elf2ecoff tool for format conversion. 38# 39GCCFLAGS := -I $(TOPDIR)/include/asm/gcc 40GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe 41LINKFLAGS += -G 0 -static # -N 42MODFLAGS += -mlong-calls -fno-common 43 44ifdef CONFIG_DEBUG 45GCCFLAGS += -gstabs+ 46ifdef CONFIG_SB1XXX_CORELIS 47GCCFLAGS += -mno-sched-prolog -fno-omit-frame-pointer 48endif 49endif 50 51check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) 52 53# 54# CPU-dependent compiler/assembler options for optimization. 55# 56ifdef CONFIG_CPU_R3000 57GCCFLAGS += -mcpu=r3000 -mips1 58endif 59ifdef CONFIG_CPU_TX39XX 60GCCFLAGS += -mcpu=r3000 -mips1 61endif 62ifdef CONFIG_CPU_R6000 63GCCFLAGS += -mcpu=r6000 -mips2 -Wa,--trap 64endif 65ifdef CONFIG_CPU_R4300 66GCCFLAGS += -mcpu=r4300 -mips2 -Wa,--trap 67endif 68ifdef CONFIG_CPU_VR41XX 69GCCFLAGS += -mcpu=r4600 -mips2 -Wa,--trap 70endif 71ifdef CONFIG_CPU_R4X00 72GCCFLAGS += -mcpu=r4600 -mips2 -Wa,--trap 73endif 74ifdef CONFIG_CPU_TX49XX 75GCCFLAGS += -mcpu=r4600 -mips2 -Wa,--trap 76endif 77ifdef CONFIG_CPU_MIPS32 78GCCFLAGS += -mcpu=r4600 -mips2 -Wa,--trap 79endif 80ifdef CONFIG_CPU_MIPS64 81GCCFLAGS += -mcpu=r4600 -mips2 -Wa,--trap 82endif 83ifdef CONFIG_CPU_R5000 84GCCFLAGS += -mcpu=r5000 -mips2 -Wa,--trap 85endif 86ifdef CONFIG_CPU_R5432 87GCCFLAGS += -mcpu=r5000 -mips2 -Wa,--trap 88endif 89ifdef CONFIG_CPU_NEVADA 90# Cannot use -mmad with currently recommended tools 91GCCFLAGS += -mcpu=r5000 -mips2 -Wa,--trap 92endif 93ifdef CONFIG_CPU_RM7000 94GCCFLAGS += -mcpu=r5000 -mips2 -Wa,--trap 95endif 96ifdef CONFIG_CPU_SB1 97GCCFLAGS += $(call check_gcc, -mcpu=-sb1, -mcpu=r5000) \ 98 -mips2 -Wa,--trap 99ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 100MODFLAGS += -msb1-pass1-workarounds 101endif 102endif 103GCCFLAGS += $(call check_gcc, -m4710a0kern, ) 104 105AFLAGS += $(GCCFLAGS) 106ASFLAGS += $(GCCFLAGS) 107CFLAGS += $(GCCFLAGS) 108 109 110# 111# We unconditionally build the math emulator 112# 113CORE_FILES += arch/mips/math-emu/fpu_emulator.o 114SUBDIRS += arch/mips/math-emu 115 116# 117# ramdisk/initrd support 118# You need a compressed ramdisk image, named ramdisk.gz in 119# arch/mips/ramdisk 120# 121ifdef CONFIG_EMBEDDED_RAMDISK 122CORE_FILES += arch/mips/ramdisk/ramdisk.o 123SUBDIRS += arch/mips/ramdisk 124endif 125 126 127# 128# Board-dependent options and extra files 129# 130 131# 132# Acer PICA 61, Mips Magnum 4000 and Olivetti M700. 133# 134ifdef CONFIG_MIPS_JAZZ 135CORE_FILES += arch/mips/jazz/jazz.o 136SUBDIRS += arch/mips/jazz arch/mips/arc 137LIBS += arch/mips/arc/arclib.a 138LOADADDR := 0x80080000 139endif 140 141# 142# Au1000 (Alchemy Semi PB1000) eval board 143# 144ifdef CONFIG_MIPS_PB1000 145LIBS += arch/mips/au1000/pb1000/pb1000.o \ 146 arch/mips/au1000/common/au1000.o 147SUBDIRS += arch/mips/au1000/pb1000 arch/mips/au1000/common 148LOADADDR := 0x80100000 149endif 150 151# 152# Au1100 (Alchemy Semi PB1100) eval board 153# 154ifdef CONFIG_MIPS_PB1100 155LIBS += arch/mips/au1000/pb1100/pb1100.o \ 156 arch/mips/au1000/common/au1000.o 157SUBDIRS += arch/mips/au1000/pb1100 arch/mips/au1000/common 158LOADADDR += 0x80100000 159endif 160 161# 162# Au1500 (Alchemy Semi PB1500) eval board 163# 164ifdef CONFIG_MIPS_PB1500 165LIBS += arch/mips/au1000/pb1500/pb1500.o \ 166 arch/mips/au1000/common/au1000.o 167SUBDIRS += arch/mips/au1000/pb1500 arch/mips/au1000/common 168LOADADDR := 0x80100000 169endif 170 171# 172# Au1x00 (AMD/Alchemy) eval boards 173# 174ifdef CONFIG_MIPS_DB1000 175LIBS += arch/mips/au1000/db1x00/db1x00.o \ 176 arch/mips/au1000/common/au1000.o 177SUBDIRS += arch/mips/au1000/db1x00 arch/mips/au1000/common 178LOADADDR += 0x80100000 179endif 180 181ifdef CONFIG_MIPS_DB1500 182LIBS += arch/mips/au1000/db1x00/db1x00.o \ 183 arch/mips/au1000/common/au1000.o 184SUBDIRS += arch/mips/au1000/db1x00 arch/mips/au1000/common 185LOADADDR += 0x80100000 186endif 187 188ifdef CONFIG_MIPS_DB1100 189LIBS += arch/mips/au1000/db1x00/db1x00.o \ 190 arch/mips/au1000/common/au1000.o 191SUBDIRS += arch/mips/au1000/db1x00 arch/mips/au1000/common 192LOADADDR += 0x80100000 193endif 194 195# 196# Algorithmics P4032 197# 198ifdef CONFIG_ALGOR_P4032 199CORE_FILES += arch/mips/algor/algor.o 200SUBDIRS += arch/mips/algor 201LOADADDR := 0x80000000 202endif 203 204# 205# Baget/MIPS 206# 207ifdef CONFIG_BAGET_MIPS 208SUBDIRS += arch/mips/baget arch/mips/baget/prom 209LIBS += arch/mips/baget/baget.a arch/mips/baget/prom/bagetlib.a 210LOADADDR := 0x80001000 211endif 212 213# 214# Cobalt Server 215# 216ifdef CONFIG_MIPS_COBALT 217SUBDIRS += arch/mips/cobalt 218CORE_FILES += arch/mips/cobalt/cobalt.o 219LOADADDR := 0x80080000 220endif 221 222# 223# DECstation family 224# 225ifdef CONFIG_DECSTATION 226CORE_FILES += arch/mips/dec/dec.o 227SUBDIRS += arch/mips/dec arch/mips/dec/prom 228LIBS += arch/mips/dec/prom/rexlib.a 229LOADADDR := 0x80040000 230endif 231 232# 233# Galileo EV64120 Board 234# 235ifdef CONFIG_MIPS_EV64120 236LIBS += arch/mips/galileo-boards/ev64120/ev64120.o 237SUBDIRS += arch/mips/galileo-boards/ev64120 238LOADADDR := 0x80100000 239endif 240 241# 242# Galileo EV96100 Board 243# 244ifdef CONFIG_MIPS_EV96100 245LIBS += arch/mips/galileo-boards/ev96100/ev96100.o \ 246 arch/mips/galileo-boards/generic/galboards.o 247SUBDIRS += arch/mips/galileo-boards/generic \ 248 arch/mips/galileo-boards/ev96100 249LOADADDR := 0x80100000 250endif 251 252# 253# Globespan IVR eval board with QED 5231 CPU 254# 255ifdef CONFIG_MIPS_IVR 256LIBS += arch/mips/ite-boards/ivr/ivr.o \ 257 arch/mips/ite-boards/generic/it8172.o 258SUBDIRS += arch/mips/ite-boards/generic arch/mips/ite-boards/ivr 259LOADADDR := 0x80100000 260endif 261 262# 263# HP LaserJet 264# 265ifdef CONFIG_HP_LASERJET 266SUBDIRS += arch/mips/hp-lj 267LIBS += arch/mips/hp-lj/hp-lj.o 268LOADADDR := 0x80030000 269endif 270 271# 272# ITE 8172 eval board with QED 5231 CPU 273# 274ifdef CONFIG_MIPS_ITE8172 275LIBS += arch/mips/ite-boards/qed-4n-s01b/ite.o \ 276 arch/mips/ite-boards/generic/it8172.o 277SUBDIRS += arch/mips/ite-boards/generic arch/mips/ite-boards/qed-4n-s01b 278LOADADDR := 0x80100000 279endif 280 281# 282# MIPS Atlas board 283# 284ifdef CONFIG_MIPS_ATLAS 285LIBS += arch/mips/mips-boards/atlas/atlas.o \ 286 arch/mips/mips-boards/generic/mipsboards.o 287SUBDIRS += arch/mips/mips-boards/generic arch/mips/mips-boards/atlas 288LOADADDR := 0x80100000 289endif 290 291# 292# MIPS Malta board 293# 294ifdef CONFIG_MIPS_MALTA 295LIBS += arch/mips/mips-boards/malta/malta.o \ 296 arch/mips/mips-boards/generic/mipsboards.o 297SUBDIRS += arch/mips/mips-boards/malta arch/mips/mips-boards/generic 298LOADADDR := 0x80100000 299endif 300 301# 302# MIPS SEAD board 303# 304ifdef CONFIG_MIPS_SEAD 305LIBS += arch/mips/mips-boards/sead/sead.o \ 306 arch/mips/mips-boards/generic/mipsboards.o 307SUBDIRS += arch/mips/mips-boards/generic arch/mips/mips-boards/sead 308LOADADDR := 0x80100000 309endif 310 311# 312# Momentum Ocelot board 313# 314ifdef CONFIG_MOMENCO_OCELOT 315# The Ocelot setup.o must be linked early - it does the ioremap() for the 316# mips_io_port_base. 317CORE_FILES += arch/mips/gt64120/common/gt64120.o \ 318 arch/mips/gt64120/momenco_ocelot/momenco_ocelot.o 319SUBDIRS += arch/mips/gt64120/common arch/mips/gt64120/momenco_ocelot 320LOADADDR := 0x80100000 321endif 322 323# 324# Momentum Ocelot-G board 325# 326ifdef CONFIG_MOMENCO_OCELOT_G 327# The Ocelot-G setup.o must be linked early - it does the ioremap() for the 328# mips_io_port_base. 329CORE_FILES += arch/mips/momentum/ocelot_g/ocelot_g.o 330SUBDIRS += arch/mips/momentum/ocelot_g 331LOADADDR := 0x80100000 332endif 333 334# 335# NEC DDB Vrc-5074 336# 337ifdef CONFIG_DDB5074 338SUBDIRS += arch/mips/ddb5xxx/common arch/mips/ddb5xxx/ddb5074 339LIBS += arch/mips/ddb5xxx/common/ddb5xxx.o arch/mips/ddb5xxx/ddb5074/ddb5074.o 340LOADADDR := 0x80080000 341endif 342 343# 344# NEC DDB Vrc-5476 345# 346ifdef CONFIG_DDB5476 347SUBDIRS += arch/mips/ddb5xxx/common arch/mips/ddb5xxx/ddb5476 348LIBS += arch/mips/ddb5xxx/common/ddb5xxx.o \ 349 arch/mips/ddb5xxx/ddb5476/ddb5476.o 350LOADADDR := 0x80080000 351endif 352 353# 354# NEC DDB Vrc-5477 355# 356ifdef CONFIG_DDB5477 357SUBDIRS += arch/mips/ddb5xxx/common arch/mips/ddb5xxx/ddb5477 358LIBS += arch/mips/ddb5xxx/common/ddb5xxx.o \ 359 arch/mips/ddb5xxx/ddb5477/ddb5477.o 360LOADADDR := 0x80100000 361endif 362 363ifdef CONFIG_LASAT 364LIBS += arch/mips/lasat/lasatkern.o 365SUBDIRS += arch/mips/lasat 366LOADADDR += 0x80000000 367endif 368# 369# NEC Osprey (vr4181) board 370# 371ifdef CONFIG_NEC_OSPREY 372SUBDIRS += arch/mips/vr4181/common arch/mips/vr4181/osprey 373LIBS += arch/mips/vr4181/common/vr4181.o \ 374 arch/mips/vr4181/osprey/osprey.o 375LOADADDR := 0x80002000 376endif 377 378# 379# NEC Eagle/Hawk (VR4122/VR4131) board 380# 381ifdef CONFIG_NEC_EAGLE 382SUBDIRS += arch/mips/vr41xx/common \ 383 arch/mips/vr41xx/nec-eagle 384LIBS += arch/mips/vr41xx/common/vr41xx.o \ 385 arch/mips/vr41xx/nec-eagle/eagle.o 386LOADADDR := 0x80000000 387endif 388 389# 390# ZAO Networks Capcella (VR4131) 391# 392ifdef CONFIG_ZAO_CAPCELLA 393SUBDIRS += arch/mips/vr41xx/common \ 394 arch/mips/vr41xx/zao-capcella 395LIBS += arch/mips/vr41xx/common/vr41xx.o \ 396 arch/mips/vr41xx/zao-capcella/capcella.o 397LOADADDR := 0x80000000 398endif 399 400# 401# Victor MP-C303/304 (VR4122) 402# 403ifdef CONFIG_VICTOR_MPC30X 404SUBDIRS += arch/mips/vr41xx/common \ 405 arch/mips/vr41xx/victor-mpc30x 406LIBS += arch/mips/vr41xx/common/vr41xx.o \ 407 arch/mips/vr41xx/victor-mpc30x/mpc30x.o 408LOADADDR := 0x80001000 409endif 410 411# 412# IBM WorkPad z50 (VR4121) 413# 414ifdef CONFIG_IBM_WORKPAD 415SUBDIRS += arch/mips/vr41xx/common \ 416 arch/mips/vr41xx/ibm-workpad 417LIBS += arch/mips/vr41xx/common/vr41xx.o \ 418 arch/mips/vr41xx/ibm-workpad/workpad.o 419LOADADDR += 0x80004000 420endif 421 422# 423# CASIO CASSIPEIA E-55/65 (VR4111) 424# 425ifdef CONFIG_CASIO_E55 426SUBDIRS += arch/mips/vr41xx/common \ 427 arch/mips/vr41xx/casio-e55 428LIBS += arch/mips/vr41xx/common/vr41xx.o \ 429 arch/mips/vr41xx/casio-e55/e55.o 430LOADADDR += 0x80004000 431endif 432 433# 434# Philips Nino 435# 436ifdef CONFIG_NINO 437CORE_FILES += arch/mips/philips/nino/nino.o 438SUBDIRS += arch/mips/philips/nino 439LOADADDR := 0x80000000 440endif 441 442# 443# SGI IP22 (Indy/Indigo2) 444# 445ifdef CONFIG_SGI_IP22 446CORE_FILES += arch/mips/sgi-ip22/ip22-kern.o 447LIBS += arch/mips/arc/arclib.a 448SUBDIRS += arch/mips/sgi-ip22 arch/mips/arc 449# 450# Set LOADADDR to >= 0x88069000 if you want to leave space for symmon, 451# 0x88002000 for production kernels. Note that the value must be 452# 8kb aligned or the handling of the current variable will break. 453# 454LOADADDR := 0x88002000 455endif 456 457# 458# Sibyte SB1250 SOC 459# 460ifdef CONFIG_SIBYTE_SB1250 461# This is a LIB so that it links at the end, and initcalls are later 462# the sequence; but it is built as an object so that modules don't get 463# removed (as happens, even if they have __initcall/module_init) 464LIBS += arch/mips/sibyte/sb1250/sb1250.o 465SUBDIRS += arch/mips/sibyte/sb1250 466LOADADDR := 0x80100000 467endif 468 469# 470# Sibyte SWARM board 471# 472ifdef CONFIG_SIBYTE_SWARM 473LIBS += arch/mips/sibyte/swarm/sbswarm.a 474SUBDIRS += arch/mips/sibyte/swarm 475endif 476ifdef CONFIG_SIBYTE_SENTOSA 477LIBS += arch/mips/sibyte/swarm/sbswarm.a 478SUBDIRS += arch/mips/sibyte/swarm 479endif 480 481# 482# Broadcom (SiByte) BCM112x SOCs 483# (In fact, this just uses the exact same support as the BCM1250.) 484# 485ifdef CONFIG_SIBYTE_BCM112X 486# This is a LIB so that it links at the end, and initcalls are later 487# the sequence; but it is built as an object so that modules don't get 488# removed (as happens, even if they have __initcall/module_init) 489LIBS += arch/mips/sibyte/sb1250/sb1250.o 490SUBDIRS += arch/mips/sibyte/sb1250 491LOADADDR := 0x80100000 492endif 493 494# 495# Sibyte BCM91120C (CRhine) board 496# (In fact, this just uses the exact same support as the BCM912500A (SWARM).) 497# 498ifdef CONFIG_SIBYTE_CRHINE 499LIBS += arch/mips/sibyte/swarm/sbswarm.a 500SUBDIRS += arch/mips/sibyte/swarm 501endif 502 503# 504# Sibyte BCM91120x (Carmel) board 505# (In fact, this just uses the exact same support as the BCM912500A (SWARM).) 506# 507ifdef CONFIG_SIBYTE_CARMEL 508LIBS += arch/mips/sibyte/swarm/sbswarm.a 509SUBDIRS += arch/mips/sibyte/swarm 510endif 511 512# 513# Sibyte BCM91125C (CRhone) board 514# (In fact, this just uses the exact same support as the BCM912500A (SWARM).) 515# 516ifdef CONFIG_SIBYTE_CRHONE 517LIBS += arch/mips/sibyte/swarm/sbswarm.a 518SUBDIRS += arch/mips/sibyte/swarm 519endif 520 521# 522# Sibyte BCM91125E (Rhone) board 523# (In fact, this just uses the exact same support as the BCM912500A (SWARM).) 524# 525ifdef CONFIG_SIBYTE_RHONE 526LIBS += arch/mips/sibyte/swarm/sbswarm.a 527SUBDIRS += arch/mips/sibyte/swarm 528endif 529 530# 531# Sibyte CFE firmware 532# 533ifdef CONFIG_SIBYTE_CFE 534LIBS += arch/mips/sibyte/cfe/cfe.a 535SUBDIRS += arch/mips/sibyte/cfe 536endif 537 538# 539# Broadcom BCM947XX variants 540# 541ifdef CONFIG_BCM947XX 542LIBS += arch/mips/brcm-boards/generic/brcm.o arch/mips/brcm-boards/bcm947xx/bcm947xx.o 543SUBDIRS += arch/mips/brcm-boards/generic arch/mips/brcm-boards/bcm947xx 544LOADADDR := 0x80001000 545zImage: vmlinux 546 $(MAKE) -C arch/$(ARCH)/brcm-boards/bcm947xx/compressed 547export LOADADDR 548endif 549 550# 551# Broadcom BCM933XX variants 552# 553ifdef CONFIG_BCM933XX 554LIBS += arch/mips/brcm-boards/bcm933xx/bcm933xx.o 555SUBDIRS += arch/mips/brcm-boards/bcm933xx 556LOADADDR := 0x80010000 557 558vmlinux.srec: vmlinux 559 $(OBJCOPY) -O srec $< $@ 560linux.srec: vmlinux.srec 561 $(OBJCOPY) --adjust-vma=0x80000000 -O srec $< $@ 562vmlinux.out: vmlinux.bin 563 $(TOPDIR)/pstore.sh 564vmlinux.bin: vmlinux 565 $(OBJCOPY) -O binary $< $@ 566export LOADADDR 567endif 568 569# 570# SNI RM200 PCI 571# 572ifdef CONFIG_SNI_RM200_PCI 573CORE_FILES += arch/mips/sni/sni.o 574SUBDIRS += arch/mips/sni arch/mips/arc 575LIBS += arch/mips/arc/arclib.a 576LOADADDR := 0x80080000 577endif 578 579# 580# Toshiba JMR-TX3927 board 581# 582ifdef CONFIG_TOSHIBA_JMR3927 583CORE_FILES += arch/mips/jmr3927/rbhma3100/jmr3927.o \ 584 arch/mips/jmr3927/common/tx3927.o 585SUBDIRS += arch/mips/jmr3927/rbhma3100 arch/mips/jmr3927/common 586LOADADDR := 0x80050000 587endif 588 589 590# 591# Choosing incompatible machines durings configuration will result in 592# error messages during linking. Select a default linkscript if 593# none has been choosen above. 594# 595vmlinux: arch/$(ARCH)/ld.script 596 597arch/$(ARCH)/ld.script: arch/$(ARCH)/ld.script.in arch/$(ARCH)/Makefile 598 sed -e 's/@@LOADADDR@@/$(LOADADDR)/' <$< >$@ 599LINKFLAGS += -T arch/$(ARCH)/ld.script 600 601HEAD := arch/mips/kernel/head.o arch/mips/kernel/init_task.o 602 603SUBDIRS := $(addprefix arch/mips/, tools) $(SUBDIRS) $(addprefix arch/mips/, kernel mm lib) 604CORE_FILES := arch/mips/kernel/kernel.o arch/mips/mm/mm.o $(CORE_FILES) 605LIBS := arch/mips/lib/lib.a $(LIBS) 606 607ifdef CONFIG_BAGET_MIPS 608 609BAGETBOOT = $(MAKE) -C arch/$(ARCH)/baget 610 611balo: vmlinux 612 $(BAGETBOOT) balo 613 614endif 615 616ifdef CONFIG_MIPS_EV64120 617gboot: vmlinux 618 $(MAKE) -C arch/$(ARCH)/galileo-boards/ev64120/compressed 619endif 620 621ifdef CONFIG_LASAT 622rom.bin rom.sw: vmlinux 623 $(MAKE) -C arch/$(ARCH)/lasat/image $@ 624endif 625 626MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot 627 628vmlinux.ecoff: vmlinux 629 @$(MAKEBOOT) $@ 630 631archclean: 632 @$(MAKEBOOT) clean 633 rm -f arch/$(ARCH)/ld.script 634 $(MAKE) -C arch/$(ARCH)/tools clean 635 $(MAKE) -C arch/mips/baget clean 636 $(MAKE) -C arch/mips/lasat clean 637 638archmrproper: 639 @$(MAKEBOOT) mrproper 640 $(MAKE) -C arch/$(ARCH)/tools mrproper 641 642archdep: 643 if [ ! -f $(TOPDIR)/include/asm-$(ARCH)/offset.h ]; then \ 644 touch $(TOPDIR)/include/asm-$(ARCH)/offset.h; \ 645 fi; 646 @$(MAKEBOOT) dep 647