| .. | .. |
|---|
| 13 | 13 | # |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | archscripts: scripts_basic |
|---|
| 16 | + $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry |
|---|
| 17 | +ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y) |
|---|
| 18 | + $(Q)$(MAKE) $(build)=arch/mips/tools loongson3-llsc-check |
|---|
| 19 | +endif |
|---|
| 16 | 20 | $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs |
|---|
| 17 | 21 | |
|---|
| 18 | 22 | KBUILD_DEFCONFIG := 32r2el_defconfig |
|---|
| .. | .. |
|---|
| 112 | 116 | |
|---|
| 113 | 117 | cflags-y += -ffreestanding |
|---|
| 114 | 118 | |
|---|
| 115 | | -# |
|---|
| 116 | | -# We explicitly add the endianness specifier if needed, this allows |
|---|
| 117 | | -# to compile kernels with a toolchain for the other endianness. We |
|---|
| 118 | | -# carefully avoid to add it redundantly because gcc 3.3/3.4 complains |
|---|
| 119 | | -# when fed the toolchain default! |
|---|
| 120 | | -# |
|---|
| 121 | | -# Certain gcc versions up to gcc 4.1.1 (probably 4.2-subversion as of |
|---|
| 122 | | -# 2006-10-10 don't properly change the predefined symbols if -EB / -EL |
|---|
| 123 | | -# are used, so we kludge that here. A bug has been filed at |
|---|
| 124 | | -# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413. |
|---|
| 125 | | -# |
|---|
| 126 | | -# clang doesn't suffer from these issues and our checks against -dumpmachine |
|---|
| 127 | | -# don't work so well when cross compiling, since without providing --target |
|---|
| 128 | | -# clang's output will be based upon the build machine. So for clang we simply |
|---|
| 129 | | -# unconditionally specify -EB or -EL as appropriate. |
|---|
| 130 | | -# |
|---|
| 131 | | -ifeq ($(cc-name),clang) |
|---|
| 132 | 119 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB |
|---|
| 133 | 120 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL |
|---|
| 134 | | -else |
|---|
| 135 | | -undef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ |
|---|
| 136 | | -undef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ |
|---|
| 137 | | -predef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ |
|---|
| 138 | | -predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ |
|---|
| 139 | | -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) |
|---|
| 140 | | -cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) |
|---|
| 141 | | -endif |
|---|
| 142 | 121 | |
|---|
| 143 | 122 | cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ |
|---|
| 144 | 123 | -fno-omit-frame-pointer |
|---|
| .. | .. |
|---|
| 157 | 136 | # |
|---|
| 158 | 137 | cflags-y += -fno-stack-check |
|---|
| 159 | 138 | |
|---|
| 139 | +# binutils from v2.35 when built with --enable-mips-fix-loongson3-llsc=yes, |
|---|
| 140 | +# supports an -mfix-loongson3-llsc flag which emits a sync prior to each ll |
|---|
| 141 | +# instruction to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h |
|---|
| 142 | +# for a description). |
|---|
| 143 | +# |
|---|
| 144 | +# We disable this in order to prevent the assembler meddling with the |
|---|
| 145 | +# instruction that labels refer to, ie. if we label an ll instruction: |
|---|
| 146 | +# |
|---|
| 147 | +# 1: ll v0, 0(a0) |
|---|
| 148 | +# |
|---|
| 149 | +# ...then with the assembler fix applied the label may actually point at a sync |
|---|
| 150 | +# instruction inserted by the assembler, and if we were using the label in an |
|---|
| 151 | +# exception table the table would no longer contain the address of the ll |
|---|
| 152 | +# instruction. |
|---|
| 153 | +# |
|---|
| 154 | +# Avoid this by explicitly disabling that assembler behaviour. |
|---|
| 155 | +# |
|---|
| 156 | +cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) |
|---|
| 157 | + |
|---|
| 160 | 158 | # |
|---|
| 161 | 159 | # CPU-dependent compiler/assembler options for optimization. |
|---|
| 162 | 160 | # |
|---|
| 163 | 161 | cflags-$(CONFIG_CPU_R3000) += -march=r3000 |
|---|
| 164 | 162 | cflags-$(CONFIG_CPU_TX39XX) += -march=r3900 |
|---|
| 165 | | -cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap |
|---|
| 166 | 163 | cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap |
|---|
| 167 | 164 | cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap |
|---|
| 168 | 165 | cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap |
|---|
| 169 | 166 | cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap |
|---|
| 170 | 167 | cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap |
|---|
| 168 | +cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg |
|---|
| 171 | 169 | cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg |
|---|
| 172 | 170 | cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap |
|---|
| 173 | 171 | cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap |
|---|
| 172 | +cflags-$(CONFIG_CPU_MIPS64_R5) += -march=mips64r5 -Wa,--trap |
|---|
| 174 | 173 | cflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap |
|---|
| 174 | +cflags-$(CONFIG_CPU_P5600) += -march=p5600 -Wa,--trap -modd-spreg |
|---|
| 175 | 175 | cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap |
|---|
| 176 | | -cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \ |
|---|
| 177 | | - -Wa,--trap |
|---|
| 178 | 176 | cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \ |
|---|
| 179 | 177 | -Wa,--trap |
|---|
| 180 | 178 | cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \ |
|---|
| .. | .. |
|---|
| 185 | 183 | -Wa,--trap |
|---|
| 186 | 184 | cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx) |
|---|
| 187 | 185 | cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d) |
|---|
| 188 | | -cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap |
|---|
| 189 | 186 | cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ |
|---|
| 190 | 187 | -Wa,--trap |
|---|
| 191 | 188 | cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap |
|---|
| .. | .. |
|---|
| 231 | 228 | cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA |
|---|
| 232 | 229 | toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc) |
|---|
| 233 | 230 | cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC |
|---|
| 231 | +toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp) |
|---|
| 232 | +cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP |
|---|
| 233 | +toolchain-ginv := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv) |
|---|
| 234 | +cflags-$(toolchain-ginv) += -DTOOLCHAIN_SUPPORTS_GINV |
|---|
| 234 | 235 | |
|---|
| 235 | 236 | # |
|---|
| 236 | 237 | # Firmware support |
|---|
| .. | .. |
|---|
| 258 | 259 | load-y = $(CONFIG_PHYSICAL_START) |
|---|
| 259 | 260 | endif |
|---|
| 260 | 261 | |
|---|
| 261 | | -# Sign-extend the entry point to 64 bits if retrieved as a 32-bit number. |
|---|
| 262 | | -entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \ |
|---|
| 263 | | - | sed -n '/^start address / { \ |
|---|
| 264 | | - s/^.* //; \ |
|---|
| 265 | | - s/0x\([0-7].......\)$$/0x00000000\1/; \ |
|---|
| 266 | | - s/0x\(........\)$$/0xffffffff\1/; p }') |
|---|
| 267 | | - |
|---|
| 262 | +entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux) |
|---|
| 268 | 263 | cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic |
|---|
| 269 | 264 | drivers-$(CONFIG_PCI) += arch/mips/pci/ |
|---|
| 270 | 265 | |
|---|
| .. | .. |
|---|
| 334 | 329 | head-y := arch/mips/kernel/head.o |
|---|
| 335 | 330 | |
|---|
| 336 | 331 | libs-y += arch/mips/lib/ |
|---|
| 337 | | -libs-y += arch/mips/math-emu/ |
|---|
| 332 | +libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/ |
|---|
| 338 | 333 | |
|---|
| 339 | 334 | # See arch/mips/Kbuild for content of core part of the kernel |
|---|
| 340 | 335 | core-y += arch/mips/ |
|---|
| .. | .. |
|---|
| 370 | 365 | bootz-y += vmlinuz.srec |
|---|
| 371 | 366 | ifeq ($(shell expr $(zload-y) \< 0xffffffff80000000 2> /dev/null), 0) |
|---|
| 372 | 367 | bootz-y += uzImage.bin |
|---|
| 373 | | -endif |
|---|
| 374 | | - |
|---|
| 375 | | -ifdef CONFIG_LASAT |
|---|
| 376 | | -rom.bin rom.sw: vmlinux |
|---|
| 377 | | - $(Q)$(MAKE) $(build)=arch/mips/lasat/image \ |
|---|
| 378 | | - $(bootvars-y) $@ |
|---|
| 379 | 368 | endif |
|---|
| 380 | 369 | |
|---|
| 381 | 370 | # |
|---|
| .. | .. |
|---|
| 419 | 408 | CLEAN_FILES += vmlinux.32 vmlinux.64 |
|---|
| 420 | 409 | |
|---|
| 421 | 410 | # device-trees |
|---|
| 422 | | -core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/ |
|---|
| 423 | | - |
|---|
| 424 | | -%.dtb %.dtb.S %.dtb.o: | scripts |
|---|
| 425 | | - $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@ |
|---|
| 426 | | - |
|---|
| 427 | | -PHONY += dtbs |
|---|
| 428 | | -dtbs: scripts |
|---|
| 429 | | - $(Q)$(MAKE) $(build)=arch/mips/boot/dts |
|---|
| 430 | | - |
|---|
| 431 | | -PHONY += dtbs_install |
|---|
| 432 | | -dtbs_install: |
|---|
| 433 | | - $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts |
|---|
| 411 | +core-y += arch/mips/boot/dts/ |
|---|
| 434 | 412 | |
|---|
| 435 | 413 | archprepare: |
|---|
| 436 | 414 | ifdef CONFIG_MIPS32_N32 |
|---|
| .. | .. |
|---|
| 454 | 432 | $(Q)$(MAKE) $(clean)=arch/mips/boot |
|---|
| 455 | 433 | $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed |
|---|
| 456 | 434 | $(Q)$(MAKE) $(clean)=arch/mips/boot/tools |
|---|
| 457 | | - $(Q)$(MAKE) $(clean)=arch/mips/lasat |
|---|
| 435 | + |
|---|
| 436 | +archheaders: |
|---|
| 437 | + $(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all |
|---|
| 458 | 438 | |
|---|
| 459 | 439 | define archhelp |
|---|
| 460 | 440 | echo ' install - install kernel into $(INSTALL_PATH)' |
|---|
| .. | .. |
|---|
| 473 | 453 | echo ' uImage.lzma - U-Boot image (lzma)' |
|---|
| 474 | 454 | echo ' uImage.lzo - U-Boot image (lzo)' |
|---|
| 475 | 455 | echo ' uzImage.bin - U-Boot image (self-extracting)' |
|---|
| 476 | | - echo ' dtbs - Device-tree blobs for enabled boards' |
|---|
| 477 | | - echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)' |
|---|
| 478 | 456 | echo |
|---|
| 479 | 457 | echo ' These will be default as appropriate for a configured platform.' |
|---|
| 480 | 458 | echo |
|---|