Remove All Ads from XDA

[GUIDE/ROM] Project Rookie - How to's - Building ROMs, Kernels & Mods [TEAM ROOK]

2,653 posts
Thanks Meter: 4,894
By car vs driver, Senior Member on 26th July 2012, 08:04 PM
Post Reply Email Thread
Welcome to Project Rookie:
This is the unofficial guide to ROM, Kernel and AROMA installer building. This guide is primarily geared toward building for the AT&T Samsung Galaxy Skyrocket, but as a general guide it will work for all devices (you just need to know where to plug in your device specific repos and commands). The intended audience is for individuals with basic knowledge of linux, a degree of knowledge in basic troubleshooting and a general curiosity for how this stuff works.

This thread is extraordinarily long and is jam packed full of useful information. Please SEARCH the thread before asking questions related to building. If you cannot find your answer, or need additional clarification then don't hesitate to ask. Everyone participating here is knowledgeable and helpful to new builders, so don't abuse it – any flaming will immediately be reported to the moderation team.

In the very least, read through the first posts of this thread in detail, at least twice, before you start building and running commands to get setup.

On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.

OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. Nobody here has an ego about this, and we all want to help. But, we all struggled to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. This is an ever-changing thread; team members are working on or currently building all types of ROMs, kernels and other MODs like AROMA installer. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, we reserve the right to screw with you about it.

Thread Disclaimer:
The releases, instructions, and extras posted here are to be used at your own risk. We work hard to provide good, workable knowledge and builds, and test our work before posting it up front. Nevertheless, no one is responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!

Thread Table of Contents:
Post 1:
- Linux system configuration (Ubuntu 12.04 & 13.04)
- ROM building instructions for CM10.2, AOKP, PACMAN

Post 2:
- Instructions for kernel building, along with other additions, mods, and helpful tutorials

Post 3:
- Misc topics
- Team Rookie ROM & Kernel Distributions
- Links to related topics and specific posts of interest

The tutorial for building your own AROMA installer can be found here:


Setting up your environment :

This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod for Hercules and Skyrocket.

Special thanks to dastin1015 and TeamChopsticks.

Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.

For OSX Mavericks users, check out this thread for getting setup:

Here are the steps from those 2 tutorials in correct order:

1) You need the following:

-JDK 6 if you wish to build Jellybean.

$ sudo apt-get install openjdk-6-jdk
-Python 2.4 -- 2.7, which you can download from Or:

$ sudo apt-get install python
-Git 1.7 or newer. You can find it at Or:

$ sudo apt-get install git-core
-Android SDK:

Download the SDK here:
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:

# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:

You have now successfully installed the Android SDK.

To check for updates issue this into your terminal:

$ android
2) Install required packages. 64-bit (recommended)

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
  x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils lzop schedtool
On newer versions of Ubuntu such as 11.10 you may need to do the following:

$ sudo ln -s /usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/ /usr/lib/i386-linux-gnu/
3) Configure your USB.

$ gksudo gedit /etc/udev/rules.d/51-android.rules
Inside of this blank text file insert:

SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
4) Save the file and close it and then issue this command:

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
5) Install the repo:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo
Create your work directory:

mkdir ~/"your directory name here"     For example: mkdir ~/cm10
cd ~/cm10
This is what you need to begin building. From here, the various types of ROM styles can be built with a few additions and commands.


Initialize the work directory:
repo init -u git:// -b cm-10.2
Create and edit roomservice.xml in .repo: gedit /.repo/local_manifests/roomservice.xml

<?xml version="1.0" encoding="UTF-8"?>
  <project name="CyanogenMod/android_device_samsung_skyrocket" path="device/samsung/skyrocket" remote="github" revision="cm-10.2" /> 
  <project name="CyanogenMod/android_device_samsung_hercules" path="device/samsung/hercules" remote="github" revision="cm-10.2" /> 
  <project name="CyanogenMod/android_device_samsung_msm8660-common" path="device/samsung/msm8660-common" remote="github" revision="cm-10.2" /> 
  <project name="CyanogenMod/android_kernel_samsung_msm8660-common" path="kernel/samsung/msm8660-common" remote="github" revision="cm-10.2" /> 
  <project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-10.2" /> 
  <project name="CyanogenMod/android_device_samsung_celox-common" path="device/samsung/celox-common" remote="github" revision="cm-10.2" /> 
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-10.2" />

