[Galaxy S II Android Development] fusionjack:
How to build SlimSaber or SlimKernel from scratch

I want to show you how easy is building SlimSaber or SlimKernel. This is how what I did to build them starting with installing Ubuntu:

Installing Ubuntu 14.04

Installing Java 7

Installing Android dependencies including Git

See android official site as well.

Installing Repo

Downloading SlimSaber source codes

Source codes size is around 34 GB, so it takes time to download them depends on your internet connection. Adjust the number of '-j5' to reflect your internet connection speed.

Building SlimSaber

The output folder is around 16 GB per device. The ccache also needs space. I set up to 50 GB by default. If you only build for one device, it only takes less than 10 GB.

The first building time could take from 90 minutes up to 6 hours or even more, depends on your machine. The second one will be much faster since it uses ccache.

See what the parameters mean here

Building SlimKernel

Note: This will do a 'make clobbler' by default.

See what the parameters mean here

It might not work on lp5.x, I need to check it.

Have fun by building...:D

Advanced

Changing toolchain in SlimSaber

The toolchains are by default located in prebuilts/gcc/linux-x86/arm/ folder where x is the toolchain version:

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

SlimSaber is by default is using Google toolchain 4.8. You can change it via local manifest (.repo/local_manifests/slim_manifest.xml) or via slim.dependencies in device repo.

Following is an example for using Uber toolchain 4.9 via local manifest:

<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" />

<remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" />

<project name="SlimSaber/uber_arm-androideabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" remote="github" revision="master" />

<project name="SlimSaber/uber_arm-eabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.9" remote="github" revision="master"/>

Following is an example for using Uber toolchain 4.9 that supports Cortex-A15 via slim.dependencies:

{
"repository": "SlimSaber/uber_arm-androideabi-4.9-cortex-a15",
"target_path": "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9-cortex-a15",
"branch": "master"
},
{
"repository": "SlimSaber/uber_arm-eabi-4.9-cortex-a15",
"target_path": "prebuilts/gcc/linux-x86/arm/arm-eabi-4.9-cortex-a15",
"branch": "master"
}

After doing those above, you need to adjust the toolchain version. See below.

Changing toolchain version in SlimSaber

You can change the toolchain version by defining TARGET_GCC_VERSION_EXP in the device repo BoardConfig.mk: TARGET_GCC_VERSION_EXP := 4.8

Change this either to TARGET_GCC_VERSION_EXP := 4.9 or TARGET_GCC_VERSION_EXP := 4.9-cortex-a15

This flag has disadvantage because the version will be used for both arm-linux-androideabi-x and arm-eabi-x. In order to achieve different version for both of them, I use a trick 'The same folder name'.

Let's assume you want to use 4.8 for Rom and 4.9 for Kernel:

<project name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" remote="github" revision="master" />

<project name="SlimSaber/uber_arm-eabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.9" remote="github" revision="master"/>

TARGET_GCC_VERSION_EXP := 4.9

libisl.so.13: cannot open shared object file: No such file or directory

You need to update your libisl. Here is how to update it in ubuntu: http://xdaforums.com/showpost.php?p=57697934&postcount=8490

download the deb file from here: http://packages.ubuntu.com/vivid/libisl13
sudo dpkg -i libisl13_0.14-1_amd64.deb

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

Run this command:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

If you don't see the .20, that means you don't have .20 installed. Here is how to install it: http://xdaforums.com/showpost.php?p=58281226&postcount=82

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -q
sudo apt-get install -y libstdc++