11da177e4SLinus Torvalds# 21da177e4SLinus Torvalds# This file is subject to the terms and conditions of the GNU General Public 31da177e4SLinus Torvalds# License. See the file "COPYING" in the main directory of this archive 41da177e4SLinus Torvalds# for more details. 51da177e4SLinus Torvalds# 61da177e4SLinus Torvalds# Copyright (C) 1994, 95, 96, 2003 by Ralf Baechle 71da177e4SLinus Torvalds# DECStation modifications by Paul M. Antoine, 1996 81da177e4SLinus Torvalds# Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki 91da177e4SLinus Torvalds# 101da177e4SLinus Torvalds# This file is included by the global makefile so that you can add your own 111da177e4SLinus Torvalds# architecture-specific flags and dependencies. Remember to do have actions 121da177e4SLinus Torvalds# for "archclean" cleaning up for this architecture. 131da177e4SLinus Torvalds# 141da177e4SLinus Torvalds 15de0c1698SAdrian BunkKBUILD_DEFCONFIG := ip22_defconfig 16de0c1698SAdrian Bunk 171da177e4SLinus Torvalds# 181da177e4SLinus Torvalds# Select the object file format to substitute into the linker script. 191da177e4SLinus Torvalds# 201da177e4SLinus Torvaldsifdef CONFIG_CPU_LITTLE_ENDIAN 2117f690beSRalf Baechle32bit-tool-archpref = mipsel 2217f690beSRalf Baechle64bit-tool-archpref = mips64el 231da177e4SLinus Torvalds32bit-bfd = elf32-tradlittlemips 241da177e4SLinus Torvalds64bit-bfd = elf64-tradlittlemips 251da177e4SLinus Torvalds32bit-emul = elf32ltsmip 261da177e4SLinus Torvalds64bit-emul = elf64ltsmip 271da177e4SLinus Torvaldselse 2817f690beSRalf Baechle32bit-tool-archpref = mips 2917f690beSRalf Baechle64bit-tool-archpref = mips64 301da177e4SLinus Torvalds32bit-bfd = elf32-tradbigmips 311da177e4SLinus Torvalds64bit-bfd = elf64-tradbigmips 321da177e4SLinus Torvalds32bit-emul = elf32btsmip 331da177e4SLinus Torvalds64bit-emul = elf64btsmip 341da177e4SLinus Torvaldsendif 351da177e4SLinus Torvalds 36875d43e7SRalf Baechleifdef CONFIG_32BIT 3717f690beSRalf Baechletool-archpref = $(32bit-tool-archpref) 381da177e4SLinus TorvaldsUTS_MACHINE := mips 391da177e4SLinus Torvaldsendif 40875d43e7SRalf Baechleifdef CONFIG_64BIT 4117f690beSRalf Baechletool-archpref = $(64bit-tool-archpref) 421da177e4SLinus TorvaldsUTS_MACHINE := mips64 431da177e4SLinus Torvaldsendif 441da177e4SLinus Torvalds 4517f690beSRalf Baechleifneq ($(SUBARCH),$(ARCH)) 4617f690beSRalf Baechle ifeq ($(CROSS_COMPILE),) 473247989eSMaciej W. Rozycki CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-) 4817f690beSRalf Baechle endif 491da177e4SLinus Torvaldsendif 501da177e4SLinus Torvalds 517326c4e5SWu Zhangjinifdef CONFIG_FUNCTION_GRAPH_TRACER 527326c4e5SWu Zhangjin ifndef KBUILD_MCOUNT_RA_ADDRESS 537326c4e5SWu Zhangjin ifeq ($(call cc-option-yn,-mmcount-ra-address), y) 547326c4e5SWu Zhangjin cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS 557326c4e5SWu Zhangjin endif 567326c4e5SWu Zhangjin endif 577326c4e5SWu Zhangjinendif 581a4ba061SRalf Baechlecflags-y += $(call cc-option, -mno-check-zero-division) 5905e41404SRalf Baechle 608145095cSRalf Baechleifdef CONFIG_32BIT 611da177e4SLinus Torvaldsld-emul = $(32bit-emul) 621da177e4SLinus Torvaldsvmlinux-32 = vmlinux 631da177e4SLinus Torvaldsvmlinux-64 = vmlinux.64 6459b3e8e9SRalf Baechle 6559b3e8e9SRalf Baechlecflags-y += -mabi=32 668145095cSRalf Baechleendif 671da177e4SLinus Torvalds 688145095cSRalf Baechleifdef CONFIG_64BIT 698145095cSRalf Baechleld-emul = $(64bit-emul) 708145095cSRalf Baechlevmlinux-32 = vmlinux.32 718145095cSRalf Baechlevmlinux-64 = vmlinux 728145095cSRalf Baechle 7359b3e8e9SRalf Baechlecflags-y += -mabi=64 7459b3e8e9SRalf Baechleendif 7559b3e8e9SRalf Baechle 768496b401SRalf Baechleall-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) 778496b401SRalf Baechleall-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) 781b93b3c3SWu Zhangjinall-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds# 811da177e4SLinus Torvalds# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 821da177e4SLinus Torvalds# code since it only slows down the whole thing. At some point we might make 831da177e4SLinus Torvalds# use of global pointer optimizations but their use of $28 conflicts with 841da177e4SLinus Torvalds# the current pointer optimization. 851da177e4SLinus Torvalds# 861da177e4SLinus Torvalds# The DECStation requires an ECOFF kernel for remote booting, other MIPS 871da177e4SLinus Torvalds# machines may also. Since BFD is incredibly buggy with respect to 881da177e4SLinus Torvalds# crossformat linking we rely on the elf2ecoff tool for format conversion. 891da177e4SLinus Torvalds# 901da177e4SLinus Torvaldscflags-y += -G 0 -mno-abicalls -fno-pic -pipe 916218cf44SRalf Baechlecflags-y += -msoft-float 929f83d839SThiemo SeuferLDFLAGS_vmlinux += -G 0 -static -n -nostdlib 936588169dSSam RavnborgKBUILD_AFLAGS_MODULE += -mlong-calls 946588169dSSam RavnborgKBUILD_CFLAGS_MODULE += -mlong-calls 951da177e4SLinus Torvalds 96842dfc11SManuel Lauss# 97842dfc11SManuel Lauss# pass -msoft-float to GAS if it supports it. However on newer binutils 98842dfc11SManuel Lauss# (specifically newer than 2.24.51.20140728) we then also need to explicitly 99842dfc11SManuel Lauss# set ".set hardfloat" in all files which manipulate floating point registers. 100842dfc11SManuel Lauss# 101842dfc11SManuel Laussifneq ($(call as-option,-Wa$(comma)-msoft-float,),) 102842dfc11SManuel Lauss cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float 103842dfc11SManuel Laussendif 104842dfc11SManuel Lauss 10572fbfb26SRalf Baechlecflags-y += -ffreestanding 10672fbfb26SRalf Baechle 107f425a6dcSThiemo Seufer# 108f425a6dcSThiemo Seufer# We explicitly add the endianness specifier if needed, this allows 109f425a6dcSThiemo Seufer# to compile kernels with a toolchain for the other endianness. We 110f425a6dcSThiemo Seufer# carefully avoid to add it redundantly because gcc 3.3/3.4 complains 111f425a6dcSThiemo Seufer# when fed the toolchain default! 112f425a6dcSThiemo Seufer# 113f9405412SRalf Baechle# Certain gcc versions up to gcc 4.1.1 (probably 4.2-subversion as of 11459c51591SMichael Opdenacker# 2006-10-10 don't properly change the predefined symbols if -EB / -EL 115f9405412SRalf Baechle# are used, so we kludge that here. A bug has been filed at 116f9405412SRalf Baechle# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413. 117f9405412SRalf Baechle# 118f9405412SRalf Baechleundef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ 119f9405412SRalf Baechleundef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ 120f9405412SRalf Baechlepredef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ 121f9405412SRalf Baechlepredef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ 122f9405412SRalf Baechlecflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) 123f9405412SRalf Baechlecflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) 124f425a6dcSThiemo Seufer 1259007c9a2SRalf Baechlecflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 1269007c9a2SRalf Baechle -fno-omit-frame-pointer 1271da177e4SLinus Torvalds# 1281da177e4SLinus Torvalds# CPU-dependent compiler/assembler options for optimization. 1291da177e4SLinus Torvalds# 13059b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R3000) += -march=r3000 13159b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_TX39XX) += -march=r3900 13259b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R6000) += -march=r6000 -Wa,--trap 13359b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap 13459b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap 13559b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap 13659b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap 1379200c0b2SRalf Baechlecflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 13859b3e8e9SRalf Baechle -Wa,-mips32 -Wa,--trap 1399200c0b2SRalf Baechlecflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 14059b3e8e9SRalf Baechle -Wa,-mips32r2 -Wa,--trap 1417fd08ca5SLeonid Yegoshincflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap 1429200c0b2SRalf Baechlecflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ 14359b3e8e9SRalf Baechle -Wa,-mips64 -Wa,--trap 1449200c0b2SRalf Baechlecflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ 14559b3e8e9SRalf Baechle -Wa,-mips64r2 -Wa,--trap 1467fd08ca5SLeonid Yegoshincflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap 14759b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap 148c9e321e0SRalf Baechlecflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \ 1491da177e4SLinus Torvalds -Wa,--trap 150542c1020SShinya Kuribayashicflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \ 151542c1020SShinya Kuribayashi -Wa,--trap 152c9e321e0SRalf Baechlecflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \ 1531da177e4SLinus Torvalds -Wa,--trap 15459b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 1551da177e4SLinus Torvalds -Wa,--trap 156b625cd4aSMaciej W. Rozyckicflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \ 1571da177e4SLinus Torvalds -Wa,--trap 158b625cd4aSMaciej W. Rozyckicflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx) 159b625cd4aSMaciej W. Rozyckicflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d) 16059b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap 16159b3e8e9SRalf Baechlecflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ 1621da177e4SLinus Torvalds -Wa,--trap 1637e69deb8SDavid Daneycflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap 1647e69deb8SDavid Daneyifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON)))) 1657e69deb8SDavid Daneycflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon 1667e69deb8SDavid Daneyendif 167c9941158SDavid Daneycflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1 1681c7c4451SKevin Cernekeecflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap 169a8140f36SRalf Baechle# 170a8140f36SRalf Baechle# binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a 171a8140f36SRalf Baechle# as MIPS64 R1; older versions as just R1. This leaves the possibility open 172a8140f36SRalf Baechle# that GCC might generate R2 code for -march=loongson3a which then is rejected 173a8140f36SRalf Baechle# by GAS. The cc-option can't probe for this behaviour so -march=loongson3a 174a8140f36SRalf Baechle# can't easily be used safely within the kbuild framework. 175a8140f36SRalf Baechle# 176a8140f36SRalf Baechlecflags-$(CONFIG_CPU_LOONGSON3) += \ 177a8140f36SRalf Baechle $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ 178a8140f36SRalf Baechle -Wa,-mips64r2 -Wa,--trap 1791da177e4SLinus Torvalds 18020d60d99SMaciej W. Rozyckicflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,) 18120d60d99SMaciej W. Rozyckicflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) 18220d60d99SMaciej W. Rozyckicflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) 18320d60d99SMaciej W. Rozycki 1841da177e4SLinus Torvaldsifdef CONFIG_CPU_SB1 1851da177e4SLinus Torvaldsifdef CONFIG_SB1_PASS_1_WORKAROUNDS 1866588169dSSam RavnborgKBUILD_AFLAGS_MODULE += -msb1-pass1-workarounds 1876588169dSSam RavnborgKBUILD_CFLAGS_MODULE += -msb1-pass1-workarounds 1881da177e4SLinus Torvaldsendif 1891da177e4SLinus Torvaldsendif 1901da177e4SLinus Torvalds 19132098ec7SMarkos Chandras# For smartmips configurations, there are hundreds of warnings due to ISA overrides 19232098ec7SMarkos Chandras# in assembly and header files. smartmips is only supported for MIPS32r1 onwards 19332098ec7SMarkos Chandras# and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or 19432098ec7SMarkos Chandras# similar directives in the kernel will spam the build logs with the following warnings: 19532098ec7SMarkos Chandras# Warning: the `smartmips' extension requires MIPS32 revision 1 or greater 19632098ec7SMarkos Chandras# or 19732098ec7SMarkos Chandras# Warning: the 64-bit MIPS architecture does not support the `smartmips' extension 19832098ec7SMarkos Chandras# Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has 19932098ec7SMarkos Chandras# been fixed properly. 20032098ec7SMarkos Chandrasmips-cflags := "$(cflags-y)" 20132098ec7SMarkos Chandrascflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,$(mips-cflags),-msmartmips) -Wa,--no-warn 20232098ec7SMarkos Chandrascflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,$(mips-cflags),-mmicromips) 20332098ec7SMarkos Chandrasifeq ($(CONFIG_CPU_HAS_MSA),y) 20432098ec7SMarkos Chandrastoolchain-msa := $(call cc-option-yn,-$(mips-cflags),mhard-float -mfp64 -Wa$(comma)-mmsa) 20532098ec7SMarkos Chandrascflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA 20632098ec7SMarkos Chandrasendif 20732098ec7SMarkos Chandras 2081da177e4SLinus Torvalds# 2091da177e4SLinus Torvalds# Firmware support 2101da177e4SLinus Torvalds# 2110e2794b0SRalf Baechlelibs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/ 2120e2794b0SRalf Baechlelibs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/ 2130e2794b0SRalf Baechlelibs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/ 214231a35d3SThomas Bogendoerferlibs-y += arch/mips/fw/lib/ 2151da177e4SLinus Torvalds 2161da177e4SLinus Torvalds# 217ebc89718SRalf Baechle# Kernel compression 218ebc89718SRalf Baechle# 219ebc89718SRalf Baechleifdef SYS_SUPPORTS_ZBOOT 220ebc89718SRalf BaechleCOMPRESSION_FNAME = vmlinuz 221ebc89718SRalf Baechleelse 222ebc89718SRalf BaechleCOMPRESSION_FNAME = vmlinux 223ebc89718SRalf Baechleendif 224ebc89718SRalf Baechle 225ebc89718SRalf Baechle# 2261da177e4SLinus Torvalds# Board-dependent options and extra files 2271da177e4SLinus Torvalds# 228a436bb7bSMasahiro Yamadainclude arch/mips/Kbuild.platforms 2297ca5dc14SFlorian Fainelli 230abe77f90SRalf Baechleifdef CONFIG_PHYSICAL_START 231abe77f90SRalf Baechleload-y = $(CONFIG_PHYSICAL_START) 232abe77f90SRalf Baechleendif 2333185557dSJames Hoganentry-y = 0x$(shell $(NM) vmlinux 2>/dev/null \ 2343185557dSJames Hogan | grep "\bkernel_entry\b" | cut -f1 -d \ ) 235abe77f90SRalf Baechle 236384740dcSRalf Baechlecflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 2371da177e4SLinus Torvaldsdrivers-$(CONFIG_PCI) += arch/mips/pci/ 2381da177e4SLinus Torvalds 239adff90a9SFranck Bui-Huu# 240adff90a9SFranck Bui-Huu# Automatically detect the build format. By default we choose 241adff90a9SFranck Bui-Huu# the elf format according to the load address. 242adff90a9SFranck Bui-Huu# We can always force a build with a 64-bits symbol format by 243054c51b4SFranck Bui-Huu# passing 'KBUILD_SYM32=no' option to the make's command line. 244adff90a9SFranck Bui-Huu# 245adff90a9SFranck Bui-Huuifdef CONFIG_64BIT 246054c51b4SFranck Bui-Huu ifndef KBUILD_SYM32 247adff90a9SFranck Bui-Huu ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0) 248054c51b4SFranck Bui-Huu KBUILD_SYM32 = y 249adff90a9SFranck Bui-Huu endif 250adff90a9SFranck Bui-Huu endif 251adff90a9SFranck Bui-Huu 25220d60d99SMaciej W. Rozycki ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy) 253054c51b4SFranck Bui-Huu cflags-y += -msym32 -DKBUILD_64BIT_SYM32 25420d60d99SMaciej W. Rozycki else 25520d60d99SMaciej W. Rozycki ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) 25620d60d99SMaciej W. Rozycki $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) 257adff90a9SFranck Bui-Huu endif 258adff90a9SFranck Bui-Huu endif 259e58d95abSFranck Bui-Huuendif 260adff90a9SFranck Bui-Huu 261222d394dSSam RavnborgKBUILD_AFLAGS += $(cflags-y) 26251b563fcSSam RavnborgKBUILD_CFLAGS += $(cflags-y) 263f7fc237eSMichal MarekKBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) 264f7fc237eSMichal MarekKBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) 2651da177e4SLinus Torvalds 2663185557dSJames Hoganbootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ 2673185557dSJames Hogan VMLINUX_ENTRY_ADDRESS=$(entry-y) 2683185557dSJames Hogan 2691da177e4SLinus TorvaldsLDFLAGS += -m $(ld-emul) 2701da177e4SLinus Torvalds 27159b3e8e9SRalf Baechleifdef CONFIG_MIPS 272a0f97e06SSam RavnborgCHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ 27348c35b2dSAlexey Dobriyan egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ 27408fa624fSAaro Koskinen sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/") 2752a2c3e45SAtsushi Nemotoifdef CONFIG_64BIT 2762a2c3e45SAtsushi NemotoCHECKFLAGS += -m64 2772a2c3e45SAtsushi Nemotoendif 27859b3e8e9SRalf Baechleendif 27959b3e8e9SRalf Baechle 2801da177e4SLinus TorvaldsOBJCOPYFLAGS += --remove-section=.reginfo 2811da177e4SLinus Torvalds 282957b369cSThomas Gleixnerhead-y := arch/mips/kernel/head.o 2831da177e4SLinus Torvalds 2841da177e4SLinus Torvaldslibs-y += arch/mips/lib/ 285593d33feSRalf Baechlelibs-y += arch/mips/math-emu/ 2861da177e4SLinus Torvalds 2879aeb404bSSam Ravnborg# See arch/mips/Kbuild for content of core part of the kernel 2889aeb404bSSam Ravnborgcore-y += arch/mips/ 2891da177e4SLinus Torvalds 2901da177e4SLinus Torvaldsdrivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/ 2911da177e4SLinus Torvalds 292363c55caSWu Zhangjin# suspend and hibernation support 293363c55caSWu Zhangjindrivers-$(CONFIG_PM) += arch/mips/power/ 294363c55caSWu Zhangjin 29538d2d649SJames Hogan# boot image targets (arch/mips/boot/) 29638d2d649SJames Hoganboot-y := vmlinux.bin 29738d2d649SJames Hoganboot-y += vmlinux.ecoff 29838d2d649SJames Hoganboot-y += vmlinux.srec 2994defe455SJames Hoganifeq ($(shell expr $(load-y) \< 0xffffffff80000000 2> /dev/null), 0) 3004defe455SJames Hoganboot-y += uImage 3019d6b80faSMarkos Chandrasboot-y += uImage.bin 3029d6b80faSMarkos Chandrasboot-y += uImage.bz2 3034defe455SJames Hoganboot-y += uImage.gz 3049d6b80faSMarkos Chandrasboot-y += uImage.lzma 3059d6b80faSMarkos Chandrasboot-y += uImage.lzo 3064defe455SJames Hoganendif 30738d2d649SJames Hogan 30838d2d649SJames Hogan# compressed boot image targets (arch/mips/boot/compressed/) 30938d2d649SJames Hoganbootz-y := vmlinuz 31038d2d649SJames Hoganbootz-y += vmlinuz.bin 31138d2d649SJames Hoganbootz-y += vmlinuz.ecoff 31238d2d649SJames Hoganbootz-y += vmlinuz.srec 31338d2d649SJames Hogan 3141f21d2bdSBrian Murphyifdef CONFIG_LASAT 3151f21d2bdSBrian Murphyrom.bin rom.sw: vmlinux 3163185557dSJames Hogan $(Q)$(MAKE) $(build)=arch/mips/lasat/image \ 3173185557dSJames Hogan $(bootvars-y) $@ 3181f21d2bdSBrian Murphyendif 3191f21d2bdSBrian Murphy 3201da177e4SLinus Torvalds# 3211da177e4SLinus Torvalds# Some machines like the Indy need 32-bit ELF binaries for booting purposes. 3221da177e4SLinus Torvalds# Other need ECOFF, so we build a 32-bit ELF binary for them which we then 3231da177e4SLinus Torvalds# convert to ECOFF using elf2ecoff. 3241da177e4SLinus Torvalds# 325007fbbeaSWu Zhangjinquiet_cmd_32 = OBJCOPY $@ 326007fbbeaSWu Zhangjin cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 3271da177e4SLinus Torvaldsvmlinux.32: vmlinux 328007fbbeaSWu Zhangjin $(call cmd,32) 3291da177e4SLinus Torvalds 3301da177e4SLinus Torvalds# 3311da177e4SLinus Torvalds# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit 3321da177e4SLinus Torvalds# ELF files from 32-bit files by conversion. 3331da177e4SLinus Torvalds# 334007fbbeaSWu Zhangjinquiet_cmd_64 = OBJCOPY $@ 335007fbbeaSWu Zhangjin cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@ 3361da177e4SLinus Torvaldsvmlinux.64: vmlinux 337007fbbeaSWu Zhangjin $(call cmd,64) 3381da177e4SLinus Torvalds 3398496b401SRalf Baechleall: $(all-y) 3401da177e4SLinus Torvalds 34135eaa1e9SSam Ravnborg# boot 34238d2d649SJames Hogan$(boot-y): $(vmlinux-32) FORCE 3433185557dSJames Hogan $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \ 3443185557dSJames Hogan $(bootvars-y) arch/mips/boot/$@ 3451da177e4SLinus Torvalds 34626fca83aSFlorian Fainelliifdef CONFIG_SYS_SUPPORTS_ZBOOT 34735eaa1e9SSam Ravnborg# boot/compressed 34838d2d649SJames Hogan$(bootz-y): $(vmlinux-32) FORCE 34935eaa1e9SSam Ravnborg $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ 3503185557dSJames Hogan $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@ 35126fca83aSFlorian Fainellielse 35226fca83aSFlorian Fainellivmlinuz: FORCE 35326fca83aSFlorian Fainelli @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled' 35426fca83aSFlorian Fainelli /bin/false 35526fca83aSFlorian Fainelliendif 35635eaa1e9SSam Ravnborg 35735eaa1e9SSam Ravnborg 358d745866eSSam RavnborgCLEAN_FILES += vmlinux.32 vmlinux.64 3591da177e4SLinus Torvalds 3607fafb068SAndrew Bresticker# device-trees 3617fafb068SAndrew Brestickercore-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/ 3627fafb068SAndrew Bresticker 3637fafb068SAndrew Bresticker%.dtb %.dtb.S %.dtb.o: | scripts 3647fafb068SAndrew Bresticker $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@ 3657fafb068SAndrew Bresticker 366c8d333dfSAndrew BrestickerPHONY += dtbs 367c8d333dfSAndrew Brestickerdtbs: scripts 368c8d333dfSAndrew Bresticker $(Q)$(MAKE) $(build)=arch/mips/boot/dts dtbs 369c8d333dfSAndrew Bresticker 370e48ce6b8SAtsushi Nemotoarchprepare: 371e48ce6b8SAtsushi Nemotoifdef CONFIG_MIPS32_N32 372e48ce6b8SAtsushi Nemoto @echo ' Checking missing-syscalls for N32' 37344656fa0SDavid Daney $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32" 374e48ce6b8SAtsushi Nemotoendif 375e48ce6b8SAtsushi Nemotoifdef CONFIG_MIPS32_O32 376e48ce6b8SAtsushi Nemoto @echo ' Checking missing-syscalls for O32' 37744656fa0SDavid Daney $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32" 378e48ce6b8SAtsushi Nemotoendif 379e48ce6b8SAtsushi Nemoto 38059968d3bSRalf Baechleinstall: 38159968d3bSRalf Baechle $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE) 382d9beeecaSRalf Baechleifdef CONFIG_SYS_SUPPORTS_ZBOOT 3831b93b3c3SWu Zhangjin $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE) 384d9beeecaSRalf Baechleendif 38559968d3bSRalf Baechle $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE) 38659968d3bSRalf Baechle $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) 38759968d3bSRalf Baechle 3881da177e4SLinus Torvaldsarchclean: 389d745866eSSam Ravnborg $(Q)$(MAKE) $(clean)=arch/mips/boot 390d745866eSSam Ravnborg $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed 391d745866eSSam Ravnborg $(Q)$(MAKE) $(clean)=arch/mips/lasat 3921da177e4SLinus Torvalds 393e7865765SRalf Baechledefine archhelp 39459968d3bSRalf Baechle echo ' install - install kernel into $(INSTALL_PATH)' 395e7865765SRalf Baechle echo ' vmlinux.ecoff - ECOFF boot image' 396e7865765SRalf Baechle echo ' vmlinux.bin - Raw binary boot image' 397e7865765SRalf Baechle echo ' vmlinux.srec - SREC boot image' 39878931652SJoshua Kinard echo ' vmlinux.32 - 64-bit boot image wrapped in 32bits (IP22/IP32)' 3991b93b3c3SWu Zhangjin echo ' vmlinuz - Compressed boot(zboot) image' 4001b93b3c3SWu Zhangjin echo ' vmlinuz.ecoff - ECOFF zboot image' 4011b93b3c3SWu Zhangjin echo ' vmlinuz.bin - Raw binary zboot image' 4021b93b3c3SWu Zhangjin echo ' vmlinuz.srec - SREC zboot image' 4034defe455SJames Hogan echo ' uImage - U-Boot image' 4049d6b80faSMarkos Chandras echo ' uImage.bin - U-Boot image (uncompressed)' 4059d6b80faSMarkos Chandras echo ' uImage.bz2 - U-Boot image (bz2)' 4064defe455SJames Hogan echo ' uImage.gz - U-Boot image (gzip)' 4079d6b80faSMarkos Chandras echo ' uImage.lzma - U-Boot image (lzma)' 4089d6b80faSMarkos Chandras echo ' uImage.lzo - U-Boot image (lzo)' 409c8d333dfSAndrew Bresticker echo ' dtbs - Device-tree blobs for enabled boards' 410e7865765SRalf Baechle echo 41125985edcSLucas De Marchi echo ' These will be default as appropriate for a configured platform.' 412e7865765SRalf Baechleendef 413