Makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # This file is included by the global makefile so that you can add your own
  2. # architecture-specific flags and dependencies. Remember to do have actions
  3. # for "archclean" and "archdep" for cleaning up and making dependencies for
  4. # this architecture.
  5. #
  6. # This file is subject to the terms and conditions of the GNU General Public
  7. # License. See the file "COPYING" in the main directory of this archive
  8. # for more details.
  9. #
  10. # Copyright (C) 1994 by Linus Torvalds
  11. # Changes for PPC by Gary Thomas
  12. # Rewritten by Cort Dougan and Paul Mackerras
  13. #
  14. # This must match PAGE_OFFSET in include/asm-powerpc/page.h.
  15. KERNELLOAD := $(CONFIG_KERNEL_START)
  16. HAS_BIARCH := $(call cc-option-yn, -m32)
  17. ifeq ($(CONFIG_PPC64),y)
  18. OLDARCH := ppc64
  19. SZ := 64
  20. # Set default 32 bits cross compilers for vdso and boot wrapper
  21. CROSS32_COMPILE ?=
  22. CROSS32CC := $(CROSS32_COMPILE)gcc
  23. CROSS32AS := $(CROSS32_COMPILE)as
  24. CROSS32LD := $(CROSS32_COMPILE)ld
  25. CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy
  26. ifeq ($(HAS_BIARCH),y)
  27. ifeq ($(CROSS32_COMPILE),)
  28. CROSS32CC := $(CC) -m32
  29. CROSS32AS := $(AS) -a32
  30. CROSS32LD := $(LD) -m elf32ppc
  31. CROSS32OBJCOPY := $(OBJCOPY)
  32. endif
  33. endif
  34. export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
  35. new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
  36. ifeq ($(new_nm),y)
  37. NM := $(NM) --synthetic
  38. endif
  39. else
  40. OLDARCH := ppc
  41. SZ := 32
  42. endif
  43. ifeq ($(HAS_BIARCH),y)
  44. override AS += -a$(SZ)
  45. override LD += -m elf$(SZ)ppc
  46. override CC += -m$(SZ)
  47. endif
  48. LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic -e $(KERNELLOAD)
  49. # The -Iarch/$(ARCH)/include is temporary while we are merging
  50. CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
  51. AFLAGS += -Iarch/$(ARCH)
  52. CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe
  53. CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
  54. CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
  55. CFLAGS += $(CFLAGS-y)
  56. CPP = $(CC) -E $(CFLAGS)
  57. # Temporary hack until we have migrated to asm-powerpc
  58. LINUXINCLUDE += -Iarch/$(ARCH)/include
  59. CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
  60. ifeq ($(CONFIG_PPC64),y)
  61. GCC_VERSION := $(call cc-version)
  62. GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi)
  63. ifeq ($(CONFIG_POWER4_ONLY),y)
  64. ifeq ($(CONFIG_ALTIVEC),y)
  65. ifeq ($(GCC_BROKEN_VEC),y)
  66. CFLAGS += $(call cc-option,-mcpu=970)
  67. else
  68. CFLAGS += $(call cc-option,-mcpu=power4)
  69. endif
  70. else
  71. CFLAGS += $(call cc-option,-mcpu=power4)
  72. endif
  73. else
  74. CFLAGS += $(call cc-option,-mtune=power4)
  75. endif
  76. endif
  77. # Enable unit-at-a-time mode when possible. It shrinks the
  78. # kernel considerably.
  79. CFLAGS += $(call cc-option,-funit-at-a-time)
  80. ifndef CONFIG_FSL_BOOKE
  81. CFLAGS += -mstring
  82. endif
  83. cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
  84. cpu-as-$(CONFIG_4xx) += -Wa,-m405
  85. cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
  86. cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
  87. cpu-as-$(CONFIG_E500) += -Wa,-me500
  88. cpu-as-$(CONFIG_E200) += -Wa,-me200
  89. AFLAGS += $(cpu-as-y)
  90. CFLAGS += $(cpu-as-y)
  91. # Default to the common case.
  92. KBUILD_DEFCONFIG := common_defconfig
  93. head-y := arch/powerpc/kernel/head.o
  94. head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o
  95. head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o
  96. head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o
  97. head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o
  98. head-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o
  99. ifeq ($(CONFIG_PPC32),y)
  100. head-$(CONFIG_6xx) += arch/powerpc/kernel/idle_6xx.o
  101. head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o
  102. endif
  103. core-y += arch/powerpc/kernel/
  104. core-y += arch/$(OLDARCH)/kernel/
  105. core-$(CONFIG_PPC32) += arch/powerpc/mm/
  106. core-$(CONFIG_PPC64) += arch/$(OLDARCH)/mm/
  107. core-$(CONFIG_PPC32) += arch/powerpc/lib/
  108. libs-$(CONFIG_PPC64) += arch/$(OLDARCH)/lib/
  109. core-y += arch/powerpc/sysdev/
  110. core-y += arch/powerpc/platforms/
  111. core-$(CONFIG_PPC32) += arch/ppc/syslib/
  112. core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
  113. core-$(CONFIG_XMON) += arch/powerpc/xmon/
  114. core-$(CONFIG_APUS) += arch/ppc/amiga/
  115. drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
  116. drivers-$(CONFIG_4xx) += arch/ppc/4xx_io/
  117. drivers-$(CONFIG_CPM2) += arch/ppc/8260_io/
  118. drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
  119. defaultimage-$(CONFIG_PPC32) := uImage zImage
  120. defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
  121. KBUILD_IMAGE := $(defaultimage-y)
  122. all: $(KBUILD_IMAGE)
  123. CPPFLAGS_vmlinux.lds := -Upowerpc
  124. # All the instructions talk about "make bzImage".
  125. bzImage: zImage
  126. BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
  127. .PHONY: $(BOOT_TARGETS)
  128. boot := arch/$(OLDARCH)/boot
  129. $(BOOT_TARGETS): vmlinux
  130. $(Q)$(MAKE) ARCH=$(OLDARCH) $(build)=$(boot) $@
  131. uImage: vmlinux
  132. $(Q)$(MAKE) ARCH=$(OLDARCH) $(build)=$(boot)/images $(boot)/images/$@
  133. define archhelp
  134. @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/images/zImage.*)'
  135. @echo ' uImage - Create a bootable image for U-Boot / PPCBoot'
  136. @echo ' install - Install kernel using'
  137. @echo ' (your) ~/bin/installkernel or'
  138. @echo ' (distribution) /sbin/installkernel or'
  139. @echo ' install to $$(INSTALL_PATH) and run lilo'
  140. @echo ' *_defconfig - Select default config from arch/$(ARCH)/ppc/configs'
  141. endef
  142. archclean:
  143. $(Q)$(MAKE) $(clean)=$(boot)
  144. # Temporary hack until we have migrated to asm-powerpc
  145. $(Q)rm -rf arch/$(ARCH)/include
  146. archprepare: checkbin
  147. # Temporary hack until we have migrated to asm-powerpc
  148. include/asm: arch/$(ARCH)/include/asm
  149. arch/$(ARCH)/include/asm:
  150. $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
  151. $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
  152. # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
  153. # to stdout and these checks are run even on install targets.
  154. TOUT := .tmp_gas_check
  155. # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
  156. # instructions.
  157. # gcc-3.4 and binutils-2.14 are a fatal combination.
  158. GCC_VERSION := $(call cc-version)
  159. checkbin:
  160. @if test "$(GCC_VERSION)" = "0304" ; then \
  161. if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
  162. echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
  163. echo 'correctly with gcc-3.4 and your version of binutils.'; \
  164. echo '*** Please upgrade your binutils or downgrade your gcc'; \
  165. false; \
  166. fi ; \
  167. fi
  168. @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
  169. echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
  170. echo 'correctly with old versions of binutils.' ; \
  171. echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
  172. false ; \
  173. fi
  174. CLEAN_FILES += $(TOUT)