What you’ll need
- A Phone Which runs Android :P
- A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and storage. 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
- A decent Internet connection & reliable electricity
- 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 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.
You want to use a 64-bit version of Linux. According to Google, 32-bit Linux environment will only work if you are building older versions prior to Gingerbread (2.3.x)/CyanogenMod 7.
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.)
Build ROM and ClockworkMod Recovery
Prepare the Build Environment
You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Next Post.
If you have not previously installed adb and fastboot, install the Android SDK. "SDK" stands for Software Developer Kit, and it includes useful tools that you will can use to flash software, look at the system logs in real time, grab screenshots, and more-- all from your computer.
While the SDK contains lots of different things-- the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.
Several "build packages" are needed to build From Source. You can install these using the package manager of your choice.
A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)
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
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.7-multilib g++-4.5-multilib
libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils
mkdir -p ~/bin
Enter the following to download the "repo" binary and make it executable (runnable):
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo
Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin. Assuming you are using the BASH shell, the default in recent versions of Ubuntu, you can set it like this:
You can make this change to the path permanent for all future Terminal sessions:
Make a Folder to Download the Sources and cd to it. For That:
mkdir -p ~/Source
REPOSITORY'S OF FAMOUS ROMS (Select One)
repo init -u git://github.com/PAC-man/android.git -b cm-10.2
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.
Get prebuilt apps