[llvmlinux] [PATCH 1/1] Add android-linaro toolchain

Vinicius Tinti viniciustinti at gmail.com
Fri Dec 13 09:47:21 UTC 2013


The Android Linaro toolchain can be used as an alternative to 'android'
toolchain. Althourgh it may be necessary to add the
'android-linaro-kernel.patch' patch to make the target kernel build.

Patch provided by codeworkx <daniel.hillenbrand at codeworkx.de>.

Signed-off-by: Vinicius Tinti <viniciustinti at gmail.com>
---
 .../android-linaro/android-linaro-kernel.patch     | 118 +++++++++++++++++++++
 .../arm/toolchain/android-linaro/android-linaro.mk |  72 +++++++++++++
 arch/arm/toolchain/toolchain.mk                    |  23 ++--
 3 files changed, 204 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/toolchain/android-linaro/android-linaro-kernel.patch
 create mode 100644 arch/arm/toolchain/android-linaro/android-linaro.mk

diff --git a/arch/arm/toolchain/android-linaro/android-linaro-kernel.patch b/arch/arm/toolchain/android-linaro/android-linaro-kernel.patch
new file mode 100644
index 0000000..25890d5
--- /dev/null
+++ b/arch/arm/toolchain/android-linaro/android-linaro-kernel.patch
@@ -0,0 +1,118 @@
+From ec1ac589d49081286164246fbaaba0012ae7ecac Mon Sep 17 00:00:00 2001
+From: codeworkx <daniel.hillenbrand at codeworkx.de>
+Date: Sun, 10 Jun 2012 10:19:34 +0200
+Subject: [PATCH] fix build errors using gcc-4.7
+
+Error: selected processor does not support ARM mode `smc #0'
+error: DIV usage mismatch between arch/arm/boot/compressed/head.o and output
+error: DIV usage mismatch between arch/arm/boot/compressed/misc.o and output
+error: DIV usage mismatch between arch/arm/boot/compressed/decompress.o and output
+error: DIV usage mismatch between arch/arm/boot/compressed/lib1funcs.o and output
+error: DIV usage mismatch between arch/arm/boot/compressed/ashldi3.o and output
+
+Change-Id: I1251b843bb9b4c74ba8039fd194e3aed2183cf5b
+---
+ arch/arm/boot/compressed/Makefile | 23 +++++++++++++++++------
+ security/smc/Makefile             |  4 ++++
+ 2 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
+index 777f70d..fd73b77 100644
+--- a/arch/arm/boot/compressed/Makefile
++++ b/arch/arm/boot/compressed/Makefile
+@@ -5,6 +5,7 @@
+ #
+ 
+ OBJS		=
++plus_sec := $(call as-instr,.arch_extension sec,+sec)
+ 
+ # Ensure that mmcif loader code appears early in the image
+ # to minimise that number of bocks that have to be read in
+@@ -15,9 +16,16 @@ OBJS		+= mmcif-sh7372.o
+ endif
+ endif
+ 
+-AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
+-HEAD	= head.o
+-OBJS	+= misc.o decompress.o
++AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
++AFLAGS_head.o += -Wa,-march=armv7-a$(plus_sec)
++HEAD = head.o
++
++AFLAGS_misc.o +=-Wa,-march=armv7-a$(plus_sec)
++MISC = misc.o
++
++AFLAGS_decompress.o += -Wa,-march=armv7-a$(plus_sec)
++DECOMPRESS = decompress.o
++
+ FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
+ 
+ #
+@@ -84,9 +92,9 @@ suffix_$(CONFIG_KERNEL_LZO)  := lzo
+ suffix_$(CONFIG_KERNEL_LZMA) := lzma
+ suffix_$(CONFIG_KERNEL_XZ)   := xzkern
+ 
+-targets       := vmlinux vmlinux.lds \
++targets := vmlinux vmlinux.lds \
+ 		 piggy.$(suffix_y) piggy.$(suffix_y).o \
+-		 font.o font.c head.o misc.o $(OBJS)
++		 font.o font.c head.o misc.o decompress.o $(OBJS)
+ 
+ # Make sure files are removed during clean
+ extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern lib1funcs.S ashldi3.S
+@@ -116,12 +124,14 @@ LDFLAGS_vmlinux += -X
+ LDFLAGS_vmlinux += -T
+ 
+ # For __aeabi_uidivmod
++AFLAGS_lib1funcs.o +=-Wa,-march=armv7-a$(plus_sec)
+ lib1funcs = $(obj)/lib1funcs.o
+ 
+ $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
+ 	$(call cmd,shipped)
+ 
+ # For __aeabi_llsl
++AFLAGS_ashldi3.o +=-Wa,-march=armv7-a$(plus_sec)
+ ashldi3 = $(obj)/ashldi3.o
+ 
+ $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S FORCE
+@@ -140,7 +150,7 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
+   ( echo "following symbols must have non local/private scope:" >&2; \
+     echo "$$bad_syms" >&2; rm -f $@; false )
+ 
+-$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
++$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/$(MISC) $(obj)/$(DECOMPRESS) $(obj)/piggy.$(suffix_y).o \
+     $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
+ 	$(call if_changed,ld)
+ 	@$(check_for_bad_syms)
+@@ -148,6 +158,7 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
+ $(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
+ 	$(call if_changed,$(suffix_y))
+ 
++AFLAGS_piggy.$(suffix_y).o += -Wa,-march=armv7-a$(plus_sec)
+ $(obj)/piggy.$(suffix_y).o:  $(obj)/piggy.$(suffix_y) FORCE
+ 
+ CFLAGS_font.o := -Dstatic=
+diff --git a/security/smc/Makefile b/security/smc/Makefile
+index 2133178..c0b958b 100644
+--- a/security/smc/Makefile
++++ b/security/smc/Makefile
+@@ -22,6 +22,8 @@ ifdef S_VERSION_BUILD
+ EXTRA_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
+ endif
+ 
++plus_sec := $(call as-instr,.arch_extension sec,+sec)
++
+ EXTRA_CFLAGS += -Iarch/arm/mach-omap2
+ EXTRA_CFLAGS += -Iarch/arm/plat-omap/include/plat
+ EXTRA_CFLAGS += -DCONFIG_TF_TEEC
+@@ -41,5 +43,7 @@ tf_driver-objs += tf_device_mshield.o
+ tf_driver-objs += bridge_pub2sec.o
+ tf_driver-objs += tf_teec.o
+ 
++AFLAGS_bridge_pub2sec.o +=-Wa,-march=armv7-a$(plus_sec)
++
+ obj-$(CONFIG_SECURITY_MIDDLEWARE_COMPONENT) += tf_driver.o
+ obj-$(CONFIG_SECURITY_MIDDLEWARE_COMPONENT) += rproc_drm.o
+-- 
+1.8.5.1
+
diff --git a/arch/arm/toolchain/android-linaro/android-linaro.mk b/arch/arm/toolchain/android-linaro/android-linaro.mk
new file mode 100644
index 0000000..bd45336
--- /dev/null
+++ b/arch/arm/toolchain/android-linaro/android-linaro.mk
@@ -0,0 +1,72 @@
+##############################################################################
+# Copyright {c} 2012 Mark Charlebois
+#               2012 Behan Webster
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files {the "Software"}, to 
+# deal in the Software without restriction, including without limitation the 
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
+# sell copies of the Software, and to permit persons to whom the Software is 
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in 
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+##############################################################################
+
+# Note: use CROSS_ARM_TOOLCHAIN=android-linaro to include this file
+
+TARGETS				+= android-linaro-gcc
+
+ANDROID_LINARO_VERSION		?= 13.11
+ANDROID_LINARO_GCC_VERSION	?= 4.8
+ANDROID_LINARO_CC_NAME		?= android-toolchain-eabi
+ANDROID_LINARO_CC_URL		?= http://releases.linaro.org/${ANDROID_LINARO_VERSION}/components/android/toolchain/${ANDROID_LINARO_GCC_VERSION}/${ANDROID_LINARO_CC_NAME}-${ANDROID_LINARO_GCC_VERSION}-20${ANDROID_LINARO_VERSION}-x86.tar.bz2
+ANDROID_LINARO_DIR		?= ${ARCH_ARM_TOOLCHAIN}/android-linaro
+ANDROID_LINARO_TMPDIR		= ${ANDROID_LINARO_DIR}/tmp
+TMPDIRS				+= ${ANDROID_LINARO_TMPDIR}
+
+ANDROID_LINARO_CC_TAR		= ${notdir ${ANDROID_LINARO_CC_URL}}
+ANDROID_LINARO_CC_DIR		= ${ANDROID_LINARO_DIR}/${ANDROID_LINARO_CC_NAME}
+ANDROID_LINARO_CC_BINDIR	= ${ANDROID_LINARO_CC_DIR}/bin
+
+HOST				?= arm-linux-androideabi
+HOST_TRIPLE			?= ${HOST}
+COMPILER_PATH			= ${ANDROID_LINARO_CC_DIR}
+ANDROID_LINARO_GCC		= ${ANDROID_LINARO_CC_BINDIR}/${CROSS_COMPILE}gcc
+CROSS_GCC			= ${ANDROID_LINARO_GCC}
+
+ARM_CROSS_GCC_TOOLCHAIN 	= ${ANDROID_LINARO_CC_DIR}
+
+# Add path so that ${CROSS_COMPILE}${CC} is resolved
+PATH				:= ${ANDROID_LINARO_CC_BINDIR}:${PATH}
+
+# Get Linaro cross compiler
+${ANDROID_LINARO_TMPDIR}/${ANDROID_LINARO_CC_TAR}:
+	@$(call wget,"${ANDROID_LINARO_CC_URL}",${ANDROID_LINARO_TMPDIR})
+
+android-linaro-gcc arm-cc: ${ARCH_ARM_TOOLCHAIN_STATE}/android-linaro-gcc
+${ARCH_ARM_TOOLCHAIN_STATE}/android-linaro-gcc: ${ANDROID_LINARO_TMPDIR}/${ANDROID_LINARO_CC_TAR}
+	rm -rf ${ANDROID_LINARO_CC_DIR}
+	tar -x -j -C ${ANDROID_LINARO_DIR} -f $<
+	$(call state,$@)
+
+state/arm-cc: ${ARCH_ARM_TOOLCHAIN_STATE}/android-linaro-gcc
+	$(call state,$@)
+
+android-linaro-gcc-clean arm-cc-clean:
+	@$(call banner,Removing Linaro compiler...)
+	@rm -f state/arm-cc ${ARCH_ARM_TOOLCHAIN_STATE}/android-linaro-gcc
+	@rm -rf ${ANDROID_LINARO_CC_DIR}
+
+arm-cc-version: ${ARCH_ARM_TOOLCHAIN_STATE}/android-linaro-gcc
+	env
+	@${ANDROID_LINARO_GCC} --version | head -1
+
diff --git a/arch/arm/toolchain/toolchain.mk b/arch/arm/toolchain/toolchain.mk
index 9c732be..f122818 100644
--- a/arch/arm/toolchain/toolchain.mk
+++ b/arch/arm/toolchain/toolchain.mk
@@ -28,10 +28,11 @@ HELP_TARGETS	+= arm-gcc-toolchain-help
 arm-gcc-toolchain-help:
 	@echo
 	@echo "You can choose your cross-gcc by setting the CROSS_ARM_TOOLCHAIN variable."
-	@echo "  CROSS_ARM_TOOLCHAIN=android       Download and use Android gcc cross-toolchain"
-	@echo "  CROSS_ARM_TOOLCHAIN=codesourcery  Download and use Code sourcery toolchain (Default)"
-	@echo "  CROSS_ARM_TOOLCHAIN=linaro        Download and use Linaro gcc cross-toolchain"
-	@echo "  CROSS_ARM_TOOLCHAIN=native        Use distro installed gcc cross-toolchain"
+	@echo "  CROSS_ARM_TOOLCHAIN=android            Download and use Android gcc cross-toolchain"
+	@echo "  CROSS_ARM_TOOLCHAIN=android-linaro     Download and use Linaro Android gcc cross-toolchain"
+	@echo "  CROSS_ARM_TOOLCHAIN=codesourcery       Download and use Code sourcery toolchain (Default)"
+	@echo "  CROSS_ARM_TOOLCHAIN=linaro             Download and use Linaro gcc cross-toolchain"
+	@echo "  CROSS_ARM_TOOLCHAIN=native             Use distro installed gcc cross-toolchain"
 
 # Configure the requested ARM cross compiler
 # Sets CROSS_GCC, PATH, HOST, HOST_TRIPLE
@@ -42,13 +43,17 @@ arm-gcc-toolchain-help:
 ifeq (${CROSS_ARM_TOOLCHAIN},android)
   include ${ARCH_ARM_TOOLCHAIN}/android/android.mk
 else
-  ifeq (${CROSS_ARM_TOOLCHAIN},linaro)
-    include ${ARCH_ARM_TOOLCHAIN}/linaro/linaro.mk
+  ifeq (${CROSS_ARM_TOOLCHAIN},android-linaro)
+  include ${ARCH_ARM_TOOLCHAIN}/android-linaro/android-linaro.mk
   else
-    ifeq (${CROSS_ARM_TOOLCHAIN},native)
-      include ${ARCH_ARM_TOOLCHAIN}/native.mk
+    ifeq (${CROSS_ARM_TOOLCHAIN},linaro)
+      include ${ARCH_ARM_TOOLCHAIN}/linaro/linaro.mk
     else
-      include ${ARCH_ARM_TOOLCHAIN}/codesourcery/codesourcery.mk
+      ifeq (${CROSS_ARM_TOOLCHAIN},native)
+        include ${ARCH_ARM_TOOLCHAIN}/native.mk
+      else
+        include ${ARCH_ARM_TOOLCHAIN}/codesourcery/codesourcery.mk
+      endif
     endif
   endif
 endif
-- 
1.8.1.2



More information about the LLVMLinux mailing list