Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #
  2. # arch/arm64/Makefile
  3. #
  4. # This file is included by the global makefile so that you can add your own
  5. # architecture-specific flags and dependencies.
  6. #
  7. # This file is subject to the terms and conditions of the GNU General Public
  8. # License. See the file "COPYING" in the main directory of this archive
  9. # for more details.
  10. #
  11. # Copyright (C) 1995-2001 by Russell King
  12. LDFLAGS_vmlinux :=--no-undefined -X
  13. CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
  14. OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
  15. GZFLAGS :=-9
  16. KBUILD_DEFCONFIG := defconfig
  17. # Check for binutils support for specific extensions
  18. lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
  19. ifeq ($(CONFIG_ARM64_LSE_ATOMICS), y)
  20. ifeq ($(lseinstr),)
  21. $(warning LSE atomics not supported by binutils)
  22. endif
  23. endif
  24. KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr)
  25. KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads)
  26. KBUILD_AFLAGS += $(lseinstr)
  27. ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
  28. KBUILD_CPPFLAGS += -mbig-endian
  29. AS += -EB
  30. LD += -EB
  31. else
  32. KBUILD_CPPFLAGS += -mlittle-endian
  33. AS += -EL
  34. LD += -EL
  35. endif
  36. CHECKFLAGS += -D__aarch64__
  37. ifeq ($(CONFIG_ARM64_ERRATUM_843419), y)
  38. KBUILD_CFLAGS_MODULE += -mcmodel=large
  39. endif
  40. # Default value
  41. head-y := arch/arm64/kernel/head.o
  42. # The byte offset of the kernel image in RAM from the start of RAM.
  43. ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
  44. TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}')
  45. else
  46. TEXT_OFFSET := 0x00080000
  47. endif
  48. ifeq ($(cc-name),clang)
  49. KBUILD_CFLAGS += $(call cc-disable-warning, asm-operand-widths)
  50. endif
  51. # KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61)
  52. # in 32-bit arithmetic
  53. KASAN_SHADOW_OFFSET := $(shell printf "0x%08x00000000\n" $$(( \
  54. (0xffffffff & (-1 << ($(CONFIG_ARM64_VA_BITS) - 32))) \
  55. + (1 << ($(CONFIG_ARM64_VA_BITS) - 32 - 3)) \
  56. - (1 << (64 - 32 - 3)) )) )
  57. export TEXT_OFFSET GZFLAGS
  58. core-y += arch/arm64/kernel/ arch/arm64/mm/
  59. core-$(CONFIG_NET) += arch/arm64/net/
  60. core-$(CONFIG_KVM) += arch/arm64/kvm/
  61. core-$(CONFIG_XEN) += arch/arm64/xen/
  62. core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
  63. libs-y := arch/arm64/lib/ $(libs-y)
  64. core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
  65. # Default target when executing plain make
  66. KBUILD_IMAGE := Image.gz
  67. KBUILD_DTBS := dtbs
  68. all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
  69. boot := arch/arm64/boot
  70. Image: vmlinux
  71. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  72. Image.%: vmlinux
  73. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  74. zinstall install: vmlinux
  75. $(Q)$(MAKE) $(build)=$(boot) $@
  76. %.dtb: scripts
  77. $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
  78. PHONY += dtbs dtbs_install
  79. dtbs: prepare scripts
  80. $(Q)$(MAKE) $(build)=$(boot)/dts
  81. dtbs_install:
  82. $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
  83. PHONY += vdso_install
  84. vdso_install:
  85. $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
  86. # We use MRPROPER_FILES and CLEAN_FILES now
  87. archclean:
  88. $(Q)$(MAKE) $(clean)=$(boot)
  89. $(Q)$(MAKE) $(clean)=$(boot)/dts
  90. define archhelp
  91. echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
  92. echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
  93. echo '* dtbs - Build device tree blobs for enabled boards'
  94. echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
  95. echo ' install - Install uncompressed kernel'
  96. echo ' zinstall - Install compressed kernel'
  97. echo ' Install using (your) ~/bin/installkernel or'
  98. echo ' (distribution) /sbin/installkernel or'
  99. echo ' install to $$(INSTALL_PATH) and run lilo'
  100. endef