Makefile 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. # Set default 32 bits cross compilers for vdso and boot wrapper
  16. CROSS32_COMPILE ?=
  17. CROSS32CC := $(CROSS32_COMPILE)gcc
  18. CROSS32AS := $(CROSS32_COMPILE)as
  19. CROSS32LD := $(CROSS32_COMPILE)ld
  20. CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy
  21. ifeq ($(HAS_BIARCH),y)
  22. ifeq ($(CROSS32_COMPILE),)
  23. CROSS32CC := $(CC) -m32
  24. CROSS32AS := $(AS) -a32
  25. CROSS32LD := $(LD) -m elf32ppc
  26. CROSS32OBJCOPY := $(OBJCOPY)
  27. endif
  28. endif
  29. export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
  30. ifeq ($(CONFIG_PPC64),y)
  31. OLDARCH := ppc64
  32. SZ := 64
  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) := 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/$(ARCH)/boot
  126. $(BOOT_TARGETS): vmlinux
  127. $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
  128. define archhelp
  129. @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
  130. @echo ' install - Install kernel using'
  131. @echo ' (your) ~/bin/installkernel or'
  132. @echo ' (distribution) /sbin/installkernel or'
  133. @echo ' install to $$(INSTALL_PATH) and run lilo'
  134. @echo ' *_defconfig - Select default config from arch/$(ARCH)/ppc/configs'
  135. endef
  136. archclean:
  137. $(Q)$(MAKE) $(clean)=$(boot)
  138. $(Q)rm -rf arch/$(ARCH)/include
  139. archprepare: checkbin
  140. # Temporary hack until we have migrated to asm-powerpc
  141. include/asm: arch/$(ARCH)/include/asm
  142. arch/$(ARCH)/include/asm: FORCE
  143. $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
  144. $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
  145. # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
  146. # to stdout and these checks are run even on install targets.
  147. TOUT := .tmp_gas_check
  148. # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
  149. # instructions.
  150. # gcc-3.4 and binutils-2.14 are a fatal combination.
  151. GCC_VERSION := $(call cc-version)
  152. checkbin:
  153. @if test "$(GCC_VERSION)" = "0304" ; then \
  154. if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
  155. echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
  156. echo 'correctly with gcc-3.4 and your version of binutils.'; \
  157. echo '*** Please upgrade your binutils or downgrade your gcc'; \
  158. false; \
  159. fi ; \
  160. fi
  161. @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
  162. echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
  163. echo 'correctly with old versions of binutils.' ; \
  164. echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
  165. false ; \
  166. fi
  167. CLEAN_FILES += $(TOUT)