0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 archscripts: scripts_basic
0015 $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry
0016 ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
0017 $(Q)$(MAKE) $(build)=arch/mips/tools loongson3-llsc-check
0018 endif
0019 $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
0020
0021 KBUILD_DEFCONFIG := 32r2el_defconfig
0022 KBUILD_DTBS := dtbs
0023
0024
0025
0026
0027 ifdef CONFIG_CPU_LITTLE_ENDIAN
0028 32bit-tool-archpref = mipsel
0029 64bit-tool-archpref = mips64el
0030 32bit-bfd = elf32-tradlittlemips
0031 64bit-bfd = elf64-tradlittlemips
0032 32bit-emul = elf32ltsmip
0033 64bit-emul = elf64ltsmip
0034 else
0035 32bit-tool-archpref = mips
0036 64bit-tool-archpref = mips64
0037 32bit-bfd = elf32-tradbigmips
0038 64bit-bfd = elf64-tradbigmips
0039 32bit-emul = elf32btsmip
0040 64bit-emul = elf64btsmip
0041 endif
0042
0043 ifdef CONFIG_32BIT
0044 tool-archpref = $(32bit-tool-archpref)
0045 UTS_MACHINE := mips
0046 endif
0047 ifdef CONFIG_64BIT
0048 tool-archpref = $(64bit-tool-archpref)
0049 UTS_MACHINE := mips64
0050 endif
0051
0052 ifdef cross_compiling
0053 ifeq ($(CROSS_COMPILE),)
0054 CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
0055 endif
0056 endif
0057
0058 ifdef CONFIG_FUNCTION_GRAPH_TRACER
0059 ifndef KBUILD_MCOUNT_RA_ADDRESS
0060 ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
0061 cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS
0062 endif
0063 endif
0064 endif
0065 cflags-y += $(call cc-option, -mno-check-zero-division)
0066
0067 ifdef CONFIG_32BIT
0068 ld-emul = $(32bit-emul)
0069 vmlinux-32 = vmlinux
0070 vmlinux-64 = vmlinux.64
0071
0072 cflags-y += -mabi=32
0073 endif
0074
0075 ifdef CONFIG_64BIT
0076 ld-emul = $(64bit-emul)
0077 vmlinux-32 = vmlinux.32
0078 vmlinux-64 = vmlinux
0079
0080 cflags-y += -mabi=64
0081 endif
0082
0083 all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32)
0084 all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64)
0085 all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
0098 cflags-y += -msoft-float
0099 LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
0100 KBUILD_AFLAGS_MODULE += -mlong-calls
0101 KBUILD_CFLAGS_MODULE += -mlong-calls
0102
0103 ifeq ($(CONFIG_RELOCATABLE),y)
0104 LDFLAGS_vmlinux += --emit-relocs
0105 endif
0106
0107
0108
0109
0110
0111
0112 ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
0113 cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
0114 endif
0115
0116 cflags-y += -ffreestanding
0117
0118 cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
0119 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL
0120
0121 cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
0122 -fno-omit-frame-pointer
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136 cflags-y += -fno-stack-check
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155 cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
0156
0157
0158
0159
0160 cflags-$(CONFIG_CPU_R3000) += -march=r3000
0161 cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
0162 cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
0163 cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
0164 cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
0165 cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
0166 cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg
0167 cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
0168 cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap
0169 cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap
0170 cflags-$(CONFIG_CPU_MIPS64_R5) += -march=mips64r5 -Wa,--trap
0171 cflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap
0172 cflags-$(CONFIG_CPU_P5600) += -march=p5600 -Wa,--trap -modd-spreg
0173 cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
0174 cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \
0175 -Wa,--trap
0176 cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
0177 -Wa,--trap
0178 cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
0179 -Wa,--trap
0180 cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \
0181 -Wa,--trap
0182 cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx)
0183 cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d)
0184 cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
0185 -Wa,--trap
0186 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
0187 ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON))))
0188 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
0189 endif
0190 cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
0191 cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap
0192
0193 cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
0194 cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,)
0195 cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,)
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206 mips-cflags := $(cflags-y)
0207 ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y)
0208 smartmips-ase := $(call cc-option-yn,$(mips-cflags) -msmartmips)
0209 cflags-$(smartmips-ase) += -msmartmips -Wa,--no-warn
0210 endif
0211 ifeq ($(CONFIG_CPU_MICROMIPS),y)
0212 micromips-ase := $(call cc-option-yn,$(mips-cflags) -mmicromips)
0213 cflags-$(micromips-ase) += -mmicromips
0214 endif
0215 ifeq ($(CONFIG_CPU_HAS_MSA),y)
0216 toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa)
0217 cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA
0218 endif
0219 toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt)
0220 cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT
0221
0222
0223 xpa-cflags-y := $(mips-cflags)
0224 xpa-cflags-$(micromips-ase) += -mmicromips -Wa$(comma)-fatal-warnings
0225 toolchain-xpa := $(call cc-option-yn,$(xpa-cflags-y) -mxpa)
0226 cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA
0227 toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc)
0228 cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC
0229 toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp)
0230 cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP
0231 toolchain-ginv := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv)
0232 cflags-$(toolchain-ginv) += -DTOOLCHAIN_SUPPORTS_GINV
0233
0234
0235
0236
0237 libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/
0238 libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/
0239 libs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/
0240 libs-y += arch/mips/fw/lib/
0241
0242
0243
0244
0245 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0246 COMPRESSION_FNAME = vmlinuz
0247 else
0248 COMPRESSION_FNAME = vmlinux
0249 endif
0250
0251
0252
0253
0254 include $(srctree)/arch/mips/Kbuild.platforms
0255
0256 ifdef CONFIG_PHYSICAL_START
0257 load-y = $(CONFIG_PHYSICAL_START)
0258 endif
0259
0260 entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux)
0261 cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
0262 drivers-$(CONFIG_PCI) += arch/mips/pci/
0263
0264
0265
0266
0267
0268
0269
0270 ifdef CONFIG_64BIT
0271 ifndef KBUILD_SYM32
0272 ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
0273 KBUILD_SYM32 = y
0274 endif
0275 endif
0276
0277 ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
0278 cflags-y += -msym32 -DKBUILD_64BIT_SYM32
0279 else
0280 ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
0281 $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
0282 endif
0283 endif
0284 endif
0285
0286
0287
0288
0289
0290 ifdef CONFIG_64BIT
0291 load-ld = $(load-y)
0292 else
0293 load-ld = $(subst 0xffffffff,0x,$(load-y))
0294 endif
0295
0296 KBUILD_AFLAGS += $(cflags-y)
0297 KBUILD_CFLAGS += $(cflags-y)
0298 KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld)
0299 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
0300
0301 bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \
0302 LINKER_LOAD_ADDRESS=$(load-ld) \
0303 VMLINUX_ENTRY_ADDRESS=$(entry-y) \
0304 PLATFORM="$(platform-y)" \
0305 ITS_INPUTS="$(its-y)"
0306 ifdef CONFIG_32BIT
0307 bootvars-y += ADDR_BITS=32
0308 endif
0309 ifdef CONFIG_64BIT
0310 bootvars-y += ADDR_BITS=64
0311 endif
0312
0313
0314
0315 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
0316
0317 KBUILD_LDFLAGS += -m $(ld-emul)
0318
0319 ifdef CONFIG_MIPS
0320 CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
0321 egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
0322 sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
0323 endif
0324
0325 OBJCOPYFLAGS += --remove-section=.reginfo
0326
0327 head-y := arch/mips/kernel/head.o
0328
0329 libs-y += arch/mips/lib/
0330 libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/
0331
0332 drivers-y += arch/mips/crypto/
0333
0334
0335 drivers-$(CONFIG_PM) += arch/mips/power/
0336
0337
0338 boot-y := vmlinux.bin
0339 boot-y += vmlinux.ecoff
0340 boot-y += vmlinux.srec
0341 boot-y += uImage
0342 boot-y += uImage.bin
0343 boot-y += uImage.bz2
0344 boot-y += uImage.gz
0345 boot-y += uImage.lzma
0346 boot-y += uImage.lzo
0347 boot-y += vmlinux.itb
0348 boot-y += vmlinux.gz.itb
0349 boot-y += vmlinux.bz2.itb
0350 boot-y += vmlinux.lzma.itb
0351 boot-y += vmlinux.lzo.itb
0352
0353
0354 bootz-y := vmlinuz
0355 bootz-y += vmlinuz.bin
0356 bootz-y += vmlinuz.ecoff
0357 bootz-y += vmlinuz.srec
0358 bootz-y += uzImage.bin
0359 bootz-y += vmlinuz.itb
0360
0361
0362
0363
0364
0365
0366 quiet_cmd_32 = OBJCOPY $@
0367 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
0368 vmlinux.32: vmlinux
0369 $(call cmd,32)
0370
0371
0372
0373
0374
0375 quiet_cmd_64 = OBJCOPY $@
0376 cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
0377 vmlinux.64: vmlinux
0378 $(call cmd,64)
0379
0380 all: $(all-y) $(KBUILD_DTBS)
0381
0382
0383 $(boot-y): $(vmlinux-32) FORCE
0384 $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
0385 $(bootvars-y) arch/mips/boot/$@
0386
0387 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0388
0389 $(bootz-y): $(vmlinux-32) FORCE
0390 $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
0391 $(bootvars-y) 32bit-bfd=$(32bit-bfd) arch/mips/boot/$@
0392 else
0393 vmlinuz: FORCE
0394 @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
0395 /bin/false
0396 endif
0397
0398
0399 CLEAN_FILES += vmlinux.32 vmlinux.64
0400
0401
0402 core-y += arch/mips/boot/dts/
0403
0404 archprepare:
0405 ifdef CONFIG_MIPS32_N32
0406 @$(kecho) ' Checking missing-syscalls for N32'
0407 $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
0408 endif
0409 ifdef CONFIG_MIPS32_O32
0410 @$(kecho) ' Checking missing-syscalls for O32'
0411 $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
0412 endif
0413
0414 install:
0415 $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
0416 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0417 $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
0418 endif
0419 $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
0420 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
0421
0422 archheaders:
0423 $(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all
0424
0425 define archhelp
0426 echo ' install - install kernel into $(INSTALL_PATH)'
0427 echo ' vmlinux.ecoff - ECOFF boot image'
0428 echo ' vmlinux.bin - Raw binary boot image'
0429 echo ' vmlinux.srec - SREC boot image'
0430 echo ' vmlinux.32 - 64-bit boot image wrapped in 32bits (IP22/IP32)'
0431 echo ' vmlinuz - Compressed boot(zboot) image'
0432 echo ' vmlinuz.ecoff - ECOFF zboot image'
0433 echo ' vmlinuz.bin - Raw binary zboot image'
0434 echo ' vmlinuz.srec - SREC zboot image'
0435 echo ' uImage - U-Boot image'
0436 echo ' uImage.bin - U-Boot image (uncompressed)'
0437 echo ' uImage.bz2 - U-Boot image (bz2)'
0438 echo ' uImage.gz - U-Boot image (gzip)'
0439 echo ' uImage.lzma - U-Boot image (lzma)'
0440 echo ' uImage.lzo - U-Boot image (lzo)'
0441 echo ' uzImage.bin - U-Boot image (self-extracting)'
0442 echo
0443 echo ' These will be default as appropriate for a configured platform.'
0444 echo
0445 echo ' If you are targeting a system supported by generic kernels you may'
0446 echo ' configure the kernel for a given architecture target like so:'
0447 echo
0448 echo ' {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
0449 echo
0450 echo ' Where BOARDS is some subset of the following:'
0451 for board in $(sort $(BOARDS)); do echo " $${board}"; done
0452 echo
0453 echo ' Specifically the following generic default configurations are'
0454 echo ' supported:'
0455 echo
0456 $(foreach cfg,$(generic_defconfigs),
0457 printf " %-24s - Build generic kernel for $(call describe_generic_defconfig,$(cfg))\n" $(cfg);)
0458 echo
0459 echo ' The following legacy default configurations have been converted to'
0460 echo ' generic and can still be used:'
0461 echo
0462 $(foreach cfg,$(sort $(legacy_defconfigs)),
0463 printf " %-24s - Build $($(cfg)-y)\n" $(cfg);)
0464 echo
0465 echo ' Otherwise, the following default configurations are available:'
0466 endef
0467
0468 generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
0469 generic_defconfigs :=
0470
0471
0472
0473
0474
0475
0476 ifeq ($(BOARDS),)
0477 BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
0478 endif
0479
0480
0481
0482
0483
0484
0485
0486
0487 define gen_generic_defconfigs
0488 $(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
0489 target := $(bits)$(rev)$(filter el,$(endian))_defconfig
0490 generic_defconfigs += $$(target)
0491 $$(target): $(generic_config_dir)/$(bits)$(rev).config
0492 $$(target): $(generic_config_dir)/$(endian).config
0493 )))
0494 endef
0495
0496 $(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
0497 $(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
0498
0499 define describe_generic_defconfig
0500 $(subst 32r,MIPS32 r,$(subst 64r,MIPS64 r,$(subst el, little endian,$(patsubst %_defconfig,%,$(1)))))
0501 endef
0502
0503 .PHONY: $(generic_defconfigs)
0504 $(generic_defconfigs):
0505 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
0506 -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ | \
0507 grep -Ev '^#'
0508 $(Q)cp $(KCONFIG_CONFIG) $(objtree)/.config.$@
0509 $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig \
0510 KCONFIG_CONFIG=$(objtree)/.config.$@ >/dev/null
0511 $(Q)$(CONFIG_SHELL) $(srctree)/arch/$(ARCH)/tools/generic-board-config.sh \
0512 $(srctree) $(objtree) $(objtree)/.config.$@ $(KCONFIG_CONFIG) \
0513 "$(origin BOARDS)" $(BOARDS)
0514 $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
0515
0516
0517
0518
0519 $(generic_config_dir)/%.config: ;
0520
0521
0522
0523
0524
0525 .PHONY: generic_defconfig
0526 generic_defconfig:
0527 $(Q)echo "generic_defconfig is not intended for direct use, but should instead be"
0528 $(Q)echo "used via an ISA-specific target from the following list:"
0529 $(Q)echo
0530 $(Q)for cfg in $(generic_defconfigs); do echo " $${cfg}"; done
0531 $(Q)echo
0532 $(Q)false
0533
0534
0535
0536
0537
0538
0539 legacy_defconfigs += ocelot_defconfig
0540 ocelot_defconfig-y := 32r2el_defconfig BOARDS=ocelot
0541
0542 legacy_defconfigs += sead3_defconfig
0543 sead3_defconfig-y := 32r2el_defconfig BOARDS=sead-3
0544
0545 legacy_defconfigs += sead3micro_defconfig
0546 sead3micro_defconfig-y := micro32r2el_defconfig BOARDS=sead-3
0547
0548 legacy_defconfigs += xilfpga_defconfig
0549 xilfpga_defconfig-y := 32r2el_defconfig BOARDS=xilfpga
0550
0551 legacy_defconfigs += pistachio_defconfig
0552 pistachio_defconfig-y := 32r2el_defconfig BOARDS=marduk
0553
0554 .PHONY: $(legacy_defconfigs)
0555 $(legacy_defconfigs):
0556 $(Q)$(MAKE) -f $(srctree)/Makefile $($@-y)