From 9ada5ea3626964561ed983c64cf04bcdf44e6806 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Wed, 30 May 2012 16:09:29 +0800 Subject: Fixed prebuilt path and toolchain names 1) Use "prebuilts" instead of "prebuilt" to legalize BUILD_TOP 2) Update CROSSTOOLCHAIN and CROSSPREFIX for all arch 3) Add -fno-pic because some toolchain (eg. x86 and mips) in prebuilts/gcc are NDK-compatible (ie. enforces -fpic, etc) Verified to build working kernel-goldfish for all arch Change-Id: I93ac8f0beeaae14aa4575629fd8eaf4af73ef7ce --- distrib/build-kernel.sh | 28 ++++++++++------------------ distrib/kernel-toolchain/toolbox.sh | 18 +++++++++++------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/distrib/build-kernel.sh b/distrib/build-kernel.sh index 4b50353..67488ac 100755 --- a/distrib/build-kernel.sh +++ b/distrib/build-kernel.sh @@ -6,7 +6,7 @@ MACHINE=goldfish VARIANT=goldfish OUTPUT=/tmp/kernel-qemu -CROSSPREFIX=arm-eabi- +CROSSPREFIX=arm-linux-androideabi- CONFIG=goldfish # Determine the host architecture, and which default prebuilt tag we need. @@ -127,15 +127,15 @@ if [ -n "$OPTION_CROSS" ] ; then else case $ARCH in arm) - CROSSTOOLCHAIN=arm-eabi-4.4.3 - CROSSPREFIX=arm-eabi- + CROSSTOOLCHAIN=arm-linux-androideabi-4.6 + CROSSPREFIX=arm-linux-androideabi- ;; x86) CROSSTOOLCHAIN=i686-linux-android-4.6 CROSSPREFIX=i686-linux-android- ;; mips) - CROSSTOOLCHAIN=mipsel-linux-android-4.4.3 + CROSSTOOLCHAIN=mipsel-linux-android-4.6 CROSSPREFIX=mipsel-linux-android- ;; *) @@ -166,17 +166,13 @@ if [ $? != 0 ] ; then # Assume this script is under external/qemu/distrib/ in the # Android source tree. BUILD_TOP=$(dirname $0)/../../.. - if [ ! -d "$BUILD_TOP/prebuilt" ]; then + if [ ! -d "$BUILD_TOP/prebuilts" ]; then BUILD_TOP= else BUILD_TOP=$(cd $BUILD_TOP && pwd) fi fi - if [ "$ARCH" = "mips" ]; then - CROSSPREFIX=$BUILD_TOP/prebuilts/gcc/$HOST_TAG/$ARCH/$CROSSTOOLCHAIN/bin/$CROSSPREFIX - else - CROSSPREFIX=$BUILD_TOP/prebuilt/$HOST_TAG/toolchain/$CROSSTOOLCHAIN/bin/$CROSSPREFIX - fi + CROSSPREFIX=$BUILD_TOP/prebuilts/gcc/$HOST_TAG/$ARCH/$CROSSTOOLCHAIN/bin/$CROSSPREFIX if [ "$BUILD_TOP" -a -f ${CROSSPREFIX}gcc ]; then echo "Auto-config: --cross=$CROSSPREFIX" else @@ -195,15 +191,11 @@ fi # Special magic redirection with our magic toolbox script -# This is needed to add extra compiler flags for x86 +# This is needed to add extra compiler flags to compiler. +# See kernel-toolchain/android-kernel-toolchain-* for details # -# We could use that for ARM, but don't need to at the moment. -# -if [ "$ARCH" = "x86" ]; then - export REAL_CROSS_COMPILE="$CROSS_COMPILE" - export ARCH - CROSS_COMPILE=$(dirname "$0")/kernel-toolchain/android-kernel-toolchain- -fi +export REAL_CROSS_COMPILE="$CROSS_COMPILE" +CROSS_COMPILE=$(dirname "$0")/kernel-toolchain/android-kernel-toolchain- # Do the build # diff --git a/distrib/kernel-toolchain/toolbox.sh b/distrib/kernel-toolchain/toolbox.sh index b9947e2..89b49bb 100755 --- a/distrib/kernel-toolchain/toolbox.sh +++ b/distrib/kernel-toolchain/toolbox.sh @@ -1,10 +1,10 @@ #!/bin/sh # -# This is a wrapper around our x86 toolchain that allows us to add a few +# This is a wrapper around our toolchain that allows us to add a few # compiler flags. -# The issue is that our x86 toolchain is NDK-compatible, and hence enforces -# -mfpmath=sse and -fpic by default. When building the kernel, we need to -# disable this. +# The issue is that our toolchain are NDK-compatible, and hence enforces +# -fpic (and also -mfpmath=sse for x86) by default. When building the +# kernel, we need to disable this. # # Also support ccache compilation if USE_CCACHE is defined as "1" # @@ -43,9 +43,13 @@ PROGSUFFIX=${PROGNAME##$PROGPREFIX} EXTRA_FLAGS= -# Special case #1: For x86, disable SSE FPU arithmetic, and PIC code -if [ "$ARCH" = "x86" -a "$PROGSUFFIX" = gcc ]; then - EXTRA_FLAGS=$EXTRA_FLAGS" -mfpmath=387 -fno-pic" +if [ "$PROGSUFFIX" = gcc ]; then + # Special case #1: For all, disable PIC code + EXTRA_FLAGS=$EXTRA_FLAGS" -fno-pic" + if [ "$ARCH" = "x86" ]; then + # Special case #2: For x86, disable SSE FPU arithmetic too + EXTRA_FLAGS=$EXTRA_FLAGS" -mfpmath=387" + fi fi # Invoke real cross-compiler toolchain program now -- cgit v1.1