Sunday, November 10, 2013

Alt GCC android build

Have you ever had the thought of "Hey GCC has some room for improvement in my android kernel build?" Well of course you did, even if you didnt know it. One of the most well known GCC tool chains is Linaro. This tool chain includes many optimizations over GCC. Needless to say I wont bother you with too many details. Lets just say that a built kernel with an alt GCC tool chain gives android many performance improvements.

Now to the fun part. How does one do such a thing? For my builds I use the SABERMOD toolchain. It includes much of Linaro with a few more optimizations. Linky's below:

Linaro 4.8 and SABERMOD 4.9

Now within your ROM's working directory

$ cd <working dir>/prebuilts/gcc/linux-x86/arm

Unpack whichever tool chain you would like to use.

Next!

$ sudo gedit build/envsetup.sh
  
Look for the following line (line 155)



 # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
    export ANDROID_EABI_TOOLCHAIN=
    local ARCH=$(get_build_var TARGET_ARCH)
    case $ARCH in
        x86) toolchaindir=x86/i686-linux-android-$targetgccversion/bin
            ;;
        arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
            ;;
        mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
            ;;
        *)
            echo "Can't find toolchain for unknown architecture: $ARCH"
            toolchaindir=xxxxxxxxx
            ;;
    esac
This is the directory to your tool chain change it to your new tool chain location. For example my line 155 reads
 arm) toolchaindir=arm/sabermod-4.9/bin
because that is the name of my directory in "prebuilts/" .
After making those changes you you are ready to build the android. Continue with lunch or a build script if provided.
Good Luck!!
**As always for those who care
   Ubuntu 13.10, PAC-rom 4.3, SABERMOD4.9