Makefile 6.5 KB

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