Makefile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. # Ensure linker flags are correct
  13. LDFLAGS :=
  14. LDFLAGS_vmlinux :=-p --no-undefined -X
  15. ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
  16. LDFLAGS_vmlinux += --be8
  17. LDFLAGS_MODULE += --be8
  18. endif
  19. OBJCOPYFLAGS :=-O binary -R .comment -S
  20. GZFLAGS :=-9
  21. #KBUILD_CFLAGS +=-pipe
  22. # Never generate .eh_frame
  23. KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
  24. # Do not use arch/arm/defconfig - it's always outdated.
  25. # Select a platform tht is kept up-to-date
  26. KBUILD_DEFCONFIG := versatile_defconfig
  27. # defines filename extension depending memory management type.
  28. ifeq ($(CONFIG_MMU),)
  29. MMUEXT := -nommu
  30. KBUILD_CFLAGS += $(call cc-option,-mno-unaligned-access)
  31. endif
  32. ifeq ($(CONFIG_FRAME_POINTER),y)
  33. KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
  34. endif
  35. ifeq ($(CONFIG_CC_STACKPROTECTOR),y)
  36. KBUILD_CFLAGS +=-fstack-protector
  37. endif
  38. ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
  39. KBUILD_CPPFLAGS += -mbig-endian
  40. AS += -EB
  41. LD += -EB
  42. else
  43. KBUILD_CPPFLAGS += -mlittle-endian
  44. AS += -EL
  45. LD += -EL
  46. endif
  47. comma = ,
  48. # This selects which instruction set is used.
  49. # Note that GCC does not numerically define an architecture version
  50. # macro, but instead defines a whole series of macros which makes
  51. # testing for a specific architecture or later rather impossible.
  52. arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m
  53. arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
  54. arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
  55. # Only override the compiler option if ARMv6. The ARMv6K extensions are
  56. # always available in ARMv7
  57. ifeq ($(CONFIG_CPU_32v6),y)
  58. arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
  59. endif
  60. arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
  61. arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t
  62. arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4
  63. arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3
  64. # Evaluate arch cc-option calls now
  65. arch-y := $(arch-y)
  66. # This selects how we optimise for the processor.
  67. tune-$(CONFIG_CPU_ARM7TDMI) =-mtune=arm7tdmi
  68. tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7tdmi
  69. tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi
  70. tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi
  71. tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi
  72. tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
  73. tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi
  74. tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi
  75. tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
  76. tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi
  77. tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi
  78. tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110
  79. tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100
  80. tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
  81. tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
  82. tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
  83. tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
  84. tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
  85. # Evaluate tune cc-option calls now
  86. tune-y := $(tune-y)
  87. ifeq ($(CONFIG_AEABI),y)
  88. CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
  89. else
  90. CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
  91. endif
  92. ifeq ($(CONFIG_ARM_UNWIND),y)
  93. CFLAGS_ABI +=-funwind-tables
  94. endif
  95. ifeq ($(CONFIG_THUMB2_KERNEL),y)
  96. AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
  97. AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
  98. CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
  99. AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
  100. # Work around buggy relocation from gas if requested:
  101. ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
  102. CFLAGS_MODULE +=-fno-optimize-sibling-calls
  103. endif
  104. else
  105. CFLAGS_ISA :=$(call cc-option,-marm,)
  106. AFLAGS_ISA :=$(CFLAGS_ISA)
  107. endif
  108. # Need -Uarm for gcc < 3.x
  109. KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
  110. KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
  111. CHECKFLAGS += -D__arm__
  112. #Default value
  113. head-y := arch/arm/kernel/head$(MMUEXT).o
  114. textofs-y := 0x00008000
  115. textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
  116. # We don't want the htc bootloader to corrupt kernel during resume
  117. textofs-$(CONFIG_PM_H1940) := 0x00108000
  118. # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
  119. ifeq ($(CONFIG_ARCH_SA1100),y)
  120. textofs-$(CONFIG_SA1111) := 0x00208000
  121. endif
  122. textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000
  123. textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
  124. textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
  125. # Machine directory name. This list is sorted alphanumerically
  126. # by CONFIG_* macro name.
  127. machine-$(CONFIG_ARCH_AT91) += at91
  128. machine-$(CONFIG_ARCH_BCM) += bcm
  129. machine-$(CONFIG_ARCH_BCM2835) += bcm2835
  130. machine-$(CONFIG_ARCH_CLPS711X) += clps711x
  131. machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
  132. machine-$(CONFIG_ARCH_DAVINCI) += davinci
  133. machine-$(CONFIG_ARCH_DOVE) += dove
  134. machine-$(CONFIG_ARCH_EBSA110) += ebsa110
  135. machine-$(CONFIG_ARCH_EP93XX) += ep93xx
  136. machine-$(CONFIG_ARCH_EXYNOS) += exynos
  137. machine-$(CONFIG_ARCH_GEMINI) += gemini
  138. machine-$(CONFIG_ARCH_HIGHBANK) += highbank
  139. machine-$(CONFIG_ARCH_INTEGRATOR) += integrator
  140. machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
  141. machine-$(CONFIG_ARCH_IOP32X) += iop32x
  142. machine-$(CONFIG_ARCH_IOP33X) += iop33x
  143. machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx
  144. machine-$(CONFIG_ARCH_KEYSTONE) += keystone
  145. machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood
  146. machine-$(CONFIG_ARCH_KS8695) += ks8695
  147. machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
  148. machine-$(CONFIG_ARCH_MMP) += mmp
  149. machine-$(CONFIG_ARCH_MSM) += msm
  150. machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0
  151. machine-$(CONFIG_ARCH_MVEBU) += mvebu
  152. machine-$(CONFIG_ARCH_MXC) += imx
  153. machine-$(CONFIG_ARCH_MXS) += mxs
  154. machine-$(CONFIG_ARCH_NETX) += netx
  155. machine-$(CONFIG_ARCH_NOMADIK) += nomadik
  156. machine-$(CONFIG_ARCH_NSPIRE) += nspire
  157. machine-$(CONFIG_ARCH_OMAP1) += omap1
  158. machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2
  159. machine-$(CONFIG_ARCH_ORION5X) += orion5x
  160. machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell
  161. machine-$(CONFIG_ARCH_PXA) += pxa
  162. machine-$(CONFIG_ARCH_REALVIEW) += realview
  163. machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip
  164. machine-$(CONFIG_ARCH_RPC) += rpc
  165. machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx
  166. machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
  167. machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0
  168. machine-$(CONFIG_ARCH_S5PC100) += s5pc100
  169. machine-$(CONFIG_ARCH_S5PV210) += s5pv210
  170. machine-$(CONFIG_ARCH_SA1100) += sa1100
  171. machine-$(CONFIG_ARCH_SHARK) += shark
  172. machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
  173. machine-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile
  174. machine-$(CONFIG_ARCH_SIRF) += prima2
  175. machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
  176. machine-$(CONFIG_ARCH_STI) += sti
  177. machine-$(CONFIG_ARCH_SUNXI) += sunxi
  178. machine-$(CONFIG_ARCH_TEGRA) += tegra
  179. machine-$(CONFIG_ARCH_U300) += u300
  180. machine-$(CONFIG_ARCH_U8500) += ux500
  181. machine-$(CONFIG_ARCH_VERSATILE) += versatile
  182. machine-$(CONFIG_ARCH_VEXPRESS) += vexpress
  183. machine-$(CONFIG_ARCH_VIRT) += virt
  184. machine-$(CONFIG_ARCH_VT8500) += vt8500
  185. machine-$(CONFIG_ARCH_W90X900) += w90x900
  186. machine-$(CONFIG_ARCH_ZYNQ) += zynq
  187. machine-$(CONFIG_FOOTBRIDGE) += footbridge
  188. machine-$(CONFIG_PLAT_SPEAR) += spear
  189. # Platform directory name. This list is sorted alphanumerically
  190. # by CONFIG_* macro name.
  191. plat-$(CONFIG_ARCH_EXYNOS) += samsung
  192. plat-$(CONFIG_ARCH_OMAP) += omap
  193. plat-$(CONFIG_ARCH_S3C64XX) += samsung
  194. plat-$(CONFIG_PLAT_IOP) += iop
  195. plat-$(CONFIG_PLAT_ORION) += orion
  196. plat-$(CONFIG_PLAT_PXA) += pxa
  197. plat-$(CONFIG_PLAT_S3C24XX) += samsung
  198. plat-$(CONFIG_PLAT_S5P) += samsung
  199. plat-$(CONFIG_PLAT_VERSATILE) += versatile
  200. ifeq ($(CONFIG_ARCH_EBSA110),y)
  201. # This is what happens if you forget the IOCS16 line.
  202. # PCMCIA cards stop working.
  203. CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
  204. export CFLAGS_3c589_cs.o
  205. endif
  206. # The byte offset of the kernel image in RAM from the start of RAM.
  207. TEXT_OFFSET := $(textofs-y)
  208. # The first directory contains additional information for the boot setup code
  209. ifneq ($(machine-y),)
  210. MACHINE := arch/arm/mach-$(word 1,$(machine-y))/
  211. else
  212. MACHINE :=
  213. endif
  214. ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
  215. MACHINE :=
  216. endif
  217. machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
  218. platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
  219. ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
  220. ifeq ($(KBUILD_SRC),)
  221. KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
  222. else
  223. KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
  224. endif
  225. endif
  226. export TEXT_OFFSET GZFLAGS MMUEXT
  227. # Do we have FASTFPE?
  228. FASTFPE :=arch/arm/fastfpe
  229. ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
  230. FASTFPE_OBJ :=$(FASTFPE)/
  231. endif
  232. core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
  233. core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
  234. core-$(CONFIG_VFP) += arch/arm/vfp/
  235. core-$(CONFIG_XEN) += arch/arm/xen/
  236. core-$(CONFIG_KVM_ARM_HOST) += arch/arm/kvm/
  237. # If we have a machine-specific directory, then include it in the build.
  238. core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
  239. core-y += arch/arm/net/
  240. core-y += arch/arm/crypto/
  241. core-y += $(machdirs) $(platdirs)
  242. drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
  243. libs-y := arch/arm/lib/ $(libs-y)
  244. # Default target when executing plain make
  245. ifeq ($(CONFIG_XIP_KERNEL),y)
  246. KBUILD_IMAGE := xipImage
  247. else
  248. KBUILD_IMAGE := zImage
  249. endif
  250. # Build the DT binary blobs if we have OF configured
  251. ifeq ($(CONFIG_USE_OF),y)
  252. KBUILD_DTBS := dtbs
  253. endif
  254. all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
  255. boot := arch/arm/boot
  256. archprepare:
  257. $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h
  258. # Convert bzImage to zImage
  259. bzImage: zImage
  260. BOOT_TARGETS = zImage Image xipImage bootpImage uImage
  261. INSTALL_TARGETS = zinstall uinstall install
  262. PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
  263. $(BOOT_TARGETS): vmlinux
  264. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
  265. $(INSTALL_TARGETS):
  266. $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
  267. %.dtb: | scripts
  268. $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
  269. PHONY += dtbs
  270. dtbs: scripts
  271. $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
  272. # We use MRPROPER_FILES and CLEAN_FILES now
  273. archclean:
  274. $(Q)$(MAKE) $(clean)=$(boot)
  275. # My testing targets (bypasses dependencies)
  276. bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
  277. i zi:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
  278. define archhelp
  279. echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
  280. echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
  281. echo '* xipImage - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
  282. echo ' uImage - U-Boot wrapped zImage'
  283. echo ' bootpImage - Combined zImage and initial RAM disk'
  284. echo ' (supply initrd image via make variable INITRD=<path>)'
  285. echo '* dtbs - Build device tree blobs for enabled boards'
  286. echo ' install - Install uncompressed kernel'
  287. echo ' zinstall - Install compressed kernel'
  288. echo ' uinstall - Install U-Boot wrapped compressed kernel'
  289. echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
  290. echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
  291. echo ' install to $$(INSTALL_PATH) and run lilo'
  292. endef