repo sync -j16 (this may take a few hours as it downloads ~17GB of source)

To Build:

. build/ (notice the period and space)
repo sync -j16
For Skyrocket:

$ CM_EXTRAVERSION=mycustombuild CM_SNAPSHOT=1 brunch cm_skyrocket-userdebug
$ breakfast cm_skyrocket-userdebug
$ brunch cm_skyrocket-userdebug
For Hercules:

CM_EXTRAVERSION=mycustombuild CM_SNAPSHOT=1 brunch cm_hercules-userdebug

**After you build, your repo files will remain in place. This will cause your future builds to be based from that specific time of additions and merges. Wiping or 'cleaning' your files often will ensure that your builds are the most up-to-date. To be sure that you start with a fresh repo at the beginning of every build, you should 'make clean' often. For example:

$ cd ~/cm10
$ make clean (or 'make clobber' without quotes)
If you want to have your 'cleaning service' done as part of your process, this is a way to achieve it:

$ cd cm10
$ repo sync -j16
$ . build/ && make clobber && CM_EXTRAVERSION= mycustombuild CM_SNAPSHOT=1 brunch cm_skyrocket-userdebug
This will make the cleaning process automatic.

The Git can be found here:


The steps are essentially the same as CM10.2 ... just have to make a couple changes to your git init and your roomservice.xml as follows:

repo init -u git:// -b cm-11.0
Create and edit roomservice.xml in .repo: gedit /.repo/local_manifests/roomservice.xml

<?xml version="1.0" encoding="UTF-8"?>
  <project name="CyanogenMod/android_device_samsung_skyrocket" path="device/samsung/skyrocket" remote="github" /> 
  <project name="CyanogenMod/android_device_samsung_hercules" path="device/samsung/hercules" remote="github" /> 
  <project name="CyanogenMod/android_device_samsung_msm8660-common" path="device/samsung/msm8660-common" remote="github" /> 
  <project name="CyanogenMod/android_kernel_samsung_msm8660-common" path="kernel/samsung/msm8660-common" remote="github" /> 
  <project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github"  /> 
  <project name="CyanogenMod/android_device_samsung_celox-common" path="device/samsung/celox-common" remote="github" /> 
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" />
The remaining steps to build are the same ... breakfast, lunch, brunch etc.


This is a set of steps to set up and run an AOKP build. Special thanks to m4570d0n for taking the time to share his detailed instructions, and R41NS for his assistance in providing some simplifications. Buy those guys a beer if you see them!

It's actually pretty close to CM. It's just several tiny changes. I made some changes that are not necessary but did so to conserve space. With CM's manifest setup, you don't have to worry about downloading a bunch of stuff you don't need but with AOKP, by default you're downloading all the kernels and /device/whatever for pretty much all devices and I didn't want to do that so here's what I did.

repo init -u -b jb-mr1
2) Create local_manifest.xml in .repo with the following in it:

3) Next, do a repo sync.

4) Edit to have the following in it :
add_lunch_combo aokp_skyrocket-userdebug
Also, open and change it to this :
$(call inherit-product, $(SRC_TARGET_DIR)/product/

## The gps config appropriate for this device
PRODUCT_COPY_FILES += device/common/gps/gps.conf_US_SUPL:system/etc/gps.conf

## (2) Also get non-open-source specific aspects if available
$(call inherit-product-if-exists, vendor/samsung/skyrocket/

## misc

## overlays
DEVICE_PACKAGE_OVERLAYS += device/samsung/hercules/overlay

# Device uses high-density artwork where available
PRODUCT_AAPT_CONFIG := normal hdpi

# Hardware

# Ramdisk
device/samsung/skyrocket/ramdisk/init.qcom.rc:root/init.qcom.rc \
device/samsung/skyrocket/ramdisk/ \
device/samsung/skyrocket/ramdisk/init.qcom.usb.rc:root/init.qcom.usb.rc \
device/samsung/skyrocket/ramdisk/ \
device/samsung/skyrocket/ramdisk/ \
device/samsung/skyrocket/ramdisk/ueventd.rc:root/ueventd.rc \
device/samsung/skyrocket/ramdisk/init.emmc.rc:root/init.emmc.rc \

# BT firmware

# Vold


# common msm8660
$(call inherit-product, device/samsung/msm8660-common/

$(call inherit-product, frameworks/native/build/

$(call inherit-product-if-exists, vendor/samsung/skyrocket/

#WIFI_BAND := 802_11_ABG
#$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/


**With the exception of making the change to use the Hercules overlay, the other edits to are optional, and will cause different results with the different options you use.

5)Go to vendor/AOKP/products and create a file that is essentially copied from the :
# Inherit AOSP device configuration for skyrocket.
$(call inherit-product, device/samsung/skyrocket/

# Inherit common product files.
$(call inherit-product, vendor/aokp/configs/

# Inherit GSM common stuff
$(call inherit-product, vendor/aokp/configs/

# skyrocket overlay
PRODUCT_PACKAGE_OVERLAYS += vendor/aokp/overlay/hercules

# Setup device specific product configuration.
PRODUCT_NAME := aokp_skyrocket
PRODUCT_DEVICE := skyrocket


# boot animation
Then go to vendor/AOKP and

6) Add the file in Step 5 to vendor/AOKP/products/ :
$(LOCAL_DIR)// \
7) In vendor/AOKP open and add this :
add_lunch_combo aokp_skyrocket-userdebug
8) Go to and select "Download as zip." After the download completes, open the archive and extract the "skyrocket" folder to /vendor/samsung.


8) cd to your home directory. Download the proprietary_vendor_samsung repo from Team Chopsticks and then copy the skyrocket directory to /vendor/samsung:
git clone -b jellybean
cp -r proprietary_vendor_samsung/skyrocket aokp/vendor/samsung

9) Start building :
. build/
lunch aokp_skyrocket-userdebug && mka bacon


By popular demand, here is a set of steps for building Slimbean - Many thanks to onlychevys for taking the time to lay this out

To build Slim Bean, you do the same as cm10 only with their platform_manifest:

(The manifest code is too long to place here, sorry)

If you have the space on your hard drive, then you can copy the .repo file from cm10 or aokp etc (.repo is a hidden file,cntrl + h to see it) to another directory and delete the local_manifest in there.

repo init -u git:// -b jb4.2
Copy this code to terminal while in that directory to initialize their repo.

repo sync -j16
**Copying the .repo saves about 3 plus hours of downloading aosp source.

Then you should be ready to build.

Start building :

. build/
lunch slimbean_skyrocket-userdebug && mka bacon

PAC-man :

This is a newer but very functional and well-liked compilation of three builds: Paranoid Android, CM, and AOKP. Here is a brief set of steps from the PAC git:

To get started with PAC-man, you'll need to get familiar with Git and Repo.

To initialize your local repository using the PAC-man trees, use a command like this:

repo init -u git:// -b cm-10.1
Then to sync up:

repo sync
After the syncing process completes, you can run your build commands:

. build/
repo sync -j16
And finally:

./ skyrocket -j16

The Git can be found here:
The Following 94 Users Say Thank You to car vs driver For This Useful Post: [ View ] Gift car vs driver Ad-Free
26th July 2012, 08:04 PM |#2  
car vs driver's Avatar
OP Senior Member
Flag Earth
Thanks Meter: 4,894
Angry [GUIDE/ROM] Project Rookie - How to's - Building ROMs, Kernels & Mods [TEAM ROOK]
Some github information from @m4570d0n who has some serious git-fu skills.

Originally Posted by m4570d0n

You don't have to cd into a project directory to do a repo sync for that project. You can just run repo sync path/to/project. from the root of your build tree.

While I'm here, someone asked me about some git stuff recently, and I figured the info might be useful here as well....

Start with the tutorials on github.

Also, don't underestimate the usefulness of --help. It's nearly a universal rule that adding "--help" to any command will bring up a help menu for that command. For git, it's particularly helpful for me, and literally every git command has it's own help file, and usually has example commands as well. For example, each of these will bring up a different help file:
git branch --help
git pull --help
git log --help
git remote --help
git show --help
etc., etc.

You can also just browse the whole manual, which is where those help files come from.:

I've also had a few specific things I was trying to figure out how to do on git and in the process found some nice sites/articles that were very helpful:

Visual Git Cheat Sheet

git howto: revert a commit already pushed to a remote repository - Christoph Rüegg

On undoing, fixing, or removing commits in git

More reference info with examples:

a few miscellaneous command I picked up that I found useful.

commit a change created by someone else, and manually retaining the original author of the commit:
git commit --author="John Doe <[email protected]>"
commit a change created by someone else, and manually retaining the original author and the original commit date:
git commit --author="John Doe <[email protected]>" --date="Thu Oct 03 20:19:03 2013 +0000"
Push a change to CM's gerrit or PAC-man's gerrit:
git push ssh://[email protected]:29418/android_packages_apps_Setting HEAD:refs/for/cm-10.2
git push ssh://[email protected]:29418/android_packages_apps_Settings HEAD:refs/for/cm-10.2
Find the git index blob associated with a particular file:
[email protected]:~/PAC$ cd frameworks/base
[email protected]:~/PAC/frameworks/base$ git hash-object core/res/assets/images/android-logo-mask.png
Also there's a couple extra git packages in the official Ubuntu repos that can be pretty handy. One is called git-stuff. I'm pretty sure the guy that created that is one of the dudes in CM (author is Daniel Baumann and I see commits on CM's gerrit almost daily from a guy named Danny Baumann).

Two others:

git gui is kinda cool and noob friendly. In order to use it, just cd into a folder that has a git repo in it and type:
git gui
Another useful git command is git stash.

Let's say you made some local changes to /packages/apps/Mms. If you wanted to cherry-pick a commit that involved any files you changed locally, the cherry-pick would fail because there are uncommitted changes. You could commit them, but then they would be undone on your next repo sync. With git stash, it will save your uncommitted changes. Then you can apply the cherry picks, and then apply your changes again on top of them by running:
git stash apply
Note: that will work if you only have one stash or if your most recent stash is the one you want to apply, otherwise you will have to add the name of the stash as well. For reference on git stash command options like listing the stashes, diffs, etc. see this:

The Following 7 Users Say Thank You to car vs driver For This Useful Post: [ View ] Gift car vs driver Ad-Free
26th July 2012, 08:05 PM |#3  
BMP7777's Avatar
Senior Member
Flag Dacula, Ga
Thanks Meter: 2,570
Donate to Me

Building your first kernel :

This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here:

Step 1. Build Environment

A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)

B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.

C. Open a terminal

D. Type
mkdir android
E. Type
cd android
mkdir kernel

Step 2. Your Source

A. Open your Terminal Prompt

B. Type
cd android/kernel
C. Type
git clone git:// toolchains
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.


Step 3. Modifications

This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.

Mod 1. Applying a patch

A. Download the patch you wish to apply, in this case this one should work.

B. Save that file as "kernelPatch" in your kernel directory.

C. Open a Terminal

D. Move into the root directory of the kernel you wish to patch.

E. Type
patch -p1 < ../kernelPatch

Mod 2. Adding a Governor Alone

A. Open "drivers/cpufreq/Kconfig"

B. Add the following lines in appropriate spot amongst the other govenor's

            bool "smartass"
            select CPU_FREQ_GOV_SMARTASS
            select CPU_FREQ_GOV_PERFORMANCE
              Use the CPUFreq governor 'smartass' as default.
           tristate "'smartass' cpufreq governor"
           depends on CPU_FREQ
             smartass' - a "smart" optimized governor!
             If in doubt, say N.
C. Open "drivers/cpufreq/Makefile"

D. Add the following line in the appropriate spot.

 obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS)     += cpufreq_smartass.o
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"

F. Put the following code in that file.

G. open "include/linux/cpufreq.h"

H. Under the "Cpufreq Default" section add

extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)
Ok there is a governor added, do the exact same steps for any other one's you would like to add.

Step 4. Getting a Config file

Option A. Pulling a config file from a kernel.

A. Hook up a device that is using a kernel similar to one you are using as your base.

B. Open a terminal

C. Change to your root kernel directory

D. Type
adb pull /proc/config.gz
E. Type
gunzip config.gz
F. Type
mv config arch/arm/configs/<your_config_name>_defconfig

Option B. Using the manufacturers config.

Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.

Step 5. Building

Time to start the real "build" section of this tutorial.

Part A. Pre-build Steps

A. Open terminal and change to the root of your kernel directory

B. Type
export ARCH=arm
C. Type
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
Part B. The First Build

A. Type
make <your_config_name>_defconfig
B. Type
make menuconfig
and make the required changes to use any modules you added or similar changes.

C. Type
make -j<maximum number of jobs>
Part C. Re-Builds

A. Type
make clean
B. Type
make oldconfig
C. Type
make -j<maximum number of jobs>
Part D. Building Modules

You have two options:

A. Type
make modules
B. Type
make path/to/your/module.ko
The above steps explained:

Part A.(These steps are required every time you close your terminal and re-open it to build again.)

A. Ok shouldn’t need to explain this.

B. This command sets your target architecture.

C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.

Part B.(These only need to be run the first time you build a kernel.)

A. Load's your configuration file from earlier.

B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.

C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.

Part C. (Use the command's when you are building any-time outside of the first)

A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.

B. A very awesome command, it parses through what has changed and only prompts you about new options.

C. See the explanation for the above "Part C.".

Part D.(Use these for just building kernel modules.)

A. This will re-build all modules.

B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.

Step 6. Now what

Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:

Outcome A. Build Succeeds

W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):

A. Open a terminal

B. Change to your root kernel directory

C. Type
mkdir ../<your_kernel>_output
D. Type
cp arch/arm/boot/zImage ../<your_kernel>_output/zImage
E. Type
find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;
The above steps explained:

A-C. Self-Explanatory

D. Move our kernel binary into our output folder

E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.

You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.

building android kernel image
xda build kernel image
xda unpack boot.img
Outcome B. Build Fails

Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.

Running a "Clean" build

A. Backup your config file - Type
cp .config ../backupConfig
B. Re-run the build process using just your defconfig from earlier.

Limiting Output(Thanks Hacre.)

A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.


Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :

If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.

Install it with apt-get:
sudo apt-get install ccache
Set environment vars for Android use:
(I put these exports in my .bashrc)

export USE_CCACHE=1
export NDK_CCACHE=ccache
Set a cache size of 10G for optimal results:

ccache -M 10G
Check the status of your cache with the command:

ccache -s 


cache directory                 /home/jocala/.ccache
cache hit                         106673
cache miss                         18379
called for link                     3758
preprocessor error                     5
not a C/C++ file                    4425
unsupported compiler option          678
no input file                       4565
files in cache                     36758
cache size                           3.2 Gbytes
max cache size                      10.0 Gbytes

Instructions for submitting to Gerrit are listed here:

Special thanks to m4570d0n for putting this together for everyone

If you wanted to add something like, for example, Titanium Backup, you could go to /vendor/cm/config/ and starting on line 98 where you see:

    vendor/cm/proprietary/RomManager.apk:system/app/RomManager.apk \
    vendor/cm/proprietary/Term.apk:system/app/Term.apk \
    vendor/cm/proprietary/lib/armeabi/ \

and add a line below that like this:


Then just place your TitaniumBackup.apk in the /vendor/cm/prebuilt/common/apps folder. You can modify that folder location to whatever folder you want to use, and you can substitute Titanium Backup with whatever apk you'd like. Take note though that this will install it as a system app in /system/app, while most apps would normally be installed as a user app in /data/apps. I think you could change the location to /data/app in that line, but I'm not positive. Someone please correct me if I'm wrong. I mean, I know you can, but I'm not sure if it would be an issue when you flash a zip without wiping /data and the zip file has files in /data.

