Back to home page

LXR

 
 

    


0001 #
0002 # arch/arm64/Makefile
0003 #
0004 # This file is included by the global makefile so that you can add your own
0005 # architecture-specific flags and dependencies.
0006 #
0007 # This file is subject to the terms and conditions of the GNU General Public
0008 # License.  See the file "COPYING" in the main directory of this archive
0009 # for more details.
0010 #
0011 # Copyright (C) 1995-2001 by Russell King
0012 
0013 LDFLAGS_vmlinux :=-p --no-undefined -X
0014 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
0015 GZFLAGS         :=-9
0016 
0017 ifneq ($(CONFIG_RELOCATABLE),)
0018 LDFLAGS_vmlinux         += -pie -shared -Bsymbolic
0019 endif
0020 
0021 ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
0022   ifeq ($(call ld-option, --fix-cortex-a53-843419),)
0023 $(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
0024   else
0025 LDFLAGS_vmlinux += --fix-cortex-a53-843419
0026   endif
0027 endif
0028 
0029 KBUILD_DEFCONFIG := defconfig
0030 
0031 # Check for binutils support for specific extensions
0032 lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
0033 
0034 ifeq ($(CONFIG_ARM64_LSE_ATOMICS), y)
0035   ifeq ($(lseinstr),)
0036 $(warning LSE atomics not supported by binutils)
0037   endif
0038 endif
0039 
0040 brokengasinst := $(call as-instr,1:\n.inst 0\n.rept . - 1b\n\nnop\n.endr\n,,-DCONFIG_BROKEN_GAS_INST=1)
0041 
0042 ifneq ($(brokengasinst),)
0043 $(warning Detected assembler with broken .inst; disassembly will be unreliable)
0044 endif
0045 
0046 KBUILD_CFLAGS   += -mgeneral-regs-only $(lseinstr) $(brokengasinst)
0047 KBUILD_CFLAGS   += -fno-asynchronous-unwind-tables
0048 KBUILD_CFLAGS   += $(call cc-option, -mpc-relative-literal-loads)
0049 KBUILD_AFLAGS   += $(lseinstr) $(brokengasinst)
0050 
0051 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
0052 KBUILD_CPPFLAGS += -mbig-endian
0053 AS              += -EB
0054 LD              += -EB
0055 UTS_MACHINE     := aarch64_be
0056 else
0057 KBUILD_CPPFLAGS += -mlittle-endian
0058 AS              += -EL
0059 LD              += -EL
0060 UTS_MACHINE     := aarch64
0061 endif
0062 
0063 CHECKFLAGS      += -D__aarch64__
0064 
0065 ifeq ($(CONFIG_ARM64_MODULE_CMODEL_LARGE), y)
0066 KBUILD_CFLAGS_MODULE    += -mcmodel=large
0067 endif
0068 
0069 ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
0070 KBUILD_LDFLAGS_MODULE   += -T $(srctree)/arch/arm64/kernel/module.lds
0071 endif
0072 
0073 # Default value
0074 head-y          := arch/arm64/kernel/head.o
0075 
0076 # The byte offset of the kernel image in RAM from the start of RAM.
0077 ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
0078 TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \
0079                  int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \
0080                  rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}")
0081 else
0082 TEXT_OFFSET := 0x00080000
0083 endif
0084 
0085 # KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61)
0086 # in 32-bit arithmetic
0087 KASAN_SHADOW_OFFSET := $(shell printf "0x%08x00000000\n" $$(( \
0088                         (0xffffffff & (-1 << ($(CONFIG_ARM64_VA_BITS) - 32))) \
0089                         + (1 << ($(CONFIG_ARM64_VA_BITS) - 32 - 3)) \
0090                         - (1 << (64 - 32 - 3)) )) )
0091 
0092 export  TEXT_OFFSET GZFLAGS
0093 
0094 core-y          += arch/arm64/kernel/ arch/arm64/mm/
0095 core-$(CONFIG_NET) += arch/arm64/net/
0096 core-$(CONFIG_KVM) += arch/arm64/kvm/
0097 core-$(CONFIG_XEN) += arch/arm64/xen/
0098 core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
0099 libs-y          := arch/arm64/lib/ $(libs-y)
0100 core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
0101 
0102 # Default target when executing plain make
0103 KBUILD_IMAGE    := Image.gz
0104 KBUILD_DTBS     := dtbs
0105 
0106 all:    $(KBUILD_IMAGE) $(KBUILD_DTBS)
0107 
0108 boot := arch/arm64/boot
0109 
0110 Image: vmlinux
0111         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
0112 
0113 Image.%: Image
0114         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
0115 
0116 zinstall install:
0117         $(Q)$(MAKE) $(build)=$(boot) $@
0118 
0119 %.dtb: scripts
0120         $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
0121 
0122 PHONY += dtbs dtbs_install
0123 
0124 dtbs: prepare scripts
0125         $(Q)$(MAKE) $(build)=$(boot)/dts
0126 
0127 dtbs_install:
0128         $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
0129 
0130 PHONY += vdso_install
0131 vdso_install:
0132         $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
0133 
0134 # We use MRPROPER_FILES and CLEAN_FILES now
0135 archclean:
0136         $(Q)$(MAKE) $(clean)=$(boot)
0137         $(Q)$(MAKE) $(clean)=$(boot)/dts
0138 
0139 # We need to generate vdso-offsets.h before compiling certain files in kernel/.
0140 # In order to do that, we should use the archprepare target, but we can't since
0141 # asm-offsets.h is included in some files used to generate vdso-offsets.h, and
0142 # asm-offsets.h is built in prepare0, for which archprepare is a dependency.
0143 # Therefore we need to generate the header after prepare0 has been made, hence
0144 # this hack.
0145 prepare: vdso_prepare
0146 vdso_prepare: prepare0
0147         $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h
0148 
0149 define archhelp
0150   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
0151   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
0152   echo  '* dtbs          - Build device tree blobs for enabled boards'
0153   echo  '  dtbs_install  - Install dtbs to $(INSTALL_DTBS_PATH)'
0154   echo  '  install       - Install uncompressed kernel'
0155   echo  '  zinstall      - Install compressed kernel'
0156   echo  '                  Install using (your) ~/bin/installkernel or'
0157   echo  '                  (distribution) /sbin/installkernel or'
0158   echo  '                  install to $$(INSTALL_PATH) and run lilo'
0159 endef