Back to home page

OSCL-LXR

 
 

    


0001 #
0002 # arch/arm/Makefile
0003 #
0004 # This file is included by the global makefile so that you can add your own
0005 # architecture-specific flags and dependencies.
0006 #
0007 # This file is subject to the terms and conditions of the GNU General Public
0008 # License.  See the file "COPYING" in the main directory of this archive
0009 # for more details.
0010 #
0011 # Copyright (C) 1995-2001 by Russell King
0012 
0013 LDFLAGS_vmlinux := --no-undefined -X --pic-veneer -z norelro
0014 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
0015 LDFLAGS_vmlinux += --be8
0016 KBUILD_LDFLAGS_MODULE   += --be8
0017 endif
0018 
0019 GZFLAGS         :=-9
0020 #KBUILD_CFLAGS  +=-pipe
0021 
0022 # Never generate .eh_frame
0023 KBUILD_CFLAGS   += $(call cc-option,-fno-dwarf2-cfi-asm)
0024 
0025 # This should work on most of the modern platforms
0026 KBUILD_DEFCONFIG := multi_v7_defconfig
0027 
0028 # defines filename extension depending memory management type.
0029 ifeq ($(CONFIG_MMU),)
0030 MMUEXT          := -nommu
0031 KBUILD_CFLAGS   += $(call cc-option,-mno-unaligned-access)
0032 endif
0033 
0034 ifeq ($(CONFIG_FRAME_POINTER),y)
0035 KBUILD_CFLAGS   +=-fno-omit-frame-pointer
0036 ifeq ($(CONFIG_CC_IS_GCC),y)
0037 KBUILD_CFLAGS += -mapcs -mno-sched-prolog
0038 endif
0039 endif
0040 
0041 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
0042 KBUILD_CPPFLAGS += -mbig-endian
0043 CHECKFLAGS      += -D__ARMEB__
0044 KBUILD_LDFLAGS  += -EB
0045 else
0046 KBUILD_CPPFLAGS += -mlittle-endian
0047 CHECKFLAGS      += -D__ARMEL__
0048 KBUILD_LDFLAGS  += -EL
0049 endif
0050 
0051 #
0052 # The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
0053 # later may result in code being generated that handles signed short and signed
0054 # char struct members incorrectly. So disable it.
0055 # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
0056 #
0057 KBUILD_CFLAGS   += $(call cc-option,-fno-ipa-sra)
0058 
0059 # This selects which instruction set is used.
0060 # Note that GCC does not numerically define an architecture version
0061 # macro, but instead defines a whole series of macros which makes
0062 # testing for a specific architecture or later rather impossible.
0063 arch-$(CONFIG_CPU_32v7M)        =-D__LINUX_ARM_ARCH__=7 -march=armv7-m
0064 arch-$(CONFIG_CPU_32v7)         =-D__LINUX_ARM_ARCH__=7 -march=armv7-a
0065 arch-$(CONFIG_CPU_32v6)         =-D__LINUX_ARM_ARCH__=6 -march=armv6
0066 # Only override the compiler option if ARMv6. The ARMv6K extensions are
0067 # always available in ARMv7
0068 ifeq ($(CONFIG_CPU_32v6),y)
0069 arch-$(CONFIG_CPU_32v6K)        =-D__LINUX_ARM_ARCH__=6 -march=armv6k
0070 endif
0071 arch-$(CONFIG_CPU_32v5)         =-D__LINUX_ARM_ARCH__=5 -march=armv5te
0072 arch-$(CONFIG_CPU_32v4T)        =-D__LINUX_ARM_ARCH__=4 -march=armv4t
0073 arch-$(CONFIG_CPU_32v4)         =-D__LINUX_ARM_ARCH__=4 -march=armv4
0074 arch-$(CONFIG_CPU_32v3)         =-D__LINUX_ARM_ARCH__=3 -march=armv3m
0075 
0076 # Evaluate arch cc-option calls now
0077 arch-y := $(arch-y)
0078 
0079 # This selects how we optimise for the processor.
0080 tune-$(CONFIG_CPU_ARM7TDMI)     =-mtune=arm7tdmi
0081 tune-$(CONFIG_CPU_ARM720T)      =-mtune=arm7tdmi
0082 tune-$(CONFIG_CPU_ARM740T)      =-mtune=arm7tdmi
0083 tune-$(CONFIG_CPU_ARM9TDMI)     =-mtune=arm9tdmi
0084 tune-$(CONFIG_CPU_ARM940T)      =-mtune=arm9tdmi
0085 tune-$(CONFIG_CPU_ARM946E)      =-mtune=arm9e
0086 tune-$(CONFIG_CPU_ARM920T)      =-mtune=arm9tdmi
0087 tune-$(CONFIG_CPU_ARM922T)      =-mtune=arm9tdmi
0088 tune-$(CONFIG_CPU_ARM925T)      =-mtune=arm9tdmi
0089 tune-$(CONFIG_CPU_ARM926T)      =-mtune=arm9tdmi
0090 tune-$(CONFIG_CPU_FA526)        =-mtune=arm9tdmi
0091 tune-$(CONFIG_CPU_SA110)        =-mtune=strongarm110
0092 tune-$(CONFIG_CPU_SA1100)       =-mtune=strongarm1100
0093 tune-$(CONFIG_CPU_XSCALE)       =-mtune=xscale
0094 tune-$(CONFIG_CPU_XSC3)         =-mtune=xscale
0095 tune-$(CONFIG_CPU_FEROCEON)     =-mtune=xscale
0096 tune-$(CONFIG_CPU_V6)           =-mtune=arm1136j-s
0097 tune-$(CONFIG_CPU_V6K)          =-mtune=arm1136j-s
0098 
0099 # Evaluate tune cc-option calls now
0100 tune-y := $(tune-y)
0101 
0102 ifeq ($(CONFIG_AEABI),y)
0103 CFLAGS_ABI      :=-mabi=aapcs-linux -mfpu=vfp
0104 else
0105 CFLAGS_ABI      :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
0106 endif
0107 
0108 ifeq ($(CONFIG_ARM_UNWIND),y)
0109 CFLAGS_ABI      +=-funwind-tables
0110 endif
0111 
0112 ifeq ($(CONFIG_CC_IS_CLANG),y)
0113 CFLAGS_ABI      += -meabi gnu
0114 endif
0115 
0116 ifeq ($(CONFIG_CURRENT_POINTER_IN_TPIDRURO),y)
0117 CFLAGS_ABI      += -mtp=cp15
0118 endif
0119 
0120 # Accept old syntax despite ".syntax unified"
0121 AFLAGS_NOWARN   :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
0122 
0123 ifeq ($(CONFIG_THUMB2_KERNEL),y)
0124 CFLAGS_ISA      :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
0125 AFLAGS_ISA      :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
0126 else
0127 CFLAGS_ISA      :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
0128 AFLAGS_ISA      :=$(CFLAGS_ISA)
0129 endif
0130 
0131 # Need -Uarm for gcc < 3.x
0132 KBUILD_CFLAGS   +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
0133 KBUILD_AFLAGS   +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float 
0134 
0135 CHECKFLAGS      += -D__arm__
0136 
0137 #Default value
0138 head-y          := arch/arm/kernel/head$(MMUEXT).o
0139 
0140 # Text offset. This list is sorted numerically by address in order to
0141 # provide a means to avoid/resolve conflicts in multi-arch kernels.
0142 # Note: the 32kB below this value is reserved for use by the kernel
0143 # during boot, and this offset is critical to the functioning of
0144 # kexec-tools.
0145 textofs-y       := 0x00008000
0146 # We don't want the htc bootloader to corrupt kernel during resume
0147 textofs-$(CONFIG_PM_H1940)      := 0x00108000
0148 # RTD1195 has Boot ROM at start of address space
0149 textofs-$(CONFIG_ARCH_REALTEK)  := 0x00108000
0150 # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
0151 ifeq ($(CONFIG_ARCH_SA1100),y)
0152 textofs-$(CONFIG_SA1111) := 0x00208000
0153 endif
0154 textofs-$(CONFIG_ARCH_IPQ40XX) := 0x00208000
0155 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
0156 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
0157 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
0158 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
0159 
0160 # Machine directory name.  This list is sorted alphanumerically
0161 # by CONFIG_* macro name.
0162 machine-$(CONFIG_ARCH_ACTIONS)          += actions
0163 machine-$(CONFIG_ARCH_AIROHA)           += airoha
0164 machine-$(CONFIG_ARCH_ALPINE)           += alpine
0165 machine-$(CONFIG_ARCH_ARTPEC)           += artpec
0166 machine-$(CONFIG_ARCH_ASPEED)           += aspeed
0167 machine-$(CONFIG_ARCH_AT91)             += at91
0168 machine-$(CONFIG_ARCH_AXXIA)            += axxia
0169 machine-$(CONFIG_ARCH_BCM)              += bcm
0170 machine-$(CONFIG_ARCH_BERLIN)           += berlin
0171 machine-$(CONFIG_ARCH_CLPS711X)         += clps711x
0172 machine-$(CONFIG_ARCH_CNS3XXX)          += cns3xxx
0173 machine-$(CONFIG_ARCH_DAVINCI)          += davinci
0174 machine-$(CONFIG_ARCH_DIGICOLOR)        += digicolor
0175 machine-$(CONFIG_ARCH_DOVE)             += dove
0176 machine-$(CONFIG_ARCH_EP93XX)           += ep93xx
0177 machine-$(CONFIG_ARCH_EXYNOS)           += exynos
0178 machine-$(CONFIG_ARCH_FOOTBRIDGE)       += footbridge
0179 machine-$(CONFIG_ARCH_GEMINI)           += gemini
0180 machine-$(CONFIG_ARCH_HIGHBANK)         += highbank
0181 machine-$(CONFIG_ARCH_HISI)             += hisi
0182 machine-$(CONFIG_ARCH_HPE)              += hpe
0183 machine-$(CONFIG_ARCH_IOP32X)           += iop32x
0184 machine-$(CONFIG_ARCH_IXP4XX)           += ixp4xx
0185 machine-$(CONFIG_ARCH_KEYSTONE)         += keystone
0186 machine-$(CONFIG_ARCH_LPC18XX)          += lpc18xx
0187 machine-$(CONFIG_ARCH_LPC32XX)          += lpc32xx
0188 machine-$(CONFIG_ARCH_MESON)            += meson
0189 machine-$(CONFIG_ARCH_MMP)              += mmp
0190 machine-$(CONFIG_ARCH_MOXART)           += moxart
0191 machine-$(CONFIG_ARCH_MV78XX0)          += mv78xx0
0192 machine-$(CONFIG_ARCH_MVEBU)            += mvebu
0193 machine-$(CONFIG_ARCH_MXC)              += imx
0194 machine-$(CONFIG_ARCH_MEDIATEK)         += mediatek
0195 machine-$(CONFIG_ARCH_MILBEAUT)         += milbeaut
0196 machine-$(CONFIG_ARCH_MXS)              += mxs
0197 machine-$(CONFIG_ARCH_MSTARV7)          += mstar
0198 machine-$(CONFIG_ARCH_NOMADIK)          += nomadik
0199 machine-$(CONFIG_ARCH_NPCM)             += npcm
0200 machine-$(CONFIG_ARCH_NSPIRE)           += nspire
0201 machine-$(CONFIG_ARCH_OXNAS)            += oxnas
0202 machine-$(CONFIG_ARCH_OMAP1)            += omap1
0203 machine-$(CONFIG_ARCH_OMAP2PLUS)        += omap2
0204 machine-$(CONFIG_ARCH_ORION5X)          += orion5x
0205 machine-$(CONFIG_ARCH_PXA)              += pxa
0206 machine-$(CONFIG_ARCH_QCOM)             += qcom
0207 machine-$(CONFIG_ARCH_RDA)              += rda
0208 machine-$(CONFIG_ARCH_REALTEK)          += realtek
0209 machine-$(CONFIG_ARCH_ROCKCHIP)         += rockchip
0210 machine-$(CONFIG_ARCH_RPC)              += rpc
0211 machine-$(CONFIG_PLAT_SAMSUNG)          += s3c
0212 machine-$(CONFIG_ARCH_S5PV210)          += s5pv210
0213 machine-$(CONFIG_ARCH_SA1100)           += sa1100
0214 machine-$(CONFIG_ARCH_RENESAS)          += shmobile
0215 machine-$(CONFIG_ARCH_INTEL_SOCFPGA)    += socfpga
0216 machine-$(CONFIG_ARCH_STI)              += sti
0217 machine-$(CONFIG_ARCH_STM32)            += stm32
0218 machine-$(CONFIG_ARCH_SUNPLUS)          += sunplus
0219 machine-$(CONFIG_ARCH_SUNXI)            += sunxi
0220 machine-$(CONFIG_ARCH_TEGRA)            += tegra
0221 machine-$(CONFIG_ARCH_U8500)            += ux500
0222 machine-$(CONFIG_ARCH_VT8500)           += vt8500
0223 machine-$(CONFIG_ARCH_ZYNQ)             += zynq
0224 machine-$(CONFIG_PLAT_VERSATILE)        += versatile
0225 machine-$(CONFIG_PLAT_SPEAR)            += spear
0226 
0227 # Platform directory name.  This list is sorted alphanumerically
0228 # by CONFIG_* macro name.
0229 plat-$(CONFIG_PLAT_ORION)       += orion
0230 
0231 # The byte offset of the kernel image in RAM from the start of RAM.
0232 TEXT_OFFSET := $(textofs-y)
0233 
0234 # The first directory contains additional information for the boot setup code
0235 ifneq ($(machine-y),)
0236 MACHINE  := arch/arm/mach-$(word 1,$(machine-y))/
0237 else
0238 MACHINE  :=
0239 endif
0240 ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
0241 MACHINE  :=
0242 endif
0243 
0244 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
0245 platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y)))
0246 
0247 ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
0248 ifneq ($(CONFIG_ARM_SINGLE_ARMV7M),y)
0249 KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
0250 endif
0251 endif
0252 
0253 export  TEXT_OFFSET GZFLAGS MMUEXT
0254 
0255 # If we have a machine-specific directory, then include it in the build.
0256 core-y                          += $(machdirs) $(platdirs)
0257 
0258 # For cleaning
0259 core-                           += $(patsubst %,arch/arm/mach-%/, $(machine-))
0260 core-                           += $(patsubst %,arch/arm/plat-%/, $(plat-))
0261 
0262 libs-y                          := arch/arm/lib/ $(libs-y)
0263 
0264 # Default target when executing plain make
0265 boot := arch/arm/boot
0266 ifeq ($(CONFIG_XIP_KERNEL),y)
0267 KBUILD_IMAGE := $(boot)/xipImage
0268 else
0269 KBUILD_IMAGE := $(boot)/zImage
0270 endif
0271 
0272 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y)
0273 prepare: stack_protector_prepare
0274 ifeq ($(CONFIG_CC_HAVE_STACKPROTECTOR_TLS),y)
0275 stack_protector_prepare: prepare0
0276         $(eval KBUILD_CFLAGS += \
0277                 -mstack-protector-guard=tls \
0278                 -mstack-protector-guard-offset=$(shell  \
0279                         awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}'\
0280                                 include/generated/asm-offsets.h))
0281 else
0282 stack_protector_prepare: prepare0
0283         $(eval SSP_PLUGIN_CFLAGS := \
0284                 -fplugin-arg-arm_ssp_per_task_plugin-offset=$(shell     \
0285                         awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}'\
0286                                 include/generated/asm-offsets.h))
0287         $(eval KBUILD_CFLAGS += $(SSP_PLUGIN_CFLAGS))
0288         $(eval GCC_PLUGINS_CFLAGS += $(SSP_PLUGIN_CFLAGS))
0289 endif
0290 endif
0291 
0292 all:    $(notdir $(KBUILD_IMAGE))
0293 
0294 
0295 archheaders:
0296         $(Q)$(MAKE) $(build)=arch/arm/tools uapi
0297 
0298 archprepare:
0299         $(Q)$(MAKE) $(build)=arch/arm/tools kapi
0300 
0301 # Convert bzImage to zImage
0302 bzImage: zImage
0303 
0304 BOOT_TARGETS    = zImage Image xipImage bootpImage uImage
0305 INSTALL_TARGETS = zinstall uinstall install
0306 
0307 PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
0308 
0309 bootpImage uImage: zImage
0310 zImage: Image
0311 
0312 $(BOOT_TARGETS): vmlinux
0313         $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
0314         @$(kecho) '  Kernel: $(boot)/$@ is ready'
0315 
0316 $(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@)
0317 $(INSTALL_TARGETS):
0318         $(call cmd,install)
0319 
0320 PHONY += vdso_install
0321 vdso_install:
0322 ifeq ($(CONFIG_VDSO),y)
0323         $(Q)$(MAKE) $(build)=arch/arm/vdso $@
0324 endif
0325 
0326 # My testing targets (bypasses dependencies)
0327 bp:;    $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
0328 
0329 
0330 define archhelp
0331   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
0332   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
0333   echo  '* xipImage      - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
0334   echo  '  uImage        - U-Boot wrapped zImage'
0335   echo  '  bootpImage    - Combined zImage and initial RAM disk'
0336   echo  '                  (supply initrd image via make variable INITRD=<path>)'
0337   echo  '  install       - Install uncompressed kernel'
0338   echo  '  zinstall      - Install compressed kernel'
0339   echo  '  uinstall      - Install U-Boot wrapped compressed kernel'
0340   echo  '                  Install using (your) ~/bin/$(INSTALLKERNEL) or'
0341   echo  '                  (distribution) /sbin/$(INSTALLKERNEL) or'
0342   echo  '                  install to $$(INSTALL_PATH) and run lilo'
0343   echo  '  vdso_install  - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso'
0344 endef