Build for i9300

From Omni
Jump to: navigation, search

The following are the directions for building Omni for the Samsung Galaxy S III GT-I9300 (International)

Set up build environment

First, follow the steps below in order to prepare your own environment.
I'm going to being using ~/android/omni to refer to the ROM directory, so if you named it something different then change the names accordingly.

What you'll need

  • A Galaxy S III GT-I9300 (International)
  • A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and about 35-40 GB of free storage (The Android Source Code and OmniROM Build requires a lot of space on disk). The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
  • A micro USB cable (Optional)
  • A decent Internet connection
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom ROMs on other devices and are familiar with what a recovery image such as ClockworkMod or TWRP is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

Just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu. Any recent 64-bit version should work great, but the latest is recommended.

Using a VM allows Linux to run as a guest inside your host computer-- a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

Setting Up a Compile Environment in Ubuntu 13.10

Open terminal with ctrl + alt + t. Then copy paste the code below and hit enter. for 32-bit & 64-bit:

 sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools
 build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 
 libxml2-utils xsltproc lzop libc6-dev schedtool

for 64-bit only:

 sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib

check your java version (it must be 1.6)

 javac -version

if it is 1.7 change it to 1.6

for 64-bit do:

 update-java-alternatives -s java-1.6.0-openjdk-amd64

for 32-bit do:

 update-java-alternatives -s java-1.6.0-openjdk-i386

Double check that all the java alternatives really are pointing to java 1.6 by executing the following command:

 ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar

If they don't, you will very likely get compiler errors. So use the following to change it:

 sudo update-alternatives --config <package_that_is_pointing_to_the_wrong_version>

(Taken from here)

From here, the next step will be Install and Sync the Source Code

Setting Up a Compile Environment in Fedora 19 x64

Source :

First, due to some difference in the paths, installing Oracle's JDK6 is the easiest way to go: Oracle's JDK [1] Once downloaded,

sudo sh jdk-6u45-linux-x64-rpm.bin
sudo ln -s /usr/java/default/bin/javah /usr/bin/javah

Then, the needed packages:

sudo yum install -y zip curl gcc gcc-c++ flex bison gperf glibc-devel.{x86_64,i686} zlib-devel.{x86_64,i686} ncurses-devel.i686 libX11-devel.i686 libstdc++.i686 readline-devel.i686 libXrender.i686 libXrandr.i686 perl-Digest-MD5-File python-markdown mesa-libGL-devel.i686 git schedtool pngcrush

From here, the next step will be Install and Sync the Source Code

Setting Up a Compile Environment in Mac OS X 10.9 Mavericks

For Setting Up a Compile Environment, Download Source Code and Sync in Mac OS X 10.9 Mavericks follow this guide:

Setting Up a Compile Environment, Download Source Code and Sync in Mac OS X 10.9 Mavericks

It helps you to do almost all steps in Building process. Once finished go to following step: Add Device Repos to Local Manifest

Install and Sync the Source Code

~/android/omni will be our build directory, so create the directories

 mkdir -p ~/bin
 mkdir -p ~/android/omni

Install the repo command

 curl > ~/bin/repo
 chmod a+x ~/bin/repo

Add bin to PATH

 echo "export PATH=~/bin:$PATH" >> ~/.bashrc

Configure git:

 git config --global "your@email.address"
 git config --global "Your Name"

Move to build directory and init the repository:

OmniROM 4.3

cd ~/android/omni
repo init -u -b android-4.3

OmniROM 4.4

cd ~/android/omni
repo init -u -b android-4.4

then download source code

repo sync -j16 -f --no-clone-bundle

NOTE: The -j16 part means that there will be four simultaneous threads/connections. The -f proceed with syncing other projects even if a project fails to sync.
If you have trouble syncing due to connection issues, try repo sync -j4. It's slower but some ISPs have issues with -j16. Want to make sure you didn't get any connection errors and have the complete repository? Just run the repo sync command again. It can't give you ANY errors.

After repo sync command, prepare to wait a long time while the source code downloads.

Add Device Repos to Local Manifest

After you are through it. You have to add the required device repo to manifest (Learn about local manifests -
You can skip this step as brunch command can do it for you but I recommend doing it yourself.
Copy paste the line into local manifest according to requirement.

OmniROM 4.3

<?xml version="1.0" encoding="UTF-8"?>

  <project path="device/samsung/i9300" name="android_device_samsung_i9300" remote="omnirom" revision="android-4.3"/>
  <project path="device/samsung/smdk4412-common" name="android_device_samsung_smdk4412-common" remote="omnirom" revision="android-4.3"/>
  <project path="hardware/samsung" name="android_hardware_samsung" remote="omnirom" revision="android-4.3"/>
  <project path="kernel/samsung/smdk4412" name="android_kernel_samsung_smdk4412" remote="omnirom" revision="android-4.3"/>
  <project path="vendor/samsung" name="DonkeyCoyote/proprietary_vendor_samsung" remote="github" revision="android-4.3" />

OmniROM 4.4

<?xml version="1.0" encoding="UTF-8"?>

  <project path="device/samsung/i9300" name="android_device_samsung_i9300" remote="omnirom" revision="android-4.4"/>
  <project path="device/samsung/smdk4412-common" name="android_device_samsung_smdk4412-common" remote="omnirom" revision="android-4.4"/>
  <project path="hardware/samsung" name="android_hardware_samsung" remote="omnirom" revision="android-4.4"/>
  <project path="kernel/samsung/smdk4412" name="android_kernel_samsung_smdk4412" remote="omnirom" revision="android-4.4"/>
  <project path="vendor/samsung" name="DonkeyCoyote/proprietary_vendor_samsung" remote="github" revision="android-4.4" />

Once correctly set up proper local_manifest.xml file under ~/android/omni/.repo/local_manifests/ you can proceed to the next step

Building the ROM

First, resync the repo for dowloading local_manifest specific code:

cd ~/android/omni
repo sync -j16

Before making the first build, it's recommended that you do this in order to have much faster build times in the future (from hours to minutes).

echo "export USE_CCACHE=1" >> ~/.bashrc
~/android/omni/prebuilts/misc/linux-x86/ccache/ccache -M [insert number of GB you want the cache to be, recommended 10-50]G

eg (set ccache size to 25 GB): ~/android/omni/prebuilts/misc/linux-x86/ccache/ccache -M 25G

Now set envsetup and start building:

. build/
brunch i9300

Since this is the first build, this will take a while to build, generally it tends to take a few hours, subsequent builds will be faster.
There will be a lot of warnings (which will occur with every build, Omni or not) but unless you see "error" written anywhere, there's nothing to worry about.

Build didn't finish due to an error

Make sure you didn't make any typos earlier. If you're sure that you didn't, then search the terminal window for anywhere saying "error" and dump it and the preceding lines onto a Pastebin.
Look for solutions in the XDA forum for Omni and if you can't find anything, then either make a new thread or ask for help in the #omnirom IRC chat.
You can also send me a PM on XDA and I'll try my best to help you.

Build finished successfully!

Congratulations, you have now built OmniROM for your Galaxy S III GT-I9300.
The zip file will be located at following path


and filename will be

OmniROM 4.3


OmniROM 4.4


Flash this file with TWRP, CWM or other recovery like any other ROM.