How to build SuperNexus for Galaxy S3 on Linux

SuperNexus is a project that focusses on providing Google Nexus experience on Samsung devices. The ROM is based on AOSP code with slight improvements and optimizations (e.g. battery life time). It is great ROM if you want the basic Google layout without modifications from the operator or manufacturer on your mobile phone.

You can download the prebuilt ROM from xda (http://forum.xda-developers.com/showthread.php?t=2076672). If you want to build it yourself, you will have to checkout the source code from github (https://github.com/SuperNexus) and go through this styp by step tutorial.

1. Build Environment

If you haven't done this already, you have to initialize your build environment for android source code building. I don't want to describe that again as there is a great tutorial for this on android developer pages:
http://source.android.com/source/initializing.html

2. Download the code

The source code which you will have to download is a combination of three source code projects. Fortunately, you won't have to care much about where you download the code from. SuperNexus provides a manifest file which helps you to download all neccessary files:

$ mkdir SuperNexusJB
$ cd SuperNexusJB
$ repo init -u https://github.com/SuperNexus/android_manifest.git -b jellybean
$ repo sync -j8

This can take some time (for me it took around 2 hours depending on the connection).

3. Set the build configuration

Now you have the source. First thing you have to do is to set the build environment.

$ . build/envsetup.sh
$ . vendor/supernexus/vendorsetup.sh
$ lunch i9300-userdebug

The last command sets the configurations for the samsung galaxy s3. If you want to build for a different platform you can check the list by typing lunch without parameter.

4. Get proprietary drivers

Unfortunately we did not find a way to reliably retrieve the proprietary drivers for different stock ROM. The location of the driver often changes between versions and therefore the script to extract the binaries will not find all files. The most reliable way to get the drivers is to install SuperNexus on your device first and extract it from there.

Go to the developer page of SuperNexus at xda-developers. There you can download the current otapackage of SuperNexus which you will have to install using ClockWorkMod (Tutorial to install CWM at youtube).

If this is done, connect the Galaxy S3 to your machine and extract the proprietary drivers with the script file that comes with SuperNexus:

$ cd device/samsung/smdk4412-common
$ ./extract-files.sh

5. Build SuperNexus

Now go back to the root directory and start the build.

$ make update-api
$ make -j#

where # is the number of processors which you want to use for your build. Now you can flash the build with heimdall or you make an otapackage (execute the command "make otapackage") which you can install using ClockWorkMod.

Flashing with heimdall:
Goto your output directory "out/target/product/i9300/". Here you will find all finished images of your build. Bring your Samsung Galaxy S3 in to download mode by pressing the Buttons "Vol. down" + "Power" + "Home Button" for around 15 seconds. Press Volume Up again to come into download mode. Now you can flash your phone with heimdall:

$ sudo heimdall flash --primary-boot boot.img --system system.img --user-data userdata.img

6. Adapt the build

You can adapt your SuperNexus build now. But before you do that you should make a new branch with your repo command:

$ repo start <BRANCHNAME> --all

Links

XDA-developer page of the SuperNexus team: http://forum.xda-developers.com/showthread.php?t=2076672
SuperNexus GitHub page: https://github.com/SuperNexus

yorandomusmilelink