This is a guide to Compile From any CyanogenMod and CyanogenMod Source-Based source for Any Phone. This guide is for linux , Ubuntu etc.
What you’ll need
- A Phone Which runs Android
- 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.
Note:
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.)
So let’s begin!
Build ROM and ClockworkMod Recovery
Prepare the Build Environment
Note:
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.
Install the SDK
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.
Helpful Tip!
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.
Install the Build Packages
Several "build packages" are needed to build From Source. You can install these using the package manager of your choice.
Helpful Tip!
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.)
For 32-bit & 64-bit systems, you'll need:
Code:
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
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.7-multilib g++-4.5-multilib
Code:
libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils
Create the directories
Code:
mkdir -p ~/bin
Install the repo command
Enter the following to download the "repo" binary and make it executable (runnable):
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution
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:
Code:
export PATH=${PATH}:~/bin
Helpful Tip!
You can make this change to the path permanent for all future Terminal sessions:
This will launch a graphical text editor. EnterCode:gedit ~/.bashrc
on its own line, then save the file.Code:export PATH=${PATH}:~/bin
Initialize the source repository
Make a Folder to Download the Sources and cd to it. For That:
Code:
mkdir -p ~/Source
Code:
cd Source
Enter the following to initialize the repository:
REPOSITORY'S OF FAMOUS ROMS (Select One)
PAC-Man :CM 11.0 :Code:repo init -u git://github.com/PAC-man/android.git -b cm-10.2
CM 10.1 :Code:repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
CM10 :Code:repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
Code:repo init -u git://github.com/CyanogenMod/android.git -b jellybean
Download the source code
Code:
repo sync
Helpful Tip!
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
Code:
cd ~/Source/vendor/cm
Code:
./get-prebuilts
How To Compile is there on next post
Last edited: