summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index bf1c908c5ac6..fdc4239287d4 100644
--- a/Makefile
+++ b/Makefile
@@ -252,7 +252,18 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
# "make" in the configured kernel build directory always uses that.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
+ARCH ?= arm64
ARCH ?= $(SUBARCH)
+ifeq ($(ARCH),arm64)
+ifneq ($(wildcard $(srctree)/../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9),)
+CROSS_COMPILE ?= $(srctree)/../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
+endif
+endif
+ifeq ($(ARCH),arm)
+ifneq ($(wildcard $(srctree)/../prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9),)
+CROSS_COMPILE ?= $(srctree)/../prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-
+endif
+endif
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
# Architecture as present in compile.h
@@ -361,6 +372,12 @@ PERL = perl
PYTHON = python
CHECK = sparse
+# Use the wrapper for the compiler. This wrapper scans for new
+# warnings and causes the build to stop upon encountering them.
+ifneq ($(wildcard $(srctree)/scripts/gcc-wrapper.py),)
+CC = $(srctree)/scripts/gcc-wrapper.py $(CROSS_COMPILE)gcc
+endif
+
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
CFLAGS_MODULE =
@@ -641,6 +658,11 @@ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
+else ifneq ($(findstring aarch64-linux-android, $(CROSS_COMPILE)),)
+# It seems than android gcc can't pass gcc-goto.sh check, but asm goto work.
+# So let's active it.
+ KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+ KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
endif
ifdef CONFIG_READABLE_ASM
@@ -1473,6 +1495,7 @@ scripts: ;
endif # KBUILD_EXTMOD
clean: $(clean-dirs)
+ $(Q)rm -f kernel.img resource.img
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \