Makefile 13 KB

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