Merge tag 'lsk-v3.10-android-15.01'
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / Makefile
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
13 LDFLAGS_vmlinux :=-p --no-undefined -X
14 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
15 OBJCOPYFLAGS    :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
16 GZFLAGS         :=-9
17
18 LIBGCC          := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
19
20 KBUILD_DEFCONFIG := defconfig
21
22 KBUILD_CFLAGS   += -mgeneral-regs-only
23 KBUILD_CFLAGS   += -fno-pic
24 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
25 KBUILD_CPPFLAGS += -mbig-endian
26 AS              += -EB
27 LD              += -EB
28 else
29 KBUILD_CPPFLAGS += -mlittle-endian
30 AS              += -EL
31 LD              += -EL
32 endif
33
34 comma = ,
35
36 CHECKFLAGS      += -D__aarch64__
37
38 # Default value
39 head-y          := arch/arm64/kernel/head.o
40
41 # The byte offset of the kernel image in RAM from the start of RAM.
42 ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
43 TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}')
44 else
45 TEXT_OFFSET := 0x00080000
46 endif
47
48 export  TEXT_OFFSET GZFLAGS
49
50 core-y          += arch/arm64/kernel/ arch/arm64/mm/
51 core-$(CONFIG_ARCH_ROCKCHIP) += arch/arm64/mach-rockchip/
52 core-$(CONFIG_KVM) += arch/arm64/kvm/
53 core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
54 libs-y          := arch/arm64/lib/ $(libs-y)
55 libs-y          += $(LIBGCC)
56
57 # Default target when executing plain make
58 ifeq ($(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE),y)
59 KBUILD_IMAGE    := Image.gz-dtb
60 else
61 KBUILD_IMAGE    := Image.gz
62 endif
63
64 KBUILD_DTBS     := dtbs
65
66 all:    $(KBUILD_IMAGE) $(KBUILD_DTBS)
67
68 boot := arch/arm64/boot
69
70 Image Image.gz: vmlinux
71         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
72
73 zinstall install: vmlinux
74         $(Q)$(MAKE) $(build)=$(boot) $@
75
76 %.dtb: scripts
77         $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
78
79 dtbs: scripts
80         $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
81
82 Image.gz-dtb: vmlinux scripts dtbs
83         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
84
85 PHONY += vdso_install
86 vdso_install:
87         $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
88
89 # We use MRPROPER_FILES and CLEAN_FILES now
90 archclean:
91         $(Q)$(MAKE) $(clean)=$(boot)
92
93 define archhelp
94   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
95   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
96   echo  '* dtbs          - Build device tree blobs for enabled boards'
97   echo  '  install       - Install uncompressed kernel'
98   echo  '  zinstall      - Install compressed kernel'
99   echo  '                  Install using (your) ~/bin/installkernel or'
100   echo  '                  (distribution) /sbin/installkernel or'
101   echo  '                  install to $$(INSTALL_PATH) and run lilo'
102 endef
103
104 kernel.img: Image
105         $(Q)$(srctree)/mkkrnlimg $(objtree)/arch/arm64/boot/Image $(objtree)/kernel.img >/dev/null
106         @echo '  Image:  kernel.img is ready'
107
108 LOGO := $(notdir $(wildcard $(srctree)/logo.bmp))
109 LOGO_KERNEL := $(notdir $(wildcard $(srctree)/logo_kernel.bmp))
110 %.img: %.dtb kernel.img $(LOGO) $(LOGO_KERNEL)
111         $(Q)$(srctree)/resource_tool $(objtree)/arch/arm64/boot/dts/$*.dtb $(LOGO) $(LOGO_KERNEL)
112         @echo '  Image:  resource.img (with $*.dtb $(LOGO) $(LOGO_KERNEL)) is ready'