#
# arch/arm/Makefile
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1995-2001 by Russell King
LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
ifeq ($([31mCONFIG_CPU_ENDIAN_BE8[0m),y)
LDFLAGS_vmlinux += --be8
KBUILD_LDFLAGS_MODULE += --be8
endif
ifeq ($([31mCONFIG_ARM_MODULE_PLTS[0m),y)
KBUILD_LDS_MODULE += $(srctree)/arch/arm/kernel/module.lds
endif
GZFLAGS :=-9
#KBUILD_CFLAGS +=-pipe
# Never generate .eh_frame
KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
# This should work on most of the modern platforms
KBUILD_DEFCONFIG := multi_v7_defconfig
# defines filename extension depending memory management type.
ifeq ($([31mCONFIG_MMU[0m),)
MMUEXT := -nommu
KBUILD_CFLAGS += $(call cc-option,-mno-unaligned-access)
endif
ifeq ($([31mCONFIG_FRAME_POINTER[0m),y)
KBUILD_CFLAGS +=-fno-omit-frame-pointer
ifeq ($([31mCONFIG_CC_IS_GCC[0m),y)
KBUILD_CFLAGS += -mapcs -mno-sched-prolog
endif
endif
ifeq ($([31mCONFIG_CPU_BIG_ENDIAN[0m),y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__ARMEB__
AS += -EB
KBUILD_LDFLAGS += -EB
else
KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__ARMEL__
AS += -EL
KBUILD_LDFLAGS += -EL
endif
#
# The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
# later may result in code being generated that handles signed short and signed
# char struct members incorrectly. So disable it.
# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
#
KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra)
# This selects which instruction set is used.
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
arch-$([31mCONFIG_CPU_32v7M[0m) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m
arch-$([31mCONFIG_CPU_32v7[0m) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
arch-$([31mCONFIG_CPU_32v6[0m) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
# Only override the compiler option if ARMv6. The ARMv6K extensions are
# always available in ARMv7
ifeq ($([31mCONFIG_CPU_32v6[0m),y)
arch-$([31mCONFIG_CPU_32v6K[0m) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
endif
arch-$([31mCONFIG_CPU_32v5[0m) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
arch-$([31mCONFIG_CPU_32v4T[0m) =-D__LINUX_ARM_ARCH__=4 -march=armv4t
arch-$([31mCONFIG_CPU_32v4[0m) =-D__LINUX_ARM_ARCH__=4 -march=armv4
arch-$([31mCONFIG_CPU_32v3[0m) =-D__LINUX_ARM_ARCH__=3 -march=armv3m
# Evaluate arch cc-option calls now
arch-y := $(arch-y)
# This selects how we optimise for the processor.
tune-$([31mCONFIG_CPU_ARM7TDMI[0m) =-mtune=arm7tdmi
tune-$([31mCONFIG_CPU_ARM720T[0m) =-mtune=arm7tdmi
tune-$([31mCONFIG_CPU_ARM740T[0m) =-mtune=arm7tdmi
tune-$([31mCONFIG_CPU_ARM9TDMI[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_ARM940T[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_ARM946E[0m) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
tune-$([31mCONFIG_CPU_ARM920T[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_ARM922T[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_ARM925T[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_ARM926T[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_FA526[0m) =-mtune=arm9tdmi
tune-$([31mCONFIG_CPU_SA110[0m) =-mtune=strongarm110
tune-$([31mCONFIG_CPU_SA1100[0m) =-mtune=strongarm1100
tune-$([31mCONFIG_CPU_XSCALE[0m) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$([31mCONFIG_CPU_XSC3[0m) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$([31mCONFIG_CPU_FEROCEON[0m) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
tune-$([31mCONFIG_CPU_V6[0m) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
tune-$([31mCONFIG_CPU_V6K[0m) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
# Evaluate tune cc-option calls now
tune-y := $(tune-y)
ifeq ($([31mCONFIG_AEABI[0m),y)
CFLAGS_ABI :=-mabi=aapcs-linux -mfpu=vfp
else
CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
endif
ifeq ($([31mCONFIG_ARM_UNWIND[0m),y)
CFLAGS_ABI +=-funwind-tables
endif
ifeq ($([31mCONFIG_CC_IS_CLANG[0m),y)
CFLAGS_ABI += -meabi gnu
endif
# Accept old syntax despite ".syntax unified"
AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
ifeq ($([31mCONFIG_THUMB2_KERNEL[0m),y)
CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
# Work around buggy relocation from gas if requested:
ifeq ($([31mCONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11[0m),y)
KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
endif
else
CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
AFLAGS_ISA :=$(CFLAGS_ISA)
endif
# Need -Uarm for gcc < 3.x
KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
CHECKFLAGS += -D__arm__
#Default value
head-y := arch/arm/kernel/head$(MMUEXT).o
# Text offset. This list is sorted numerically by address in order to
# provide a means to avoid/resolve conflicts in multi-arch kernels.
textofs-y := 0x00008000
# We don't want the htc bootloader to corrupt kernel during resume
textofs-$([31mCONFIG_PM_H1940[0m) := 0x00108000
# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
ifeq ($([31mCONFIG_ARCH_SA1100[0m),y)
textofs-$([31mCONFIG_SA1111[0m) := 0x00208000
endif
textofs-$([31mCONFIG_ARCH_MSM8X60[0m) := 0x00208000
textofs-$([31mCONFIG_ARCH_MSM8960[0m) := 0x00208000
textofs-$([31mCONFIG_ARCH_MESON[0m) := 0x00208000
textofs-$([31mCONFIG_ARCH_AXXIA[0m) := 0x00308000
# Machine directory name. This list is sorted alphanumerically
# by CONFIG_* macro name.
machine-$([31mCONFIG_ARCH_ACTIONS[0m) += actions
machine-$([31mCONFIG_ARCH_ALPINE[0m) += alpine
machine-$([31mCONFIG_ARCH_ARTPEC[0m) += artpec
machine-$([31mCONFIG_ARCH_ASPEED[0m) += aspeed
machine-$([31mCONFIG_ARCH_AT91[0m) += at91
machine-$([31mCONFIG_ARCH_AXXIA[0m) += axxia
machine-$([31mCONFIG_ARCH_BCM[0m) += bcm
machine-$([31mCONFIG_ARCH_BERLIN[0m) += berlin
machine-$([31mCONFIG_ARCH_CLPS711X[0m) += clps711x
machine-$([31mCONFIG_ARCH_CNS3XXX[0m) += cns3xxx
machine-$([31mCONFIG_ARCH_DAVINCI[0m) += davinci
machine-$([31mCONFIG_ARCH_DIGICOLOR[0m) += digicolor
machine-$([31mCONFIG_ARCH_DOVE[0m) += dove
machine-$([31mCONFIG_ARCH_EBSA110[0m) += ebsa110
machine-$([31mCONFIG_ARCH_EFM32[0m) += efm32
machine-$([31mCONFIG_ARCH_EP93XX[0m) += ep93xx
machine-$([31mCONFIG_ARCH_EXYNOS[0m) += exynos
machine-$([31mCONFIG_ARCH_FOOTBRIDGE[0m) += footbridge
machine-$([31mCONFIG_ARCH_GEMINI[0m) += gemini
machine-$([31mCONFIG_ARCH_HIGHBANK[0m) += highbank
machine-$([31mCONFIG_ARCH_HISI[0m) += hisi
machine-$([31mCONFIG_ARCH_INTEGRATOR[0m) += integrator
machine-$([31mCONFIG_ARCH_IOP32X[0m) += iop32x
machine-$([31mCONFIG_ARCH_IXP4XX[0m) += ixp4xx
machine-$([31mCONFIG_ARCH_KEYSTONE[0m) += keystone
machine-$([31mCONFIG_ARCH_LPC18XX[0m) += lpc18xx
machine-$([31mCONFIG_ARCH_LPC32XX[0m) += lpc32xx
machine-$([31mCONFIG_ARCH_MESON[0m) += meson
machine-$([31mCONFIG_ARCH_MMP[0m) += mmp
machine-$([31mCONFIG_ARCH_MPS2[0m) += vexpress
machine-$([31mCONFIG_ARCH_MOXART[0m) += moxart
machine-$([31mCONFIG_ARCH_MV78XX0[0m) += mv78xx0
machine-$([31mCONFIG_ARCH_MVEBU[0m) += mvebu
machine-$([31mCONFIG_ARCH_MXC[0m) += imx
machine-$([31mCONFIG_ARCH_MEDIATEK[0m) += mediatek
machine-$([31mCONFIG_ARCH_MILBEAUT[0m) += milbeaut
machine-$([31mCONFIG_ARCH_MXS[0m) += mxs
machine-$([31mCONFIG_ARCH_NOMADIK[0m) += nomadik
machine-$([31mCONFIG_ARCH_NPCM[0m) += npcm
machine-$([31mCONFIG_ARCH_NSPIRE[0m) += nspire
machine-$([31mCONFIG_ARCH_OXNAS[0m) += oxnas
machine-$([31mCONFIG_ARCH_OMAP1[0m) += omap1
machine-$([31mCONFIG_ARCH_OMAP2PLUS[0m) += omap2
machine-$([31mCONFIG_ARCH_ORION5X[0m) += orion5x
machine-$([31mCONFIG_ARCH_PICOXCELL[0m) += picoxcell
machine-$([31mCONFIG_ARCH_PXA[0m) += pxa
machine-$([31mCONFIG_ARCH_QCOM[0m) += qcom
machine-$([31mCONFIG_ARCH_RDA[0m) += rda
machine-$([31mCONFIG_ARCH_REALVIEW[0m) += realview
machine-$([31mCONFIG_ARCH_ROCKCHIP[0m) += rockchip
machine-$([31mCONFIG_ARCH_RPC[0m) += rpc
machine-$([31mCONFIG_ARCH_S3C24XX[0m) += s3c24xx
machine-$([31mCONFIG_ARCH_S3C64XX[0m) += s3c64xx
machine-$([31mCONFIG_ARCH_S5PV210[0m) += s5pv210
machine-$([31mCONFIG_ARCH_SA1100[0m) += sa1100
machine-$([31mCONFIG_ARCH_RENESAS[0m) += shmobile
machine-$([31mCONFIG_ARCH_SIRF[0m) += prima2
machine-$([31mCONFIG_ARCH_SOCFPGA[0m) += socfpga
machine-$([31mCONFIG_ARCH_STI[0m) += sti
machine-$([31mCONFIG_ARCH_STM32[0m) += stm32
machine-$([31mCONFIG_ARCH_SUNXI[0m) += sunxi
machine-$([31mCONFIG_ARCH_TANGO[0m) += tango
machine-$([31mCONFIG_ARCH_TEGRA[0m) += tegra
machine-$([31mCONFIG_ARCH_U300[0m) += u300
machine-$([31mCONFIG_ARCH_U8500[0m) += ux500
machine-$([31mCONFIG_ARCH_VERSATILE[0m) += versatile
machine-$([31mCONFIG_ARCH_VEXPRESS[0m) += vexpress
machine-$([31mCONFIG_ARCH_VT8500[0m) += vt8500
machine-$([31mCONFIG_ARCH_ZX[0m) += zx
machine-$([31mCONFIG_ARCH_ZYNQ[0m) += zynq
machine-$([31mCONFIG_PLAT_SPEAR[0m) += spear
# Platform directory name. This list is sorted alphanumerically
# by CONFIG_* macro name.
plat-$([31mCONFIG_ARCH_EXYNOS[0m) += samsung
plat-$([31mCONFIG_ARCH_OMAP[0m) += omap
plat-$([31mCONFIG_ARCH_S3C64XX[0m) += samsung
plat-$([31mCONFIG_ARCH_S5PV210[0m) += samsung
plat-$([31mCONFIG_PLAT_ORION[0m) += orion
plat-$([31mCONFIG_PLAT_PXA[0m) += pxa
plat-$([31mCONFIG_PLAT_S3C24XX[0m) += samsung
plat-$([31mCONFIG_PLAT_VERSATILE[0m) += versatile
ifeq ($([31mCONFIG_ARCH_EBSA110[0m),y)
# This is what happens if you forget the IOCS16 line.
# PCMCIA cards stop working.
CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
export CFLAGS_3c589_cs.o
endif
# The byte offset of the kernel image in RAM from the start of RAM.
TEXT_OFFSET := $(textofs-y)
# The first directory contains additional information for the boot setup code
ifneq ($(machine-y),)
MACHINE := arch/arm/mach-$(word 1,$(machine-y))/
else
MACHINE :=
endif
ifeq ($([31mCONFIG_ARCH_MULTIPLATFORM[0m),y)
MACHINE :=
endif
machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y)))
ifneq ($([31mCONFIG_ARCH_MULTIPLATFORM[0m),y)
ifneq ($([31mCONFIG_ARM_SINGLE_ARMV7M[0m),y)
KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
endif
endif
export TEXT_OFFSET GZFLAGS MMUEXT
core-$([31mCONFIG_FPE_NWFPE[0m) += arch/arm/nwfpe/
# Put arch/arm/fastfpe/ to use this.
core-$([31mCONFIG_FPE_FASTFPE[0m) += $(patsubst $(srctree)/%,%,$(wildcard $(srctree)/arch/arm/fastfpe/))
core-$([31mCONFIG_VFP[0m) += arch/arm/vfp/
core-$([31mCONFIG_XEN[0m) += arch/arm/xen/
core-$([31mCONFIG_KVM_ARM_HOST[0m) += arch/arm/kvm/
core-$([31mCONFIG_VDSO[0m) += arch/arm/vdso/
# If we have a machine-specific directory, then include it in the build.
core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
core-y += arch/arm/probes/
core-y += arch/arm/net/
core-y += arch/arm/crypto/
core-y += $(machdirs) $(platdirs)
# For cleaning
core- += $(patsubst %,arch/arm/mach-%/, $(machine-))
core- += $(patsubst %,arch/arm/plat-%/, $(plat-))
drivers-$([31mCONFIG_OPROFILE[0m) += arch/arm/oprofile/
libs-y := arch/arm/lib/ $(libs-y)
# Default target when executing plain make
boot := arch/arm/boot
ifeq ($([31mCONFIG_XIP_KERNEL[0m),y)
KBUILD_IMAGE := $(boot)/xipImage
else
KBUILD_IMAGE := $(boot)/zImage
endif
ifeq ($([31mCONFIG_STACKPROTECTOR_PER_TASK[0m),y)
prepare: stack_protector_prepare
stack_protector_prepare: prepare0
$(eval KBUILD_CFLAGS += \
-fplugin-arg-arm_ssp_per_task_plugin-tso=$(shell \
awk '{if ($$2 == "THREAD_SZ_ORDER") print $$3;}'\
include/generated/asm-offsets.h) \
-fplugin-arg-arm_ssp_per_task_plugin-offset=$(shell \
awk '{if ($$2 == "TI_STACK_CANARY") print $$3;}'\
include/generated/asm-offsets.h))
endif
all: $(notdir $(KBUILD_IMAGE))
archheaders:
$(Q)$(MAKE) $(build)=arch/arm/tools uapi
archprepare:
$(Q)$(MAKE) $(build)=arch/arm/tools kapi
# Convert bzImage to zImage
bzImage: zImage
BOOT_TARGETS = zImage Image xipImage bootpImage uImage
INSTALL_TARGETS = zinstall uinstall install
PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
bootpImage uImage: zImage
zImage: Image
$(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
@$(kecho) ' Kernel: $(boot)/$@ is ready'
$(INSTALL_TARGETS):
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
PHONY += vdso_install
vdso_install:
ifeq ($([31mCONFIG_VDSO[0m),y)
$(Q)$(MAKE) $(build)=arch/arm/vdso $@
endif
# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
$(Q)$(MAKE) $(clean)=$(boot)
# My testing targets (bypasses dependencies)
bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
echo '* xipImage - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
echo ' uImage - U-Boot wrapped zImage'
echo ' bootpImage - Combined zImage and initial RAM disk'
echo ' (supply initrd image via make variable INITRD=<path>)'
echo ' install - Install uncompressed kernel'
echo ' zinstall - Install compressed kernel'
echo ' uinstall - Install U-Boot wrapped compressed kernel'
echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
echo ' install to $$(INSTALL_PATH) and run lilo'
echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso'
endef