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 38ca786f83SAdrian Bunkifeq ($(CROSS_COMPILE),) 398a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig 40ca786f83SAdrian Bunkelse 41ca786f83SAdrian BunkKBUILD_DEFCONFIG := ppc64_defconfig 42ca786f83SAdrian Bunkendif 438a5abdf8SPaul Mackerras 4494b212c2SPaul Mackerrasifeq ($(CONFIG_PPC64),y) 4594b212c2SPaul MackerrasOLDARCH := ppc64 4694b212c2SPaul Mackerras 4714cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 4814cf11afSPaul Mackerras 4914cf11afSPaul Mackerrasifeq ($(new_nm),y) 5014cf11afSPaul MackerrasNM := $(NM) --synthetic 5114cf11afSPaul Mackerrasendif 5214cf11afSPaul Mackerras 5314cf11afSPaul Mackerraselse 54bbeb3f4cSStephen RothwellOLDARCH := ppc 552578bfaeSStephen Rothwellendif 562578bfaeSStephen Rothwell 572578bfaeSStephen Rothwell# It seems there are times we use this Makefile without 582578bfaeSStephen Rothwell# including the config file, but this replicates the old behaviour 592578bfaeSStephen Rothwellifeq ($(CONFIG_WORD_SIZE),) 602578bfaeSStephen RothwellCONFIG_WORD_SIZE := 32 6114cf11afSPaul Mackerrasendif 6214cf11afSPaul Mackerras 63190554dbSStephen RothwellUTS_MACHINE := $(OLDARCH) 64190554dbSStephen Rothwell 6514cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 662578bfaeSStephen Rothwelloverride AS += -a$(CONFIG_WORD_SIZE) 672578bfaeSStephen Rothwelloverride LD += -m elf$(CONFIG_WORD_SIZE)ppc 682578bfaeSStephen Rothwelloverride CC += -m$(CONFIG_WORD_SIZE) 692578bfaeSStephen Rothwelloverride AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR) 7014cf11afSPaul Mackerrasendif 7114cf11afSPaul Mackerras 72e19e4ab4SMichael EllermanLDFLAGS_vmlinux := -Bstatic 7314cf11afSPaul Mackerras 74bbeb3f4cSStephen RothwellCFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 751993cbf4SKumar GalaCFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple 761993cbf4SKumar GalaKBUILD_CPPFLAGS += -Iarch/$(ARCH) 771993cbf4SKumar GalaKBUILD_AFLAGS += -Iarch/$(ARCH) 781993cbf4SKumar GalaKBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) 79a0f97e06SSam RavnborgCPP = $(CC) -E $(KBUILD_CFLAGS) 8014cf11afSPaul Mackerras 812578bfaeSStephen RothwellCHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ 8214cf11afSPaul Mackerras 8314cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y) 84ad14336dSSam RavnborgGCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) 8514cf11afSPaul Mackerras 8614cf11afSPaul Mackerrasifeq ($(CONFIG_POWER4_ONLY),y) 8714cf11afSPaul Mackerrasifeq ($(CONFIG_ALTIVEC),y) 8814cf11afSPaul Mackerrasifeq ($(GCC_BROKEN_VEC),y) 89a0f97e06SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-mcpu=970) 9014cf11afSPaul Mackerraselse 91a0f97e06SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) 9214cf11afSPaul Mackerrasendif 9314cf11afSPaul Mackerraselse 94a0f97e06SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) 9514cf11afSPaul Mackerrasendif 9614cf11afSPaul Mackerraselse 97a0f97e06SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-mtune=power4) 9814cf11afSPaul Mackerrasendif 9914cf11afSPaul Mackerrasendif 10014cf11afSPaul Mackerras 1013164cccdSArnd Bergmannifeq ($(CONFIG_TUNE_CELL),y) 102a0f97e06SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-mtune=cell) 1033164cccdSArnd Bergmannendif 1043164cccdSArnd Bergmann 105d3f67fbbSPaul Mackerras# No AltiVec instruction when building kernel 106a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec) 107d3f67fbbSPaul Mackerras 1080197cd2eSKumar Gala# No SPE instruction when building kernel 1090197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe) 1100197cd2eSKumar Gala 11114cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the 11214cf11afSPaul Mackerras# kernel considerably. 113a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 11414cf11afSPaul Mackerras 11557647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 11657647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 117a0f97e06SSam RavnborgKBUILD_CFLAGS += -mno-string 11814cf11afSPaul Mackerras 119f48b8296SOlaf Heringifeq ($(CONFIG_6xx),y) 120a0f97e06SSam RavnborgKBUILD_CFLAGS += -mcpu=powerpc 121f48b8296SOlaf Heringendif 122f48b8296SOlaf Hering 12314cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx) += -Wa,-m405 12414cf11afSPaul Mackerrascpu-as-$(CONFIG_6xx) += -Wa,-maltivec 12514cf11afSPaul Mackerrascpu-as-$(CONFIG_POWER4) += -Wa,-maltivec 12614cf11afSPaul Mackerrascpu-as-$(CONFIG_E500) += -Wa,-me500 12714cf11afSPaul Mackerrascpu-as-$(CONFIG_E200) += -Wa,-me200 12814cf11afSPaul Mackerras 129222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y) 130a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y) 13114cf11afSPaul Mackerras 1322578bfaeSStephen Rothwellhead-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o 13314cf11afSPaul Mackerrashead-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o 13415f6527eSJosh Boyerhead-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o 13514cf11afSPaul Mackerrashead-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 13614cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o 13714cf11afSPaul Mackerras 1389994a338SPaul Mackerrashead-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 13914cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 14014cf11afSPaul Mackerras 141daec962eSPaul Mackerrascore-y += arch/powerpc/kernel/ \ 142daec962eSPaul Mackerras arch/powerpc/mm/ \ 143daec962eSPaul Mackerras arch/powerpc/lib/ \ 144daec962eSPaul Mackerras arch/powerpc/sysdev/ \ 145daec962eSPaul Mackerras arch/powerpc/platforms/ 1465cd27208SKumar Galacore-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/ 147f78541dcSPaul Mackerrascore-$(CONFIG_XMON) += arch/powerpc/xmon/ 148*bbf45ba5SHollis Blanchardcore-$(CONFIG_KVM) += arch/powerpc/kvm/ 14914cf11afSPaul Mackerras 15014cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 15114cf11afSPaul Mackerras 152135f0b17STom Rini# Default to zImage, override when needed 15325431333SGrant Likelyall: zImage 15414cf11afSPaul Mackerras 15514cf11afSPaul MackerrasCPPFLAGS_vmlinux.lds := -Upowerpc 15614cf11afSPaul Mackerras 157595be948SGrant LikelyBOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% 158cabb5587SStephen Rothwell 1594f193362SPaul SmithPHONY += $(BOOT_TARGETS) 160cabb5587SStephen Rothwell 16194b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 16214cf11afSPaul Mackerras 16314cf11afSPaul Mackerras$(BOOT_TARGETS): vmlinux 16420f62954SPaul Mackerras $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 16514cf11afSPaul Mackerras 166e04018e8SGrant Likelybootwrapper_install %.dtb: 167773f76b1SDavid Woodhouse $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 168773f76b1SDavid Woodhouse 16914cf11afSPaul Mackerrasdefine archhelp 17094b212c2SPaul Mackerras @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 17114cf11afSPaul Mackerras @echo ' install - Install kernel using' 17214cf11afSPaul Mackerras @echo ' (your) ~/bin/installkernel or' 17314cf11afSPaul Mackerras @echo ' (distribution) /sbin/installkernel or' 17414cf11afSPaul Mackerras @echo ' install to $$(INSTALL_PATH) and run lilo' 175437a58dbSPaul Mackerras @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 17614cf11afSPaul Mackerrasendef 17714cf11afSPaul Mackerras 1783f85d63eSSam Ravnborginstall: 17925431333SGrant Likely $(Q)$(MAKE) $(build)=$(boot) install 180928370c6SAkinobu Mita 1818150caadSRoland McGrathvdso_install: 1828150caadSRoland McGrathifeq ($(CONFIG_PPC64),y) 1838150caadSRoland McGrath $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ 1848150caadSRoland McGrathendif 1858150caadSRoland McGrath $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ 1868150caadSRoland McGrath 18714cf11afSPaul Mackerrasarchclean: 188a3a9e99eSPaul Mackerras $(Q)$(MAKE) $(clean)=$(boot) 18970567293SAndreas Gruenbacher 19014cf11afSPaul Mackerrasarchprepare: checkbin 19114cf11afSPaul Mackerras 19214cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output 19314cf11afSPaul Mackerras# to stdout and these checks are run even on install targets. 19414cf11afSPaul MackerrasTOUT := .tmp_gas_check 19514cf11afSPaul Mackerras# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec 19614cf11afSPaul Mackerras# instructions. 19714cf11afSPaul Mackerras# gcc-3.4 and binutils-2.14 are a fatal combination. 19814cf11afSPaul Mackerras 19914cf11afSPaul Mackerrascheckbin: 200ad14336dSSam Ravnborg @if test "$(call cc-version)" = "0304" ; then \ 20114cf11afSPaul Mackerras if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ 20214cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ 20314cf11afSPaul Mackerras echo 'correctly with gcc-3.4 and your version of binutils.'; \ 20414cf11afSPaul Mackerras echo '*** Please upgrade your binutils or downgrade your gcc'; \ 20514cf11afSPaul Mackerras false; \ 20614cf11afSPaul Mackerras fi ; \ 20714cf11afSPaul Mackerras fi 208f5e83fa4SSegher Boessenkool @if test "$(call cc-fullversion)" = "040200" \ 209f5e83fa4SSegher Boessenkool && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ 210f5e83fa4SSegher Boessenkool echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ 211f5e83fa4SSegher Boessenkool echo 'kernel with modules enabled.' ; \ 212f5e83fa4SSegher Boessenkool echo -n '*** Please use a different GCC version or ' ; \ 213f5e83fa4SSegher Boessenkool echo 'disable kernel modules' ; \ 214f5e83fa4SSegher Boessenkool false ; \ 215f5e83fa4SSegher Boessenkool fi 21614cf11afSPaul Mackerras @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ 21714cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ 21814cf11afSPaul Mackerras echo 'correctly with old versions of binutils.' ; \ 21914cf11afSPaul Mackerras echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ 22014cf11afSPaul Mackerras false ; \ 22114cf11afSPaul Mackerras fi 22214cf11afSPaul Mackerras 22314cf11afSPaul MackerrasCLEAN_FILES += $(TOUT) 22414cf11afSPaul Mackerras 225