You could also create your own github repo, name it something like vendor_onlychevys and add that repo to your local manifest with the path as vendor/onlychevys. Then you could use that as your directory path to the apps you want to add.

The slightly longer, but better way, is that you could also create your own make file in that repo by copying /device/samsung/skyrocket/ to your repo and rename it (let's say vendor_onlychevys/products/ and add a line in that file with something like this:

# Inherit some common onlychevys stuff.
$(call inherit-product, vendor/onlychevys/config/

and also editing the product name in that file near the bottom to something like this:

PRODUCT_NAME := onlychevys_skyrocket

You would need to make 3 more files.
In that same directory make a file called and in that file add this:


Next, copy /vendor/cm/config/ to your repo at vendor_onlychevys/config/ Then edit that file by adding a line in there with something like this:


And make sure to put your app in that prebuilt/common/apps/ directory in your repo.

Finally, create a new file in gedit (or other text editor of your choice). In that file add this:

 add_lunch_combo onlychevys_skyrocket-userdebug

Name the file and put it in your repo at vendor_onlychevys/

Now, when you want to build you can run:

. build/
brunch onlychevys_skyrocket-userdebug

This will be the same as if you used the regular command but will also include whatever apks you want to put in your repo, since you are just copying those files and adding a line to also include your stuff. This way, though you can add apps and/or make changes to your repo and you wont get errors about having local changes to vendor/cm or wherever when you try to run repo sync. You also wont have to keep deleting and re-adding the same files over and over after every sync because they will be in your own repo.

And just for clarity, your repo would look something like this:

|-- config
|   `--
|-- prebuilt
|   `-- common
|   |   `-- apps
|   |       `-- TitaniumBackup.apk
|-- products
|   |--
|   `--

More advanced instructions to be posted as time allows. Now, get to work!

CHERRYPICKING: If you have progressed beyond the level of copying and pasting, and have begun researching the 'cherry-picking' process, there is a brief set of steps regarding this on post #1292 :
This should give those interested a basic idea of the process. More detailed instructions are going to be posted as time allows.
NOTE: the cherry-picks listed in that tutorial are no longer neccesary. They have been merged, and don't require picking. But, for the informational purposes, the steps are useful. Thanks to m4570d0n for laying that out for everyone!
The Following 40 Users Say Thank You to BMP7777 For This Useful Post: [ View ] Gift BMP7777 Ad-Free
26th July 2012, 08:05 PM |#4  
BMP7777's Avatar
Senior Member
Flag Dacula, Ga
Thanks Meter: 2,570
Donate to Me
Links for all relevant topics:

Here are some relevant topics/tutorials/sites:

Download | Ubuntu -

Official Ubuntu Documentation: Help for all versions. -

How To Windows Dual Boot: -

How To Use The Terminal: Commandline stuff. -

[HOW TO] Beginners Guide to Android ROM Development - (courtesy of isidromxz)

[Tutorial] Compile JB on Ubuntu - (courtesy of dastin1015)

[CM10] [PPA] Cyanogenmod Compiler v0.6 - (courtesy of lithid-cm)

[WIP][CM10] CyanogenMod 10 Alpha | tutorial - (courtesy of sk8erwitskil)

[Wiki] How to: Gerrit -

[Wiki] How to: Git -

[Wiki] How to: Connect to device with SSH -

Here is an easy-to-use page on common Linux commands: -

Linux Newbie Guide : -

Also, Team Chopsticks has a good page with some useful tips as well, located here: (thanks to bdusmc for the tip)

Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! :

Building AOKP from source :

Link to AOKP (Android Open Kang Project) · GitHub :

Link to AOKP news :

Link to R41NS AOKP work :

Link to aznrice2k4s other Skyrocket and OneX work :

Builds :

M4570D0N has a new PAC-man ROM for all to see, use and emulate!


based on the latest AOSPA (ParanoidAndroid 3.14+)

plus the latest CM10.1

plus the latest AOKP-MR1

In addition to everything included in the vanilla PAC-man build I've added:

internal/external sdcard storage options for Camera/Gallery

Alt-signal layout from AOKP

CM circle battery from CM10/10.1

Titanium Backup


M4570M0D v1.1

tiny gapps


The Following 13 Users Say Thank You to BMP7777 For This Useful Post: [ View ] Gift BMP7777 Ad-Free
26th July 2012, 08:06 PM |#5  
Account currently disabled
Flag Chicago
Thanks Meter: 64
I think you should call it project powerthrust....much catchier

Sent from my SAMSUNG-SGH-I727 using xda app-developers app
26th July 2012, 08:39 PM |#6  
Senior Member
Flag Washington DC
Thanks Meter: 76
i really want this thread to go somewhere so im going try and set up my build environment and see if i can get jb to compile. im using ubuntu 12.04 because i think soon its going to become the new standard for building. here is some instructions by sk8rwitskil
26th July 2012, 08:47 PM |#7  
Senior Member
Flag Brampton
Thanks Meter: 732
Originally Posted by mbucks911

no offense, but you probably should have actually built something before creating this thread because just creating this thread isnt going to "get the ball rolling" but what will is a starting point or an alpha build for the aspiring developers to look at and try to debug and make better. right now you just look like "that guy" that just wanted attention by trying to start something in the dev thread

I respectfully disagree. I am happy to see this thread (I think my comments in the WIP CM10 are what prompted it) and I fully support it. People need to have a place to learn to develop and build ROMs from source, and this is a step to help provide that place without clogging up other more focused dev threads. I don't think anyone is trying to use the thread to get attention, other than to get others involved, talking, debugging and building.

The Following 11 Users Say Thank You to rpr69 For This Useful Post: [ View ] Gift rpr69 Ad-Free
26th July 2012, 08:48 PM |#8  
Account currently disabled
Flag Chicago, IL
Thanks Meter: 1,400
Yea it might have been better to post in general guys. Looking forward to this and good luck

Sent from my Nexus 7 using xda premium
The Following 2 Users Say Thank You to armyveterangunner29 For This Useful Post: [ View ] Gift armyveterangunner29 Ad-Free
26th July 2012, 08:56 PM |#9  
Decepticaons's Avatar
Senior Member
Flag Byron Center
Thanks Meter: 272
I'm jumping on board here too. Feel free to mosey on over to fb and join our group. It's called Team NAND, it is for aspiring devs as well. Only it isn't intended for jb only.

I'm hoping to have all my prereqs set up by the weekend and ill post my first build here. Good luck everyone.

Sent from my SAMSUNG-SGH-I727 using xda app-developers app
26th July 2012, 09:02 PM |#10  
confyzone's Avatar
Senior Member
Flag Manitoba
Thanks Meter: 69
Go TEAM ROOKIE aha but yea I'm all set up and ready to go developing with everyone else

Sent from my SAMSUNG-SGH-I727 using xda app-developers app
26th July 2012, 09:03 PM |#11  
BMP7777's Avatar
Senior Member
Flag Dacula, Ga
Thanks Meter: 2,570
Donate to Me
Originally Posted by mbucks911

no offense, but you probably should have actually built something before creating this thread because just creating this thread isnt going to "get the ball rolling" but what will is a starting point or an alpha build for the aspiring developers to look at and try to debug and make better. right now you just look like "that guy" that just wanted attention by trying to start something in the dev thread

i do want this thread to go somewhere so im going try and set up my build environment and see if i can get jb to compile. im using ubuntu 12.04 because i think soon its going to become the new standard for building. here is some instructions by sk8rwitskil

WOW that didn't take long. Thanks for that. Real helpful. I was trying to start a place for those of us that really want to provide builds, but HAVEN"T yet. I spent two days getting my environment together and have seen so many posts from other feeling the same way that this seemed like a good idea, until now. I specifically said that I assumed no control over this thread. If you actually looked anywhere else, you would see that myself and quite a few other rookies have been posting on sk8rs thread for the better part of two weeks. We need novices that want to help, not start static. Sheesh
The Following 14 Users Say Thank You to BMP7777 For This Useful Post: [ View ] Gift BMP7777 Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes