[Vibrant General] Synergy510:
How to use another toolchain

Okay, I'm going to explain how to compile with different toolchains, namely SaberMod or Linaro. This may not be *the exact way*, but this is what works for me

1) First locate the toolchain you want to use and find it's github. Here are two examples:

Linaro provided by JustArchi: https://github.com/archidroid/toolchain

SaberMod provided by kykdev (optimized for arm cortex architecture): https://github.com/kykdev?tab=repositories

Two notes about toolchains:

arm-eabi == kernel toolchain

arm-linux-androideabi == ROM toolchain​

2) Once you've located it, add it to your roomservice.xml (or in the case of this thread vibrantmtd.xml)

When you add something to your roomservice/vibrant.xml, repo sync will gather these files from github for you and place there where you specify

A generic example of adding the toolchain:

from: https://github.com/SOME_USER/THEIR_REPO

<project name="SOME_USER/THEIR_REPO" path="prebuilts/gcc/linux-x86/arm/arm-eabi-SOME_SPECIAL_NAME" remote="github" revision= "BRANCH" />

By SOME_SPECIAL_NAME, I mean name it what it is. Linaro-4.9.2 or SaberMod-4.8.4 etc etc

By BRANCH, the user's THEIR_REPO might contain both the arm-eabi and arm-linux-androideabi

Example 1:

Looking at kykdev's github, each repo is it's own toolchain, so there is no BRANCH you have to declare. So do this:

<project name="kykdev/sabermod-arm-cortex_a15-eabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-eabi-SM-Combo" remote="github" revision="master" />
<project name="kykdev/sabermod-arm-cortex_a15-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-SM-Combo" remote="github" revision="master" />

Notice how I grab what I needed, see the "project name" and see where they go:

path="

prebuilts/gcc/linux-x86/arm/arm-eabi-

SM-Combo"

path="

prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-

SM-Combo"​

The underlined part must stay as it is, but the bold part is the SOME_SPECIAL_NAME. This is going to come handy later when you tell the ROM which toolchain to use. This is why I use "4.8" in both the ROM and kernel toolchains although the kernel toolchain is labeled as 4.9. Since there are no branches here, you declare BRANCH as "master" or whatever the default branch name is on the github repo

Example 2:

Lookin at JustArchi's repo, everything is listed under his "Toolchain" repo.

<project name="ArchiDroid/Toolchain" path="prebuilts/gcc/linux-x86/arm/arm-eabi-Linaro-4.9.2" remote="github" revision="linaro-4.9-arm-eabi" />
<project name="ArchiDroid/Toolchain" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-Linaro-4.9.2" remote="github" revision="linaro-4.9-arm-linux-androideabi" />

Nothing the "project name" is the same, so this means we need to specify a BRANCH to get the proper toolchain

revision="linaro-4.9-arm-eabi"

revision="linaro-4.9-arm-linux-androideabi"
​

Notice! The "path" stays the same with same SOME_SPECIAL_NAME

path="prebuilts/gcc/linux-x86/arm/arm-eabi-Linaro-4.9.2"

path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-Linaro-4.9.2"
​

Now when you repo sync, your toolchains will be in your build environment

3) How to tell the build which toolchain to use

Locate the file: ~/android/system/core/combo/TARGET_linux-arm.mk

In this find the line that says:

TARGET_GCC_VERSION :=

After the " := " You're going to remove what was already there, probably "4.7" and change it to your SOME_SPECIAL_NAME, so:

TARGET_GCC_VERSION := SOME_SPECIAL_NAME
example:
TARGET_GCC_VERSION := Linaro-4.9.2

4) If you already made a build with the default toolchain

You should not build immediately after following these steps because you have pre-compiled packages in your build directory and you MUST clean it out whenever you switch toolchains so everything is compiled with the same toolchain. So you must use these commands after changing the toolchain and before making the build:

cd ~/android/system/
rm -rf ~/.ccache
make clean
make clobber

That's it! You can now brunch vibrantmtd and watch it compile!

Notes

You can mix and match toolchains, but your mileage may vary

Not every toolchain is guaranteed to work. You MAY run into some errors

Try to keep your ROM and kernel toolchains to the same type of toolchain (Linaro, SaberMod, Google)

I think I touched on everything I do with this post, if I missed something or if it doesn't work for you, let me know!