Makefile_64 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #
  2. # x86_64 Makefile
  3. #
  4. # This file is included by the global makefile so that you can add your own
  5. # architecture-specific flags and dependencies. Remember to do have actions
  6. # for "archclean" and "archdep" for cleaning up and making dependencies for
  7. # this architecture
  8. #
  9. # This file is subject to the terms and conditions of the GNU General Public
  10. # License. See the file "COPYING" in the main directory of this archive
  11. # for more details.
  12. #
  13. # Copyright (C) 1994 by Linus Torvalds
  14. #
  15. # 19990713 Artur Skawina <skawina@geocities.com>
  16. # Added '-march' and '-mpreferred-stack-boundary' support
  17. # 20000913 Pavel Machek <pavel@suse.cz>
  18. # Converted for x86_64 architecture
  19. # 20010105 Andi Kleen, add IA32 compiler.
  20. # ....and later removed it again....
  21. #
  22. # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
  23. # BITS is used as extension for files which are available in a 32 bit
  24. # and a 64 bit version to simplify shared Makefiles.
  25. # e.g.: obj-y += foo_$(BITS).o
  26. BITS := 64
  27. export BITS
  28. LDFLAGS := -m elf_x86_64
  29. OBJCOPYFLAGS := -O binary -R .note -R .comment -S
  30. LDFLAGS_vmlinux :=
  31. CHECKFLAGS += -D__x86_64__ -m64
  32. cflags-y :=
  33. cflags-kernel-y :=
  34. cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
  35. cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
  36. # gcc doesn't support -march=core2 yet as of gcc 4.3, but I hope it
  37. # will eventually. Use -mtune=generic as fallback
  38. cflags-$(CONFIG_MCORE2) += \
  39. $(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
  40. cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
  41. cflags-y += -m64
  42. cflags-y += -mno-red-zone
  43. cflags-y += -mcmodel=kernel
  44. cflags-y += -pipe
  45. cflags-y += -Wno-sign-compare
  46. cflags-y += -fno-asynchronous-unwind-tables
  47. ifneq ($(CONFIG_DEBUG_INFO),y)
  48. # -fweb shrinks the kernel a bit, but the difference is very small
  49. # it also messes up debugging, so don't use it for now.
  50. #cflags-y += $(call cc-option,-fweb)
  51. endif
  52. # -funit-at-a-time shrinks the kernel .text considerably
  53. # unfortunately it makes reading oopses harder.
  54. cflags-y += $(call cc-option,-funit-at-a-time)
  55. # prevent gcc from generating any FP code by mistake
  56. cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
  57. # this works around some issues with generating unwind tables in older gccs
  58. # newer gccs do it by default
  59. cflags-y += -maccumulate-outgoing-args
  60. # do binutils support CFI?
  61. cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
  62. KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
  63. # is .cfi_signal_frame supported too?
  64. cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
  65. KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
  66. cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector )
  67. cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all )
  68. KBUILD_CFLAGS += $(cflags-y)
  69. CFLAGS_KERNEL += $(cflags-kernel-y)
  70. KBUILD_AFLAGS += -m64
  71. head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.o
  72. libs-y += arch/x86/lib/
  73. core-y += arch/x86/kernel/ \
  74. arch/x86/mm/ \
  75. arch/x86/crypto/ \
  76. arch/x86/vdso/
  77. core-$(CONFIG_IA32_EMULATION) += arch/x86/ia32/
  78. drivers-$(CONFIG_PCI) += arch/x86/pci/
  79. drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/
  80. boot := arch/x86/boot
  81. PHONY += bzImage bzlilo install archmrproper \
  82. fdimage fdimage144 fdimage288 isoimage archclean
  83. #Default target when executing "make"
  84. all: bzImage
  85. BOOTIMAGE := arch/x86/boot/bzImage
  86. KBUILD_IMAGE := $(BOOTIMAGE)
  87. bzImage: vmlinux
  88. $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
  89. $(Q)mkdir -p $(objtree)/arch/x86_64/boot
  90. $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage
  91. bzlilo: vmlinux
  92. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
  93. bzdisk: vmlinux
  94. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk
  95. fdimage fdimage144 fdimage288 isoimage: vmlinux
  96. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  97. install: vdso_install
  98. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  99. vdso_install:
  100. ifeq ($(CONFIG_IA32_EMULATION),y)
  101. $(Q)$(MAKE) $(build)=arch/x86/ia32 $@
  102. endif
  103. $(Q)$(MAKE) $(build)=arch/x86/vdso $@
  104. archclean:
  105. $(Q)rm -rf $(objtree)/arch/x86_64/boot
  106. $(Q)$(MAKE) $(clean)=$(boot)
  107. define archhelp
  108. echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
  109. echo ' install - Install kernel using'
  110. echo ' (your) ~/bin/installkernel or'
  111. echo ' (distribution) /sbin/installkernel or'
  112. echo ' install to $$(INSTALL_PATH) and run lilo'
  113. echo ' bzdisk - Create a boot floppy in /dev/fd0'
  114. echo ' fdimage - Create a boot floppy image'
  115. echo ' isoimage - Create a boot CD-ROM image'
  116. endef
  117. CLEAN_FILES += arch/x86/boot/fdimage \
  118. arch/x86/boot/image.iso \
  119. arch/x86/boot/mtools.conf