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 13LDFLAGS_vmlinux :=-p --no-undefined -X 14CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 15OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 16GZFLAGS :=-9 17 18LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 19 20KBUILD_DEFCONFIG := defconfig 21 22KBUILD_CFLAGS += -mgeneral-regs-only 23KBUILD_CFLAGS += -fno-pic 24KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) 25 26ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) 27KBUILD_CPPFLAGS += -mbig-endian 28AS += -EB 29LD += -EB 30else 31KBUILD_CPPFLAGS += -mlittle-endian 32AS += -EL 33LD += -EL 34endif 35 36CHECKFLAGS += -D__aarch64__ 37 38ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) 39KBUILD_CFLAGS_MODULE += -mcmodel=large 40endif 41 42# Default value 43head-y := arch/arm64/kernel/head.o 44 45# The byte offset of the kernel image in RAM from the start of RAM. 46ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y) 47TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}') 48else 49TEXT_OFFSET := 0x00080000 50endif 51 52export TEXT_OFFSET GZFLAGS 53 54core-y += arch/arm64/kernel/ arch/arm64/mm/ 55core-$(CONFIG_NET) += arch/arm64/net/ 56core-$(CONFIG_KVM) += arch/arm64/kvm/ 57core-$(CONFIG_XEN) += arch/arm64/xen/ 58core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ 59libs-y := arch/arm64/lib/ $(libs-y) 60libs-y += $(LIBGCC) 61libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/ 62 63# Default target when executing plain make 64ifeq ($(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE),y) 65KBUILD_IMAGE := Image.gz-dtb 66else 67KBUILD_IMAGE := Image.gz 68endif 69 70KBUILD_DTBS := dtbs 71 72all: $(KBUILD_IMAGE) $(KBUILD_DTBS) 73 74boot := arch/arm64/boot 75 76Image Image.gz: vmlinux 77 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 78 79zinstall install: vmlinux 80 $(Q)$(MAKE) $(build)=$(boot) $@ 81 82%.dtb: scripts 83 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ 84 85dtbs: scripts 86 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs 87 88Image-dtb Image.gz-dtb: vmlinux scripts dtbs 89 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 90 91PHONY += vdso_install 92vdso_install: 93 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ 94 95# We use MRPROPER_FILES and CLEAN_FILES now 96archclean: 97 $(Q)$(MAKE) $(clean)=$(boot) 98 99# We need to generate vdso-offsets.h before compiling certain files in kernel/. 100# In order to do that, we should use the archprepare target, but we can't since 101# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 102# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 103# Therefore we need to generate the header after prepare0 has been made, hence 104# this hack. 105prepare: vdso_prepare 106vdso_prepare: prepare0 107 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h 108 109define archhelp 110 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 111 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' 112 echo '* dtbs - Build device tree blobs for enabled boards' 113 echo ' install - Install uncompressed kernel' 114 echo ' zinstall - Install compressed kernel' 115 echo ' Install using (your) ~/bin/installkernel or' 116 echo ' (distribution) /sbin/installkernel or' 117 echo ' install to $$(INSTALL_PATH) and run lilo' 118endef 119