Makefile 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. #
  2. # arch/arm/Makefile
  3. #
  4. # This file is included by the global makefile so that you can add your own
  5. # architecture-specific flags and dependencies.
  6. #
  7. # This file is subject to the terms and conditions of the GNU General Public
  8. # License. See the file "COPYING" in the main directory of this archive
  9. # for more details.
  10. #
  11. # Copyright (C) 1995-2001 by Russell King
  12. LDFLAGS_vmlinux :=-p --no-undefined -X
  13. ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
  14. LDFLAGS_vmlinux += --be8
  15. endif
  16. OBJCOPYFLAGS :=-O binary -R .comment -S
  17. GZFLAGS :=-9
  18. #KBUILD_CFLAGS +=-pipe
  19. # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
  20. KBUILD_CFLAGS +=$(call cc-option,-marm,)
  21. # Never generate .eh_frame
  22. KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
  23. # Do not use arch/arm/defconfig - it's always outdated.
  24. # Select a platform tht is kept up-to-date
  25. KBUILD_DEFCONFIG := versatile_defconfig
  26. # defines filename extension depending memory management type.
  27. ifeq ($(CONFIG_MMU),)
  28. MMUEXT := -nommu
  29. endif
  30. ifeq ($(CONFIG_FRAME_POINTER),y)
  31. KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
  32. endif
  33. ifeq ($(CONFIG_CC_STACKPROTECTOR),y)
  34. KBUILD_CFLAGS +=-fstack-protector
  35. endif
  36. ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
  37. KBUILD_CPPFLAGS += -mbig-endian
  38. AS += -EB
  39. LD += -EB
  40. else
  41. KBUILD_CPPFLAGS += -mlittle-endian
  42. AS += -EL
  43. LD += -EL
  44. endif
  45. comma = ,
  46. #
  47. # The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and
  48. # later may result in code being generated that handles signed short and signed
  49. # char struct members incorrectly. So disable it.
  50. # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932)
  51. #
  52. KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra)
  53. # This selects which instruction set is used.
  54. # Note that GCC does not numerically define an architecture version
  55. # macro, but instead defines a whole series of macros which makes
  56. # testing for a specific architecture or later rather impossible.
  57. arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
  58. arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
  59. # Only override the compiler option if ARMv6. The ARMv6K extensions are
  60. # always available in ARMv7
  61. ifeq ($(CONFIG_CPU_32v6),y)
  62. arch-$(CONFIG_CPU_32v6K) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
  63. endif
  64. arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
  65. arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t
  66. arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
  67. arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
  68. # Since 'cortex-a15' is a superset of the 'armv7-a' arch spec, we need to
  69. # explicitly redefine the arch options to not include '-march=armv7-a' when
  70. # generating code for Krait, which is compatible with the instruction set of the
  71. # Cortex-A15, because GCC will warn us about ambiguous ISA restrictions caused
  72. # by seemingly conflicting -march and -mcpu options.
  73. # If $(CC) does not support the -mcpu=cortex-a15 option, fall back on passing
  74. # -march=armv7-a to specify the ISA restriction, though this is suboptimal. To
  75. # keep things simpler, we don't bother with a fallback option if the compiler
  76. # doesn't even support -march=armv7-a, since in that situation we would have
  77. # bigger problems.
  78. arch-$(CONFIG_ARCH_MSM_KRAIT) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-mcpu=cortex-a15,-march=armv7-a)
  79. arch-$(CONFIG_MSM_CORTEX_A7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-mcpu=cortex-a15,-march=armv7-a)
  80. # This selects how we optimise for the processor.
  81. tune-$(CONFIG_CPU_ARM610) :=-mtune=arm610
  82. tune-$(CONFIG_CPU_ARM710) :=-mtune=arm710
  83. tune-$(CONFIG_CPU_ARM7TDMI) :=-mtune=arm7tdmi
  84. tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi
  85. tune-$(CONFIG_CPU_ARM740T) :=-mtune=arm7tdmi
  86. tune-$(CONFIG_CPU_ARM9TDMI) :=-mtune=arm9tdmi
  87. tune-$(CONFIG_CPU_ARM940T) :=-mtune=arm9tdmi
  88. tune-$(CONFIG_CPU_ARM946E) :=$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
  89. tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi
  90. tune-$(CONFIG_CPU_ARM922T) :=-mtune=arm9tdmi
  91. tune-$(CONFIG_CPU_ARM925T) :=-mtune=arm9tdmi
  92. tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
  93. tune-$(CONFIG_CPU_FA526) :=-mtune=arm9tdmi
  94. tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
  95. tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
  96. tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
  97. tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
  98. tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
  99. tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
  100. tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
  101. ifeq ($(CONFIG_AEABI),y)
  102. CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
  103. else
  104. CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
  105. endif
  106. ifeq ($(CONFIG_ARM_UNWIND),y)
  107. CFLAGS_ABI +=-funwind-tables
  108. endif
  109. ifeq ($(CONFIG_THUMB2_KERNEL),y)
  110. AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
  111. AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
  112. CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
  113. AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
  114. # Work around buggy relocation from gas if requested:
  115. ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
  116. CFLAGS_MODULE +=-fno-optimize-sibling-calls
  117. endif
  118. endif
  119. # Need -Uarm for gcc < 3.x
  120. KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
  121. KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
  122. CHECKFLAGS += -D__arm__
  123. #Default value
  124. head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o
  125. textofs-y := 0x00008000
  126. textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
  127. # We don't want the htc bootloader to corrupt kernel during resume
  128. textofs-$(CONFIG_PM_H1940) := 0x00108000
  129. # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
  130. ifeq ($(CONFIG_ARCH_SA1100),y)
  131. textofs-$(CONFIG_SA1111) := 0x00208000
  132. endif
  133. # Machine directory name. This list is sorted alphanumerically
  134. # by CONFIG_* macro name.
  135. machine-$(CONFIG_ARCH_AT91) := at91
  136. machine-$(CONFIG_ARCH_BCMRING) := bcmring
  137. machine-$(CONFIG_ARCH_CLPS711X) := clps711x
  138. machine-$(CONFIG_ARCH_CNS3XXX) := cns3xxx
  139. machine-$(CONFIG_ARCH_DAVINCI) := davinci
  140. machine-$(CONFIG_ARCH_DOVE) := dove
  141. machine-$(CONFIG_ARCH_EBSA110) := ebsa110
  142. machine-$(CONFIG_ARCH_EP93XX) := ep93xx
  143. machine-$(CONFIG_ARCH_GEMINI) := gemini
  144. machine-$(CONFIG_ARCH_H720X) := h720x
  145. machine-$(CONFIG_ARCH_HIGHBANK) := highbank
  146. machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
  147. machine-$(CONFIG_ARCH_IOP13XX) := iop13xx
  148. machine-$(CONFIG_ARCH_IOP32X) := iop32x
  149. machine-$(CONFIG_ARCH_IOP33X) := iop33x
  150. machine-$(CONFIG_ARCH_IXP2000) := ixp2000
  151. machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
  152. machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
  153. machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
  154. machine-$(CONFIG_ARCH_KS8695) := ks8695
  155. machine-$(CONFIG_ARCH_LPC32XX) := lpc32xx
  156. machine-$(CONFIG_ARCH_MMP) := mmp
  157. machine-$(CONFIG_ARCH_MSM) := msm
  158. machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
  159. machine-$(CONFIG_ARCH_IMX_V4_V5) := imx
  160. machine-$(CONFIG_ARCH_IMX_V6_V7) := imx
  161. machine-$(CONFIG_ARCH_MXS) := mxs
  162. machine-$(CONFIG_ARCH_NETX) := netx
  163. machine-$(CONFIG_ARCH_NOMADIK) := nomadik
  164. machine-$(CONFIG_ARCH_OMAP1) := omap1
  165. machine-$(CONFIG_ARCH_OMAP2) := omap2
  166. machine-$(CONFIG_ARCH_OMAP3) := omap2
  167. machine-$(CONFIG_ARCH_OMAP4) := omap2
  168. machine-$(CONFIG_ARCH_ORION5X) := orion5x
  169. machine-$(CONFIG_ARCH_PICOXCELL) := picoxcell
  170. machine-$(CONFIG_ARCH_PNX4008) := pnx4008
  171. machine-$(CONFIG_ARCH_PRIMA2) := prima2
  172. machine-$(CONFIG_ARCH_PXA) := pxa
  173. machine-$(CONFIG_ARCH_REALVIEW) := realview
  174. machine-$(CONFIG_ARCH_RPC) := rpc
  175. machine-$(CONFIG_ARCH_S3C24XX) := s3c24xx s3c2412 s3c2440
  176. machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx
  177. machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0
  178. machine-$(CONFIG_ARCH_S5PC100) := s5pc100
  179. machine-$(CONFIG_ARCH_S5PV210) := s5pv210
  180. machine-$(CONFIG_ARCH_EXYNOS4) := exynos
  181. machine-$(CONFIG_ARCH_EXYNOS5) := exynos
  182. machine-$(CONFIG_ARCH_SA1100) := sa1100
  183. machine-$(CONFIG_ARCH_SHARK) := shark
  184. machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
  185. machine-$(CONFIG_ARCH_TEGRA) := tegra
  186. machine-$(CONFIG_ARCH_U300) := u300
  187. machine-$(CONFIG_ARCH_U8500) := ux500
  188. machine-$(CONFIG_ARCH_VERSATILE) := versatile
  189. machine-$(CONFIG_ARCH_VEXPRESS) := vexpress
  190. machine-$(CONFIG_ARCH_VT8500) := vt8500
  191. machine-$(CONFIG_ARCH_W90X900) := w90x900
  192. machine-$(CONFIG_FOOTBRIDGE) := footbridge
  193. machine-$(CONFIG_MACH_SPEAR300) := spear3xx
  194. machine-$(CONFIG_MACH_SPEAR310) := spear3xx
  195. machine-$(CONFIG_MACH_SPEAR320) := spear3xx
  196. machine-$(CONFIG_MACH_SPEAR600) := spear6xx
  197. machine-$(CONFIG_ARCH_ZYNQ) := zynq
  198. # Platform directory name. This list is sorted alphanumerically
  199. # by CONFIG_* macro name.
  200. plat-$(CONFIG_ARCH_MXC) := mxc
  201. plat-$(CONFIG_ARCH_OMAP) := omap
  202. plat-$(CONFIG_ARCH_S3C64XX) := samsung
  203. plat-$(CONFIG_ARCH_ZYNQ) := versatile
  204. plat-$(CONFIG_PLAT_IOP) := iop
  205. plat-$(CONFIG_PLAT_NOMADIK) := nomadik
  206. plat-$(CONFIG_PLAT_ORION) := orion
  207. plat-$(CONFIG_PLAT_PXA) := pxa
  208. plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung
  209. plat-$(CONFIG_PLAT_S5P) := s5p samsung
  210. plat-$(CONFIG_PLAT_SPEAR) := spear
  211. plat-$(CONFIG_PLAT_VERSATILE) := versatile
  212. ifeq ($(CONFIG_ARCH_EBSA110),y)
  213. # This is what happens if you forget the IOCS16 line.
  214. # PCMCIA cards stop working.
  215. CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
  216. export CFLAGS_3c589_cs.o
  217. endif
  218. # The byte offset of the kernel image in RAM from the start of RAM.
  219. TEXT_OFFSET := $(textofs-y)
  220. # The first directory contains additional information for the boot setup code
  221. ifneq ($(machine-y),)
  222. MACHINE := arch/arm/mach-$(word 1,$(machine-y))/
  223. else
  224. MACHINE :=
  225. endif
  226. machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
  227. platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
  228. ifeq ($(KBUILD_SRC),)
  229. KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
  230. else
  231. KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
  232. endif
  233. export TEXT_OFFSET GZFLAGS MMUEXT
  234. # Do we have FASTFPE?
  235. FASTFPE :=arch/arm/fastfpe
  236. ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
  237. FASTFPE_OBJ :=$(FASTFPE)/
  238. endif
  239. core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
  240. core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
  241. core-$(CONFIG_VFP) += arch/arm/vfp/
  242. core-$(CONFIG_VMWARE_MVP) += arch/arm/mvp/
  243. # If we have a machine-specific directory, then include it in the build.
  244. core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
  245. core-y += arch/arm/net/
  246. core-y += arch/arm/crypto/
  247. core-y += $(machdirs) $(platdirs)
  248. drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
  249. core-y += arch/arm/perfmon/
  250. libs-y := arch/arm/lib/ $(libs-y)
  251. # Default target when executing plain make
  252. ifeq ($(CONFIG_XIP_KERNEL),y)
  253. KBUILD_IMAGE := xipImage
  254. else ifeq ($(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE),y)
  255. KBUILD_IMAGE := zImage-dtb
  256. else
  257. KBUILD_IMAGE := zImage
  258. endif
  259. # Build the DT binary blobs if we have OF configured
  260. ifeq ($(CONFIG_USE_OF),y)
  261. KBUILD_DTBS := dtbs
  262. endif
  263. all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
  264. boot := arch/arm/boot
  265. archprepare:
  266. $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h
  267. # Convert bzImage to zImage
  268. bzImage: zImage
  269. zImage Image xipImage bootpImage uImage: vmlinux
  270. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  271. zinstall uinstall install: vmlinux
  272. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
  273. %.dtb: scripts
  274. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  275. dtbs: scripts
  276. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  277. zImage-dtb: vmlinux scripts
  278. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  279. # We use MRPROPER_FILES and CLEAN_FILES now
  280. archclean:
  281. $(Q)$(MAKE) $(clean)=$(boot)
  282. # My testing targets (bypasses dependencies)
  283. bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
  284. i zi:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
  285. define archhelp
  286. echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
  287. echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
  288. echo '* xipImage - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
  289. echo ' uImage - U-Boot wrapped zImage'
  290. echo ' bootpImage - Combined zImage and initial RAM disk'
  291. echo ' (supply initrd image via make variable INITRD=<path>)'
  292. echo '* dtbs - Build device tree blobs for enabled boards'
  293. echo ' install - Install uncompressed kernel'
  294. echo ' zinstall - Install compressed kernel'
  295. echo ' uinstall - Install U-Boot wrapped compressed kernel'
  296. echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
  297. echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
  298. echo ' install to $$(INSTALL_PATH) and run lilo'
  299. endef