114cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own 214cf11afSPaul Mackerras# architecture-specific flags and dependencies. Remember to do have actions 314cf11afSPaul Mackerras# for "archclean" and "archdep" for cleaning up and making dependencies for 414cf11afSPaul Mackerras# this architecture. 514cf11afSPaul Mackerras# 614cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public 714cf11afSPaul Mackerras# License. See the file "COPYING" in the main directory of this archive 814cf11afSPaul Mackerras# for more details. 914cf11afSPaul Mackerras# 1014cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds 1114cf11afSPaul Mackerras# Changes for PPC by Gary Thomas 1214cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras 1314cf11afSPaul Mackerras# 1414cf11afSPaul Mackerras 1514cf11afSPaul MackerrasHAS_BIARCH := $(call cc-option-yn, -m32) 1614cf11afSPaul Mackerras 1714cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper 1814cf11afSPaul MackerrasCROSS32_COMPILE ?= 1914cf11afSPaul Mackerras 2014cf11afSPaul MackerrasCROSS32CC := $(CROSS32_COMPILE)gcc 2114cf11afSPaul MackerrasCROSS32AS := $(CROSS32_COMPILE)as 2214cf11afSPaul MackerrasCROSS32LD := $(CROSS32_COMPILE)ld 232bf11819SPaul MackerrasCROSS32AR := $(CROSS32_COMPILE)ar 2414cf11afSPaul MackerrasCROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy 2514cf11afSPaul Mackerras 2614cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 2714cf11afSPaul Mackerrasifeq ($(CROSS32_COMPILE),) 2814cf11afSPaul MackerrasCROSS32CC := $(CC) -m32 2914cf11afSPaul MackerrasCROSS32AS := $(AS) -a32 3014cf11afSPaul MackerrasCROSS32LD := $(LD) -m elf32ppc 3114cf11afSPaul MackerrasCROSS32OBJCOPY := $(OBJCOPY) 328995ac87SSegher BoessenkoolCROSS32AR := GNUTARGET=elf32-powerpc $(AR) 3314cf11afSPaul Mackerrasendif 3414cf11afSPaul Mackerrasendif 3514cf11afSPaul Mackerras 362bf11819SPaul Mackerrasexport CROSS32CC CROSS32AS CROSS32LD CROSS32AR CROSS32OBJCOPY 3714cf11afSPaul Mackerras 388a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig 398a5abdf8SPaul Mackerras 4094b212c2SPaul Mackerrasifeq ($(CONFIG_PPC64),y) 4194b212c2SPaul MackerrasOLDARCH := ppc64 4294b212c2SPaul MackerrasSZ := 64 4394b212c2SPaul Mackerras 4414cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 4514cf11afSPaul Mackerras 4614cf11afSPaul Mackerrasifeq ($(new_nm),y) 4714cf11afSPaul MackerrasNM := $(NM) --synthetic 4814cf11afSPaul Mackerrasendif 4914cf11afSPaul Mackerras 5014cf11afSPaul Mackerraselse 51bbeb3f4cSStephen RothwellOLDARCH := ppc 5214cf11afSPaul MackerrasSZ := 32 5314cf11afSPaul Mackerrasendif 5414cf11afSPaul Mackerras 55190554dbSStephen RothwellUTS_MACHINE := $(OLDARCH) 56190554dbSStephen Rothwell 5714cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 5814cf11afSPaul Mackerrasoverride AS += -a$(SZ) 5914cf11afSPaul Mackerrasoverride LD += -m elf$(SZ)ppc 6014cf11afSPaul Mackerrasoverride CC += -m$(SZ) 618995ac87SSegher Boessenkooloverride AR := GNUTARGET=elf$(SZ)-powerpc $(AR) 6214cf11afSPaul Mackerrasendif 6314cf11afSPaul Mackerras 64e19e4ab4SMichael EllermanLDFLAGS_vmlinux := -Bstatic 6514cf11afSPaul Mackerras 6614cf11afSPaul Mackerras# The -Iarch/$(ARCH)/include is temporary while we are merging 6755bb239eSStephen RothwellCPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include 6855bb239eSStephen RothwellAFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) 69bbeb3f4cSStephen RothwellCFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 7055bb239eSStephen RothwellCFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple 7155bb239eSStephen RothwellCPPFLAGS += $(CPPFLAGS-y) 7255bb239eSStephen RothwellAFLAGS += $(AFLAGS-y) 7355bb239eSStephen RothwellCFLAGS += -msoft-float -pipe $(CFLAGS-y) 7414cf11afSPaul MackerrasCPP = $(CC) -E $(CFLAGS) 7514cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc 7655bb239eSStephen RothwellLINUXINCLUDE-$(CONFIG_PPC32) := -Iarch/$(ARCH)/include 7755bb239eSStephen RothwellLINUXINCLUDE += $(LINUXINCLUDE-y) 7814cf11afSPaul Mackerras 7914cf11afSPaul MackerrasCHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ 8014cf11afSPaul Mackerras 8114cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y) 82ad14336dSSam RavnborgGCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) 8314cf11afSPaul Mackerras 8414cf11afSPaul Mackerrasifeq ($(CONFIG_POWER4_ONLY),y) 8514cf11afSPaul Mackerrasifeq ($(CONFIG_ALTIVEC),y) 8614cf11afSPaul Mackerrasifeq ($(GCC_BROKEN_VEC),y) 8714cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=970) 8814cf11afSPaul Mackerraselse 8914cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=power4) 9014cf11afSPaul Mackerrasendif 9114cf11afSPaul Mackerraselse 9214cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=power4) 9314cf11afSPaul Mackerrasendif 9414cf11afSPaul Mackerraselse 9514cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mtune=power4) 9614cf11afSPaul Mackerrasendif 9714cf11afSPaul Mackerrasendif 9814cf11afSPaul Mackerras 99d3f67fbbSPaul Mackerras# No AltiVec instruction when building kernel 100d3f67fbbSPaul MackerrasCFLAGS += $(call cc-option,-mno-altivec) 101d3f67fbbSPaul Mackerras 10214cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the 10314cf11afSPaul Mackerras# kernel considerably. 10414cf11afSPaul MackerrasCFLAGS += $(call cc-option,-funit-at-a-time) 10514cf11afSPaul Mackerras 10657647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 10757647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 10857647a4dSBenjamin HerrenschmidtCFLAGS += -mno-string 10914cf11afSPaul Mackerras 110f48b8296SOlaf Heringifeq ($(CONFIG_6xx),y) 111f48b8296SOlaf HeringCFLAGS += -mcpu=powerpc 112f48b8296SOlaf Heringendif 113f48b8296SOlaf Hering 11414cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx) += -Wa,-m405 11514cf11afSPaul Mackerrascpu-as-$(CONFIG_6xx) += -Wa,-maltivec 11614cf11afSPaul Mackerrascpu-as-$(CONFIG_POWER4) += -Wa,-maltivec 11714cf11afSPaul Mackerrascpu-as-$(CONFIG_E500) += -Wa,-me500 11814cf11afSPaul Mackerrascpu-as-$(CONFIG_E200) += -Wa,-me200 11914cf11afSPaul Mackerras 12014cf11afSPaul MackerrasAFLAGS += $(cpu-as-y) 12114cf11afSPaul MackerrasCFLAGS += $(cpu-as-y) 12214cf11afSPaul Mackerras 12370d64ceaSPaul Mackerrashead-y := arch/powerpc/kernel/head_32.o 12414cf11afSPaul Mackerrashead-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o 12514cf11afSPaul Mackerrashead-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o 12614cf11afSPaul Mackerrashead-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o 12714cf11afSPaul Mackerrashead-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 12814cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o 12914cf11afSPaul Mackerras 1309994a338SPaul Mackerrashead-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 13114cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 13214cf11afSPaul Mackerras 133daec962eSPaul Mackerrascore-y += arch/powerpc/kernel/ \ 134daec962eSPaul Mackerras arch/powerpc/mm/ \ 135daec962eSPaul Mackerras arch/powerpc/lib/ \ 136daec962eSPaul Mackerras arch/powerpc/sysdev/ \ 137daec962eSPaul Mackerras arch/powerpc/platforms/ 1385cd27208SKumar Galacore-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/ 139f78541dcSPaul Mackerrascore-$(CONFIG_XMON) += arch/powerpc/xmon/ 14014cf11afSPaul Mackerras 14114cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 14214cf11afSPaul Mackerras 143135f0b17STom Rini# Default to zImage, override when needed 144135f0b17STom Rinidefaultimage-y := zImage 145f4fc4a5bSKumar Galadefaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage 146cabb5587SStephen RothwellKBUILD_IMAGE := $(defaultimage-y) 147cabb5587SStephen Rothwellall: $(KBUILD_IMAGE) 14814cf11afSPaul Mackerras 14914cf11afSPaul MackerrasCPPFLAGS_vmlinux.lds := -Upowerpc 15014cf11afSPaul Mackerras 151916066d5SMark A. GreerBOOT_TARGETS = zImage zImage.initrd zImage.dts zImage.dts_initrd uImage 152cabb5587SStephen Rothwell 1534f193362SPaul SmithPHONY += $(BOOT_TARGETS) 154cabb5587SStephen Rothwell 15594b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 15614cf11afSPaul Mackerras 15714cf11afSPaul Mackerras$(BOOT_TARGETS): vmlinux 15820f62954SPaul Mackerras $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 15914cf11afSPaul Mackerras 16014cf11afSPaul Mackerrasdefine archhelp 16194b212c2SPaul Mackerras @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 16214cf11afSPaul Mackerras @echo ' install - Install kernel using' 16314cf11afSPaul Mackerras @echo ' (your) ~/bin/installkernel or' 16414cf11afSPaul Mackerras @echo ' (distribution) /sbin/installkernel or' 16514cf11afSPaul Mackerras @echo ' install to $$(INSTALL_PATH) and run lilo' 166437a58dbSPaul Mackerras @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 16714cf11afSPaul Mackerrasendef 16814cf11afSPaul Mackerras 169928370c6SAkinobu Mitainstall: 170928370c6SAkinobu Mita $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 171928370c6SAkinobu Mita 17214cf11afSPaul Mackerrasarchclean: 173a3a9e99eSPaul Mackerras $(Q)$(MAKE) $(clean)=$(boot) 17470567293SAndreas Gruenbacher 17570567293SAndreas Gruenbacherarchmrproper: 17614cf11afSPaul Mackerras $(Q)rm -rf arch/$(ARCH)/include 17714cf11afSPaul Mackerras 17814cf11afSPaul Mackerrasarchprepare: checkbin 17914cf11afSPaul Mackerras 18055bb239eSStephen Rothwellifeq ($(CONFIG_PPC32),y) 18114cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc 18214cf11afSPaul Mackerrasinclude/asm: arch/$(ARCH)/include/asm 18350092b23SBenjamin Herrenschmidtarch/$(ARCH)/include/asm: FORCE 18414cf11afSPaul Mackerras $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi 185bbeb3f4cSStephen Rothwell $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm 18655bb239eSStephen Rothwellendif 18714cf11afSPaul Mackerras 18814cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output 18914cf11afSPaul Mackerras# to stdout and these checks are run even on install targets. 19014cf11afSPaul MackerrasTOUT := .tmp_gas_check 19114cf11afSPaul Mackerras# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec 19214cf11afSPaul Mackerras# instructions. 19314cf11afSPaul Mackerras# gcc-3.4 and binutils-2.14 are a fatal combination. 19414cf11afSPaul Mackerras 19514cf11afSPaul Mackerrascheckbin: 196ad14336dSSam Ravnborg @if test "$(call cc-version)" = "0304" ; then \ 19714cf11afSPaul Mackerras if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ 19814cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ 19914cf11afSPaul Mackerras echo 'correctly with gcc-3.4 and your version of binutils.'; \ 20014cf11afSPaul Mackerras echo '*** Please upgrade your binutils or downgrade your gcc'; \ 20114cf11afSPaul Mackerras false; \ 20214cf11afSPaul Mackerras fi ; \ 20314cf11afSPaul Mackerras fi 204*f5e83fa4SSegher Boessenkool @if test "$(call cc-fullversion)" = "040200" \ 205*f5e83fa4SSegher Boessenkool && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ 206*f5e83fa4SSegher Boessenkool echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ 207*f5e83fa4SSegher Boessenkool echo 'kernel with modules enabled.' ; \ 208*f5e83fa4SSegher Boessenkool echo -n '*** Please use a different GCC version or ' ; \ 209*f5e83fa4SSegher Boessenkool echo 'disable kernel modules' ; \ 210*f5e83fa4SSegher Boessenkool false ; \ 211*f5e83fa4SSegher Boessenkool fi 21214cf11afSPaul Mackerras @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ 21314cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ 21414cf11afSPaul Mackerras echo 'correctly with old versions of binutils.' ; \ 21514cf11afSPaul Mackerras echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ 21614cf11afSPaul Mackerras false ; \ 21714cf11afSPaul Mackerras fi 21814cf11afSPaul Mackerras 21914cf11afSPaul MackerrasCLEAN_FILES += $(TOUT) 22014cf11afSPaul Mackerras 221