Makefile 6.0 KB

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