Back to home page

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 # Ensure linker flags are correct
0014 LDFLAGS         :=
0015 
0016 LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
0017 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
0018 LDFLAGS_vmlinux += --be8
0019 LDFLAGS_MODULE  += --be8
0020 endif
0021 
0022 ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
0023 LDFLAGS_MODULE  += -T $(srctree)/arch/arm/kernel/module.lds
0024 endif
0025 
0026 GZFLAGS         :=-9
0027 #KBUILD_CFLAGS  +=-pipe
0028 
0029 # Never generate .eh_frame
0030 KBUILD_CFLAGS   += $(call cc-option,-fno-dwarf2-cfi-asm)
0031 
0032 # This should work on most of the modern platforms
0033 KBUILD_DEFCONFIG := multi_v7_defconfig
0034 
0035 # defines filename extension depending memory management type.
0036 ifeq ($(CONFIG_MMU),)
0037 MMUEXT          := -nommu
0038 KBUILD_CFLAGS   += $(call cc-option,-mno-unaligned-access)
0039 endif
0040 
0041 ifeq ($(CONFIG_FRAME_POINTER),y)
0042 KBUILD_CFLAGS   +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
0043 endif
0044 
0045 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
0046 KBUILD_CPPFLAGS += -mbig-endian
0047 AS              += -EB
0048 LD              += -EB
0049 else
0050 KBUILD_CPPFLAGS += -mlittle-endian
0051 AS              += -EL
0052 LD              += -EL
0053 endif
0054 
0055 #
0056 # The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
0057 # later may result in code being generated that handles signed short and signed
0058 # char struct members incorrectly. So disable it.
0059 # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
0060 #
0061 KBUILD_CFLAGS   += $(call cc-option,-fno-ipa-sra)
0062 
0063 # This selects which instruction set is used.
0064 # Note that GCC does not numerically define an architecture version
0065 # macro, but instead defines a whole series of macros which makes
0066 # testing for a specific architecture or later rather impossible.
0067 arch-$(CONFIG_CPU_32v7M)        =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m
0068 arch-$(CONFIG_CPU_32v7)         =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
0069 arch-$(CONFIG_CPU_32v6)         =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
0070 # Only override the compiler option if ARMv6. The ARMv6K extensions are
0071 # always available in ARMv7
0072 ifeq ($(CONFIG_CPU_32v6),y)
0073 arch-$(CONFIG_CPU_32v6K)        =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
0074 endif
0075 arch-$(CONFIG_CPU_32v5)         =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
0076 arch-$(CONFIG_CPU_32v4T)        =-D__LINUX_ARM_ARCH__=4 -march=armv4t
0077 arch-$(CONFIG_CPU_32v4)         =-D__LINUX_ARM_ARCH__=4 -march=armv4
0078 arch-$(CONFIG_CPU_32v3)         =-D__LINUX_ARM_ARCH__=3 -march=armv3
0079 
0080 # Evaluate arch cc-option calls now
0081 arch-y := $(arch-y)
0082 
0083 # This selects how we optimise for the processor.
0084 tune-$(CONFIG_CPU_ARM7TDMI)     =-mtune=arm7tdmi
0085 tune-$(CONFIG_CPU_ARM720T)      =-mtune=arm7tdmi
0086 tune-$(CONFIG_CPU_ARM740T)      =-mtune=arm7tdmi
0087 tune-$(CONFIG_CPU_ARM9TDMI)     =-mtune=arm9tdmi
0088 tune-$(CONFIG_CPU_ARM940T)      =-mtune=arm9tdmi
0089 tune-$(CONFIG_CPU_ARM946E)      =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
0090 tune-$(CONFIG_CPU_ARM920T)      =-mtune=arm9tdmi
0091 tune-$(CONFIG_CPU_ARM922T)      =-mtune=arm9tdmi
0092 tune-$(CONFIG_CPU_ARM925T)      =-mtune=arm9tdmi
0093 tune-$(CONFIG_CPU_ARM926T)      =-mtune=arm9tdmi
0094 tune-$(CONFIG_CPU_FA526)        =-mtune=arm9tdmi
0095 tune-$(CONFIG_CPU_SA110)        =-mtune=strongarm110
0096 tune-$(CONFIG_CPU_SA1100)       =-mtune=strongarm1100
0097 tune-$(CONFIG_CPU_XSCALE)       =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
0098 tune-$(CONFIG_CPU_XSC3)         =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
0099 tune-$(CONFIG_CPU_FEROCEON)     =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
0100 tune-$(CONFIG_CPU_V6)           =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
0101 tune-$(CONFIG_CPU_V6K)          =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
0102 
0103 # Evaluate tune cc-option calls now
0104 tune-y := $(tune-y)
0105 
0106 ifeq ($(CONFIG_AEABI),y)
0107 CFLAGS_ABI      :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
0108 else
0109 CFLAGS_ABI      :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
0110 endif
0111 
0112 ifeq ($(CONFIG_ARM_UNWIND),y)
0113 CFLAGS_ABI      +=-funwind-tables
0114 endif
0115 
0116 ifeq ($(CONFIG_THUMB2_KERNEL),y)
0117 AFLAGS_AUTOIT   :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
0118 AFLAGS_NOWARN   :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
0119 CFLAGS_ISA      :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
0120 AFLAGS_ISA      :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
0121 # Work around buggy relocation from gas if requested:
0122 ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
0123 CFLAGS_MODULE   +=-fno-optimize-sibling-calls
0124 endif
0125 else
0126 CFLAGS_ISA      :=$(call cc-option,-marm,)
0127 AFLAGS_ISA      :=$(CFLAGS_ISA)
0128 endif
0129 
0130 # Need -Uarm for gcc < 3.x
0131 KBUILD_CFLAGS   +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
0132 KBUILD_AFLAGS   +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float 
0133 
0134 CHECKFLAGS      += -D__arm__
0135 
0136 #Default value
0137 head-y          := arch/arm/kernel/head$(MMUEXT).o
0138 
0139 # Text offset. This list is sorted numerically by address in order to
0140 # provide a means to avoid/resolve conflicts in multi-arch kernels.
0141 textofs-y       := 0x00008000
0142 # We don't want the htc bootloader to corrupt kernel during resume
0143 textofs-$(CONFIG_PM_H1940)      := 0x00108000
0144 # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
0145 ifeq ($(CONFIG_ARCH_SA1100),y)
0146 textofs-$(CONFIG_SA1111) := 0x00208000
0147 endif
0148 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
0149 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
0150 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
0151 
0152 # Machine directory name.  This list is sorted alphanumerically
0153 # by CONFIG_* macro name.
0154 machine-$(CONFIG_ARCH_ALPINE)           += alpine
0155 machine-$(CONFIG_ARCH_ARTPEC)           += artpec
0156 machine-$(CONFIG_ARCH_AT91)             += at91
0157 machine-$(CONFIG_ARCH_AXXIA)            += axxia
0158 machine-$(CONFIG_ARCH_BCM)              += bcm
0159 machine-$(CONFIG_ARCH_BERLIN)           += berlin
0160 machine-$(CONFIG_ARCH_CLPS711X)         += clps711x
0161 machine-$(CONFIG_ARCH_CNS3XXX)          += cns3xxx
0162 machine-$(CONFIG_ARCH_DAVINCI)          += davinci
0163 machine-$(CONFIG_ARCH_DIGICOLOR)        += digicolor
0164 machine-$(CONFIG_ARCH_DOVE)             += dove
0165 machine-$(CONFIG_ARCH_EBSA110)          += ebsa110
0166 machine-$(CONFIG_ARCH_EFM32)            += efm32
0167 machine-$(CONFIG_ARCH_EP93XX)           += ep93xx
0168 machine-$(CONFIG_ARCH_EXYNOS)           += exynos
0169 machine-$(CONFIG_ARCH_FOOTBRIDGE)       += footbridge
0170 machine-$(CONFIG_ARCH_GEMINI)           += gemini
0171 machine-$(CONFIG_ARCH_HIGHBANK)         += highbank
0172 machine-$(CONFIG_ARCH_HISI)             += hisi
0173 machine-$(CONFIG_ARCH_INTEGRATOR)       += integrator
0174 machine-$(CONFIG_ARCH_IOP13XX)          += iop13xx
0175 machine-$(CONFIG_ARCH_IOP32X)           += iop32x
0176 machine-$(CONFIG_ARCH_IOP33X)           += iop33x
0177 machine-$(CONFIG_ARCH_IXP4XX)           += ixp4xx
0178 machine-$(CONFIG_ARCH_KEYSTONE)         += keystone
0179 machine-$(CONFIG_ARCH_KS8695)           += ks8695
0180 machine-$(CONFIG_ARCH_LPC18XX)          += lpc18xx
0181 machine-$(CONFIG_ARCH_LPC32XX)          += lpc32xx
0182 machine-$(CONFIG_ARCH_MESON)            += meson
0183 machine-$(CONFIG_ARCH_MMP)              += mmp
0184 machine-$(CONFIG_ARCH_MPS2)             += vexpress
0185 machine-$(CONFIG_ARCH_MOXART)           += moxart
0186 machine-$(CONFIG_ARCH_MV78XX0)          += mv78xx0
0187 machine-$(CONFIG_ARCH_MVEBU)            += mvebu
0188 machine-$(CONFIG_ARCH_MXC)              += imx
0189 machine-$(CONFIG_ARCH_MEDIATEK)         += mediatek
0190 machine-$(CONFIG_ARCH_MXS)              += mxs
0191 machine-$(CONFIG_ARCH_NETX)             += netx
0192 machine-$(CONFIG_ARCH_NOMADIK)          += nomadik
0193 machine-$(CONFIG_ARCH_NSPIRE)           += nspire
0194 machine-$(CONFIG_ARCH_OXNAS)            += oxnas
0195 machine-$(CONFIG_ARCH_OMAP1)            += omap1
0196 machine-$(CONFIG_ARCH_OMAP2PLUS)        += omap2
0197 machine-$(CONFIG_ARCH_ORION5X)          += orion5x
0198 machine-$(CONFIG_ARCH_PICOXCELL)        += picoxcell
0199 machine-$(CONFIG_ARCH_PXA)              += pxa
0200 machine-$(CONFIG_ARCH_QCOM)             += qcom
0201 machine-$(CONFIG_ARCH_REALVIEW)         += realview
0202 machine-$(CONFIG_ARCH_ROCKCHIP)         += rockchip
0203 machine-$(CONFIG_ARCH_RPC)              += rpc
0204 machine-$(CONFIG_ARCH_S3C24XX)          += s3c24xx
0205 machine-$(CONFIG_ARCH_S3C64XX)          += s3c64xx
0206 machine-$(CONFIG_ARCH_S5PV210)          += s5pv210
0207 machine-$(CONFIG_ARCH_SA1100)           += sa1100
0208 machine-$(CONFIG_ARCH_SHMOBILE)         += shmobile
0209 machine-$(CONFIG_ARCH_SIRF)             += prima2
0210 machine-$(CONFIG_ARCH_SOCFPGA)          += socfpga
0211 machine-$(CONFIG_ARCH_STI)              += sti
0212 machine-$(CONFIG_ARCH_STM32)            += stm32
0213 machine-$(CONFIG_ARCH_SUNXI)            += sunxi
0214 machine-$(CONFIG_ARCH_TANGO)            += tango
0215 machine-$(CONFIG_ARCH_TEGRA)            += tegra
0216 machine-$(CONFIG_ARCH_U300)             += u300
0217 machine-$(CONFIG_ARCH_U8500)            += ux500
0218 machine-$(CONFIG_ARCH_UNIPHIER)         += uniphier
0219 machine-$(CONFIG_ARCH_VERSATILE)        += versatile
0220 machine-$(CONFIG_ARCH_VEXPRESS)         += vexpress
0221 machine-$(CONFIG_ARCH_VT8500)           += vt8500
0222 machine-$(CONFIG_ARCH_W90X900)          += w90x900
0223 machine-$(CONFIG_ARCH_ZX)               += zx
0224 machine-$(CONFIG_ARCH_ZYNQ)             += zynq
0225 machine-$(CONFIG_PLAT_SPEAR)            += spear
0226 
0227 # Platform directory name.  This list is sorted alphanumerically
0228 # by CONFIG_* macro name.
0229 plat-$(CONFIG_ARCH_EXYNOS)      += samsung
0230 plat-$(CONFIG_ARCH_OMAP)        += omap
0231 plat-$(CONFIG_ARCH_S3C64XX)     += samsung
0232 plat-$(CONFIG_ARCH_S5PV210)     += samsung
0233 plat-$(CONFIG_PLAT_IOP)         += iop
0234 plat-$(CONFIG_PLAT_ORION)       += orion
0235 plat-$(CONFIG_PLAT_PXA)         += pxa
0236 plat-$(CONFIG_PLAT_S3C24XX)     += samsung
0237 plat-$(CONFIG_PLAT_VERSATILE)   += versatile
0238 
0239 ifeq ($(CONFIG_ARCH_EBSA110),y)
0240 # This is what happens if you forget the IOCS16 line.
0241 # PCMCIA cards stop working.
0242 CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
0243 export CFLAGS_3c589_cs.o
0244 endif
0245 
0246 # The byte offset of the kernel image in RAM from the start of RAM.
0247 TEXT_OFFSET := $(textofs-y)
0248 
0249 # The first directory contains additional information for the boot setup code
0250 ifneq ($(machine-y),)
0251 MACHINE  := arch/arm/mach-$(word 1,$(machine-y))/
0252 else
0253 MACHINE  :=
0254 endif
0255 ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
0256 MACHINE  :=
0257 endif
0258 
0259 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
0260 platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y)))
0261 
0262 ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
0263 ifneq ($(CONFIG_ARM_SINGLE_ARMV7M),y)
0264 ifeq ($(KBUILD_SRC),)
0265 KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
0266 else
0267 KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
0268 endif
0269 endif
0270 endif
0271 
0272 export  TEXT_OFFSET GZFLAGS MMUEXT
0273 
0274 # Do we have FASTFPE?
0275 FASTFPE         :=arch/arm/fastfpe
0276 ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
0277 FASTFPE_OBJ     :=$(FASTFPE)/
0278 endif
0279 
0280 core-$(CONFIG_FPE_NWFPE)        += arch/arm/nwfpe/
0281 core-$(CONFIG_FPE_FASTFPE)      += $(FASTFPE_OBJ)
0282 core-$(CONFIG_VFP)              += arch/arm/vfp/
0283 core-$(CONFIG_XEN)              += arch/arm/xen/
0284 core-$(CONFIG_KVM_ARM_HOST)     += arch/arm/kvm/
0285 core-$(CONFIG_VDSO)             += arch/arm/vdso/
0286 
0287 # If we have a machine-specific directory, then include it in the build.
0288 core-y                          += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
0289 core-y                          += arch/arm/probes/
0290 core-y                          += arch/arm/net/
0291 core-y                          += arch/arm/crypto/
0292 core-y                          += arch/arm/firmware/
0293 core-y                          += $(machdirs) $(platdirs)
0294 
0295 drivers-$(CONFIG_OPROFILE)      += arch/arm/oprofile/
0296 
0297 libs-y                          := arch/arm/lib/ $(libs-y)
0298 
0299 # Default target when executing plain make
0300 ifeq ($(CONFIG_XIP_KERNEL),y)
0301 KBUILD_IMAGE := xipImage
0302 else
0303 KBUILD_IMAGE := zImage
0304 endif
0305 
0306 # Build the DT binary blobs if we have OF configured
0307 ifeq ($(CONFIG_USE_OF),y)
0308 KBUILD_DTBS := dtbs
0309 endif
0310 
0311 all:    $(KBUILD_IMAGE) $(KBUILD_DTBS)
0312 
0313 boot := arch/arm/boot
0314 
0315 archheaders:
0316         $(Q)$(MAKE) $(build)=arch/arm/tools uapi
0317 
0318 archprepare:
0319         $(Q)$(MAKE) $(build)=arch/arm/tools kapi
0320 
0321 # Convert bzImage to zImage
0322 bzImage: zImage
0323 
0324 BOOT_TARGETS    = zImage Image xipImage bootpImage uImage
0325 INSTALL_TARGETS = zinstall uinstall install
0326 
0327 PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
0328 
0329 bootpImage uImage: zImage
0330 zImage: Image
0331 
0332 $(BOOT_TARGETS): vmlinux
0333         $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
0334         @$(kecho) '  Kernel: $(boot)/$@ is ready'
0335 
0336 $(INSTALL_TARGETS):
0337         $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
0338 
0339 %.dtb: | scripts
0340         $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
0341 
0342 PHONY += dtbs dtbs_install
0343 
0344 dtbs: prepare scripts
0345         $(Q)$(MAKE) $(build)=$(boot)/dts
0346 
0347 dtbs_install:
0348         $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
0349 
0350 PHONY += vdso_install
0351 vdso_install:
0352 ifeq ($(CONFIG_VDSO),y)
0353         $(Q)$(MAKE) $(build)=arch/arm/vdso $@
0354 endif
0355 
0356 # We use MRPROPER_FILES and CLEAN_FILES now
0357 archclean:
0358         $(Q)$(MAKE) $(clean)=$(boot)
0359 
0360 # My testing targets (bypasses dependencies)
0361 bp:;    $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
0362 
0363 
0364 define archhelp
0365   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
0366   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
0367   echo  '* xipImage      - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
0368   echo  '  uImage        - U-Boot wrapped zImage'
0369   echo  '  bootpImage    - Combined zImage and initial RAM disk'
0370   echo  '                  (supply initrd image via make variable INITRD=<path>)'
0371   echo  '* dtbs          - Build device tree blobs for enabled boards'
0372   echo  '  dtbs_install  - Install dtbs to $(INSTALL_DTBS_PATH)'
0373   echo  '  install       - Install uncompressed kernel'
0374   echo  '  zinstall      - Install compressed kernel'
0375   echo  '  uinstall      - Install U-Boot wrapped compressed kernel'
0376   echo  '                  Install using (your) ~/bin/$(INSTALLKERNEL) or'
0377   echo  '                  (distribution) /sbin/$(INSTALLKERNEL) or'
0378   echo  '                  install to $$(INSTALL_PATH) and run lilo'
0379   echo  '  vdso_install  - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso'
0380 endef