Android Rom Dev 1.1
Android Rom Dev 1.1
With a new version of Ubuntu comes an update to my guide for setting up a build environment to
compile Android ROMs. The aim of this is to simplify the configuration process and teach a
little bit about the command line. It’s ten easy steps! Of course, this could be boiled down to a
two-liner with some CLI wizardry, but that isn’t the point.
Follow the directions in order. Copy and paste the code, or better yet, type it out for an improved
learning experience.
This guide applies to all variations of Ubuntu 16.04 LTS Xenial Xerus 64 bit. Do not use the
32 Bit version.
Also, PAY CLOSE ATTENTION when to use “sudo” and when to not.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random
paragraph here and snippet there.
1) Unless it’s a completely fresh Ubuntu installation, the wrong version of Java might be
installed. Let’s fix that first.
The command below makes sure you’re starting with a clean slate. Copy and paste it into a
terminal (command prompt) window:
If necessary, follow the on-screen instructions to remove any stray Java versions. Otherwise,
move on to the next step.
sudo apt-get install git ccache automake lzop bison gperf build-essential zip
curl zlib1g-dev g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev
libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev
liblz4-tool make optipng maven libc6-dev linux-libc-dev gcc-multilib g++-5-
multilib libssl-dev
3) “repo” communicates with git servers for all that precious source code. The next command
will grab it:
4) Use a favorite text editor to open ~/.bashrc (or equivalent) – nano is easy to use:
nano ~/.bashrc
5) At the very bottom (use the Page Down key) paste this code to a new line:
export PATH=~/bin:$PATH
export USE_CCACHE=1
6) Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt.
Restart the shell:
source ~/.bashrc
7) In the terminal, make a folder to download the Android source code. The commands below
will keep it in the home directory, but if limited on space it’s ok to create it somewhere else.
Faster is better, i.e. NVMe would be best, USB (even 3.0) will be comparatively slow. Here we
go:
mkdir ~/android
cd ~/android
8) Now initialize the repo. Decide the flavor of Android to build, i.e. AOKP, CyanogenMod,
AOSP etc. For the purposes of this tutorial, here’s the command for Cyanogenmod 13
(Marshmallow) :
repo sync
Check back periodically every hour or so. It all depends on how fast the connection is.
10) Now, for Java. Some ROMs (Android Lollipop / CM 12.1 and below) require OpenJDK 7.
Marshmallow / CM 13 and above require OpenJDK 8. If building for reallllllly old devices,
OpenJDK 6. Here’s the easiest way to install on Ubuntu 16.04.
Then, install the appropriate version of Java. In this case we’re going to use 7, because it’s
popular. Simply replace openjdk-7-jdk with 6 or 8 as needed.
[HTTP://SPEEDDEVS.BLOGSPOT.COM OR http://SPEEDEVS.CF
]
I am writing this tutorial together in an attempt to help beginners which are trying to
build a ROM from source for the first time.I faced many problems when I started
building roms, so I thought it will be better to help someone who is trying the same
thing.I have tried to make this guide easy to understand.Please feel free to PM if you
have any doubts!!
And if you built a rom by following this guide then please press the thanks button, it
will motivate me.
Prerequisites
1. Android Phone
2. A decent internet connection
3. A debit/credit card
4. Brain (OF COURSE)
Contents
1. Making a Google Cloud Account
2. Setting up the VM (Virtual Machine) on your phone
3. Setting up the build environment
4. Initializing and syncing the repo
5. Cloning the device,kernel and vendor tree
6. Building the rom
7. Uploading the ROM in Google Drive
NOTE:Here I am compiling lineage os 14.1 therefore I am using it's repo initializing command.
You can find repo initialization command for your rom by the following method:
(i) Google search "rom_name github" (Replace rom_name with your rom name)
(ii) Open the rom github in dextop mode.(Use Google Chrome)
(iii)Click on the "manifest" or "android_manifest"
(iv) Select the branch which you want to build and copy the repo initialization command given at
bottom.
Go get a coffee till the source is syncinc. It will take time depending on your internet speed.
3.To find the vendor tree link follow the below steps:
(i)Google search "The Muppets Github".
(ii)Find the repository for your device and copy the link.
If you can't find any tree with the above methods, then simply google search that tree for your
device!!!!
Now it will take approx 7-8 hrs or more depending upon your internet speed.Go get a sleep till
then.
So what is MD5? MD5 is a number used to make sure two files (yours vs theirs) are the exact same using
a mathematical equation. When you download, while the music industry likes to claim that digital
downloads are all exactly identical, the truth is, they aren't always. The internet sends everything in bits
and parts. Sometimes things get lost along the way. MD5 is used to make sure the files match. It's not just
the internet though, many don't realize a file can be corrupted any time it is moved (or even while sitting
on your hard disk if it's bad). This includes moving from your computer to the phone, since USB is far
from perfect.
You should end up with a small little window. Drag the file you want to check onto that window.
The middle line will show you the md5 of your file.
Now, instead of looking at both numbers, copy the md5 the author gave you and past it in the bottom row
of that little window, and press compare. It will tell you if they match or not. If they don't then your file is
corrupt and you need to download it again.
• At least 16GB of RAM and extra virtual memory 4gb extra v.ram(virtual ram)
• Recommend Quad core CPU (More threads help build faster) • Builders can be share between
developers. OR an Intel XEON Recommended.
LETS ASSUME YOU KNOW WHAT STOCK ROM AND CUSTOM ROM IS
WHICH IS STOCK ROM IS THE FACTORY BUILT MADE ROM FOR THE PHONE.
WHILE CUSTOM AS THE NAME IMPLIES IS EITHER PORTED OR BUILT FOR A PHONE..
:-)
Credit’s
Michael(smhos.org) in xda (me)
12e4FpWQQyan6v9Ywk6HTN6Pc1TXYzbneP
COMPILING REDMI ROM
So now, getting to work
First of all you will be need some git basics and you should be familiar with
linux and its commands
Your device may be arm, arm64, x86, in case our one is arm64. So defconfig
placed on arch/arm64/configs
Make sure you remember the name of the defconfig, you can rename it too.
Our defconfig name is wt88509_64-perf_defconfig
If you would like to give your kernel a name, simplest way would be to look
for the CONFIG_LOCALVERSION in the defconfig
Now open the file called "Makefile" in the root of kernel source
If you want to make boot.img with your compiled kernel then you have to
follow this:
Extract you stock boot.img from your device and the unpack it using
mkbootimg tools. Here you will find
https://github.com/xiaolu/mkbootimg_tools
Rename your zImage to kernel and replace with extracted kernel. Then
repack boot.img and flash.
If you don't understand any of these terms , please google about them first,
and then if you are unable to find out ask here please.
Enjoy
:-)
ERROR AND SOLUTION IN COMPILING ROM
Make failed to build some targets
After syncing the repo, a file called repo_update.sh is symlinked in the root directory, and it applies some
patches which correct this and various other issues (this is the new method, previously Sony had these
patches on the instructions page, see here for more info). Everything compiles 'fine', but my phone
(F5121) goes into a bootloop after flashing. I'll post the log later on; most of the errors are audio related,
but I don't know if that's the root cause yet.
Can confirm repo_update.sh resolves Make errors
linker command failed with exit code 1 (use -v to see invocation) can any one help
me to solve this
Check your header and how you start to compile rom and the following
1) if you had two same constants in different classes then also this issue happens.
3) This error can also be occurred if you have imported two different versions of same library ,in this
case just remove the older version and keep only one version.
4) Adding the "other linker flags" in "Project" and not in "Targets". So, you move it to "Targets", it
shouldn't be in "Project".
Menu > Product > Clean ... then Run the project
cd scripts
I have a windows I don't want to use any trial VPS(VIRTUAL PRIVATE SERVER)
and don't want any distro as secondary OS.
No problem you can use virtualbox to run Linux for free, Just need your space and
stable internet connection. and also if you don't need it you can just create and install un
Is there any place where I can get full details of rom files folders etc ?
Answer: Yes there is an awesome post explaining everything.
I have one commit which is commit but I need to add proper author to it what to
do?
Answer:
git commit –amend –author=”NAME ”
This will add author to last commit
I have done changes I need to overwrite the commit its not allowing asking for
pull and retry like that.
Answer: do same git push command just add ” -f ” tag so it overwrites the git.
for e.g.: ” git push GitHub 7x -f “instead of “git push GitHub 7x ”
Is there any simpler way to check cherry-picked correctly or not since building
whole ROM takes time.
Answer: Build only the required package to check if it worked correctly then build Rom as whole .For e.g.
you made changes to kernel and device tree in that case just use time mka boot image rather than time
mka bacon.
Common Errors:
All these erros I mention are faced by me and solution which I did is written along.
#1:
libwpa_qmi_eap_proxy_
intermediates/export_includes’, needed by
‘/home/vibhoothiiaanand/nuclea/out/target/product/oneplus2/obj/EXECUTABLE
S/wpa_supplicant_intermediates/import_includes’, missing and no known rule to make it
make: *** [ninja_wrapper] Error 1
Solution:
First check wheather your vendor repo is broken or not or is it included or not if not clone it from correct
source.
Clone wpa supplicant ,wpa_supplicant8 from lineageos and retry it
Solution:
Make another build with permissive by adding
“androidboot.selinux=permissive” to BoardConfig.mk it should work.
#3:I have synced device tree but device is not showing in breakfast nor lunch
menu
Solution:
1.first change romname.mk file to your rom name ,for e.g. you synced Du tree and trying to make nitrogen
rom so mv du.mk nitrogen.mk.
2.Change vendorsetup.sh make appropriate name of device name with rom.
3.Change .dependencies name to rom name for e.g.. du.dependencies make it nitrogen.dependencies
4.Make AndroidProducts.mk and call device.mk from it.
Will show you how things are done.
Oneplus2 device tree modded for supporting VertexOS: Vertex-fy
Oneplus2 device tree modded for supporting Candy Rom :Candify
there will be so much commits like this just git search then your good to go.
This must be general case for most of the rom and devices just refer this.
#4:
ninja: error:
‘/home/vibhoothiiaanand/nitrogen/out/target/product/oneplus2/obj/SHARED_LIBRARIES/libqdutils_interm
ediates/export_includes’, needed by ‘/home/vibhoo
thiiaanand/nitrogen/out/target/product/oneplus2/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates
/import_includes’, missing and no known rule to make it
make: *** [ninja_wrapper] Error 1
Solution:
this is common error and its due to missing hardware BLOBs so to fix this there are few things to clone
these files are to cross checked if not clone from lineage
hardware/qcom/display
hardware/qcom/display-caf
hardware/qcom/audio
hardware/qcom/audio-caf
hardware/qcom/media
hardware/qcom/media-caf
hardware/qcom/bootctrl
hardware/qcom/bt
hardware/qcom/bt-caf
hardware/qcom/camera
hardware/qcom/gps
hardware/qcom/wlan
hardware/qcom/wlan-caf
hardware/qcom/keymaster
and for cloning I will show you how its done for Oneplus2
git clone https://github.com/LineageOS/android_hardware_qcom_display.git -b cm-14.1
hardware/qcom/display/msm8994
git clone https://github.com/LineageOS/android_hardware_qcom_audio.git -b cm-14.1
hardware/qcom/audio/msm8994
git clone https://github.com/LineageOS/android_hardware_qcom_media.git -b cm-14.1
hardware/qcom/media/msm8994 git clone
https://github.com/LineageOS/android_hardware_qcom_display.git -b cm-14.1-caf-8994
hardware/qcom/display-caf/msm8994
git clone https://github.com/LineageOS/android_hardware_qcom_audio.git -b cm-14.1-caf-8994
hardware/qcom/audio-caf/msm8994
git clone https://github.com/LineageOS/android_hardware_qcom_media.git -b cm-14.1-caf-8994
hardware/qcom/media-caf/msm8994
#5
device/generic/goldfish/data/etc/apns-conf.xml’, needed by
‘/home/vibhoothiiaanand/nitrogen/out/target/product/oneplus2/system/etc/apns-conf.xml’,
missing and no known rule to make it.
Solution:
just clone generic/goldfish from google since its old AF in lineage source
git clone https://android.googlesource.com/device/generic/goldfish device/generic/goldfish
#6
frameworks/native/build/phone-xxxhdpi-4096-dalvik-heap.mk” does not exist. Stop.
Solution:
Fix is just cherry-pick this commit
https://github.com/CyanogenMod/android_frameworks_native/commit/6500d428ce816ffa0ba099221a498
7ad7bfcb4ab
Done it must be fixed
#7
ERROR: couldn’t find ro.product.model in build.prop
Solution:
This is not that common but this happens while compiling
fix is cherry-pick this commit
https://github.com/AICP/build/commit/df574f3e6ae115425b2c25e5b5e6772503ca0f65
#8
Model number unknown.
Solution:
Go to device tree and open init/init*.cpp make device name and instead of std::string device =
property_get(“ro..device“); change to std::string device = property_get(“ro.product.device“);
#9
Deleting obsolete path /home/vibhoothiiaanand/vertex/device/oneplus/oneplus2
Deleting obsolete path /home/vibhoothiiaanand/vertex/device/oppo/common
Deleting obsolete path /home/vibhoothiiaanand/vertex/kernel/oneplus/msm8894
Deleting obsolete path /home/vibhoothiiaanand/vertex/vendor/oneplus
Solution:
this is due to not declaring repos in local manifest
#10 Broken gestures
for this two things must be noted kernel and device common must match the node names in case of
oneplus2
in kernel: drivers/input/touchscreen/synaptics_driver_s3320.c and
configpanel/src/com/cyanogenmod/settings/device/utils/Constants.java should match node declaration
values
#13 /out/target/product/oneplus2/obj/SHARED_LIBRARIES/libdhcpcd_intermediates/export_includes’,
needed by
‘/home/coolmohammad98/cr/out/target/product/oneplus2/obj/EXECUTABLES/ipacm_intermediates/
Solutions
For this clone https://github.com/lineageos/android_external_libnfnetlink and then your good to go
FIXED BY deploying vendor binaries into the android source tree from google page
It is quite easy, You download the zip files and run them in the source tree root. They append
additional software being embedded int the final img files of the built system. Rebuild after this
takes about 2 mins, because all android build system does is repackage the imgs .
e.g
So finally, got the problem. Actually I pulled the android branch and was using google's preview
binaries.
Then I pulled the android-4. branch and used Google Binaries for android 4.4.4_r2. Everything
went fine.
How to Build an Android ROM
What follows is more a simple explanation on how to build an Android ROM. I’m going to
discuss several parts that can’t be absent if you want a fully functional Android phone,
from the software point of view that is.
•Bootloader
•Recovery
•Radio
Kernel
A kernel is a critical component of every Operating System. It can be seen as a sort of bridge between
the applications and the actual hardware of a device. Usually the data processing part is done at
hardware level, furthermore the kernel is the most low-level abstraction layer for theresources.
There exist several types of kernels, but I am only discussing the one that is important for the Android
ROM. The kernel for the Android ROM is a hybrid kernel, it is based on the Linux kernel. Devices can
differ in RAM memory, ROM memory, hardware parts and so on. So it’s really important you have a
kernel for your type of device, an HTC Wildfire kernel won’t work on a Nexus One for example.
It is possible to overclock a kernel. You may wonder, what the hell is overclocking? Every CPU is
designed to work at a certain clock speed. For the HTC Wildfire the Qualcomm ARMv6 processor
operates at 528 mHz — this is a limit that is coded in to the kernel because they can’t guarantee good
cooling for the CPU if you go over this limit. My Wildfire runs at 652.8 mHz and it can go to 768 MHz until
it freezes. When you overclock the kernel, the CPU will be instructed to do more calculations per second;
so, it will increase performance.
When you overclock the CPU of your desktop machine, it will need extra cooling, but fortunately that’s not
necessary for a smartphone. However, keep in mind that this will degenerate your CPU much faster than
if it was at stock. To overclock an Android phone you must root it and install SetCPU or another
overclocking app from the Play Store. Then you will have to flash a kernel that supports overclocking. I
prefer the OC Kernel of HCDR.Jacob, at XDA-forums (see links right). If you have done these 3 things
you’re ready to OC!
Libraries
Imagine you want to program an application for your phone that uses the camera. It can take a picture
and turn the flash LED on. These are things not only your own application will use, but there can be tons
of applications that have a button that can take a photo. So, imagine those apps always having to write
the machine code to get the camera to turn on; it would be a lot of code duplication and would make an
application slow. Instead, for functions like the camera or loudspeakers, they developed libraries. These
are chunk of codes that can be executed by calling them trough a call-method (in java : import
somelibrarie.someclass;). These are already pre-written and ready to use. It saves a lot of coding work
and keeps the source code small. Libraries in the Windows OS for example are called .dll files (Dynamic
Linked Libraries), whereas on your Android ROM or Linux OS these are the .so files (Shared Object).
When coding in Java you import .jar libraries before the class signature. On your Android phone you have
particular libraries that can’t be absent, or else your ROM won’t even boot.
Bootloader
A bootloader in general is the first bytes of code that a machine executes that will tell the bootsequence
and will load the operating system into the RAM. On an Android phone this is the so called HBoot. From
here you can go to the recovery, system or data partitionn. By pressing the power button on your phone,
HBoot will load the OS into RAM. By pressing the power and volume down buttons, you’ll bring up the
HBoot menu.
The bootloader is used as an exploit for rooting an Android phone. Once rooted you can flashcustom
ROMs, like ImPrOS, or just edit system files (for a how-to, check tutorials under Android.)
Recovery
When you use a one-click-root application like Unrevoked3, it will install a modded recovery. With this
modded recovery it is possible to flash a new kernel, radio image (see below), customROM, install
applications (not the best way though), Nandroid backup, etc. The moddedrecovery that is flashed by
Unrevoked3 is called ClockworkMod.
Recovery is a method for you to not only save yourself when you screw up (which you will! ), but to
update the ROM or kernel that’s on your phone, partition your SD card to use with a2sd, and many other
OS-related things. There’s a lot of different recoveries for different phones, so you’ll have to do some
research of your own into what the most respected one is for your phone. The recovery is essential,
because you want to always have a fallback in case something bad happens to your phone’s software.
Radio
The lowest part of software layer is the radio: this is the very first thing that runs, just before
thebootloader. This handles the GPS antenna, GSM antenna and fires up the CPU; everything that HBoot
needs to load the OS. This can also be upgraded by flashing a new radio image through your recovery.
However, this is not recommended: flashing a new ROM can’t brick your phone (make it unusable), but if
anything goes wrong when you flash a ROM with a new radio image, this can brick your phone. So unless
you experience bad reception or battery drainage, don’t touch the radio!
A COMPLETE AND STEP BY STEP BY STEP GUIDE TO PORT/COMPILE TWRP
RECOVERY FROM SOUCE CODE IS HERE,
you must have some basic knowledge to Complete The Process,
Initial requirements:
First requirement is Java. The version you need depends on what Android version you want to compile
Notice: for openjdk8 before start the compilation with "make recoveryimage"
Type: export EXPERIMENTAL_USE_JAVA8=true and press enter.
Code:
If you have the wrong version type: sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Follow the on-scren instructions to remove it.
Now install the jdk you need
For Openjdk 6
For Openjdk 7
Code:
Type the following commands:
sudo add-apt-repository ppa:openjdk/ppa
sudo apt-get update && sudo apt-get install openjdk-7-jdk
Next requirement are libraries and build tools
Open a fresh terminal prompt, copy and paste this:
Code:
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-
dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-
tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
Now let's get a copy of "repo", it is a program that lets you communicate with git servers and download
the source code.
Code:
1)mkdir ~/bin -This command creates the bin folder that will contain the repo command
4)sudo nano ~/.bashrc At the very bottom(Use page down key) add this line: export PATH=~/bin:$PATH
Then press Ctrl+O and Enter to save and Ctrl+X to exit.
After that type: source ~/.bashrc
-With these commands you add repo to .bashrc file that allows you to call the command from every path.
Full Sources
NOTICE: replace "BRANCH" with the version of android you want
Omnirom Sources
Available Android branches:
android-6.0
android-5.1
android-5.0
android-4.4
android-4.3
Open a fresh terminal and type the following commands.
cd ~/NameOfTheFolder
repo sync -jN N=numbers of parallel downloads, it depends on your connection Example: repo sync -j2
cd ~/NameOfTheFolder
repo sync -jN N=numbers of parallel downloads, it depends on your connection Example: repo sync -j2
Minimal Sources
NOTICE: replace "BRANCH" with the version of android you want
twrp-6.0
twrp-5.1
twrp-4.4
cd ~/NameOfTheFolder
repo sync -jN N=numbers of parallel downloads, it depends on your connection Example: repo sync -j2
twrp-13.0
twrp-12.1
cd ~/NameOfTheFolder
repo sync -jN N=numbers of parallel downloads, it depends on your connection Example: repo sync -j2
NOTICE
If you repo synced CyanogenMod Full sources you don't have TWRP sources so go here, select the
branch you want and download it.
https://github.com/omnirom/android_bootable_recovery
Rename the folder to "recovery-twrp" without quotes ----> Warning: Be sure that in
NameOfTheFolder/device/vendor/devicename/Boardconfig.mk there is RECOVERY_VARIANT := twrp
/home/username/NameOfTheFolder/device/vendor/devicename
/home/username/NameOfTheFolder/kernel/vendor/devicename
/home/username/NameOfTheFolder/vendor/vendor/devicename
Device Tree
Kernel
Vendor files
Code:
cd ~/NameOfTheFolder
source build/envsetup.sh
lunch
Type the number of your device and press enter. For example in my case the number 16 is my device
mka recoveryimage ---> This command will start the compilation of the recovery.
1. Who do not have a PC which meets required requiements for building a rom
2. Who cannot download the sources which their Pc cant carry rom compiling build or don't want
to install Ubuntu
3. A debit/credit card
4. FOCUS,CHILL AND RELAX AND WISDOM(BRAIN)
Contents
1. Making a Google Cloud Account
2. Setting up the VM (Virtual Machine) on your phone
3. Setting up the build environment
4. Initializing and syncing the repo
5. Cloning the device, kernel and vendor tree
6. Building the rom
7. Uploading the ROM in Google Drive
STEP 1:Open Google Cloud from here, by visiting their website cloud.google.com
STEP 4: filling in your billing details with your credit card info,(most time it will ask for
verification, verify it).
STEP 3:Navigate to "Identities" and create a new identity by pressing the "+" button.
STEP 4:Input the "Nickname","Username" (You can enter your name also in both places) and then
click on "Private Key"(Set (Optional) button). Navigate to "Generate" and press OK and click on
the tick icon.
STEP 5:Now long press the identity you just created and click on "Export Public Key" and click on
ES Note Editor or Keep (You need any one of them) and replace the "JuiceSSH" written at the end
with your username you entered in the identity and now copy the whole text.
STEP 6:Open Google Cloud and navigate to Computer Engine->Metadata->SSH Keys. Click on edit
and then add item.Paste the text you just copied and save it.
STEP 8:Now it will take a minute.After it is created copy the External IP.
STEP 9:Now open Juice SSH app and navigate to "Connections" and create a connection by
clicking on the "+" icon.Input the nickcname you entered while creating the identity.Paste the
External IP in the "Address" column and click on the tick icon.
STEP 10:Now click on the connection you just created. This will open the terminal on which you
need to work.
NOTE:
Here I am compiling lineage os 14.1 therefore I am using it's repo initializing command.
You can find repo initialization command for your rom by the following method:
(i) Google search "rom_name github" (Replace rom_name with your rom name)
(iv) Select the branch which you want to build and copy the repo initialization command given at
bottom.
Some repo initialization commands:
(i). repo init -u https://github.com/ResurrectionRemix...m_manifest.git -b nougat
(ii). repo init -u https://github.com/AICP/platform_manifest.git -b n7.1
(iii). repo init -u git://github.com/CandyRoms/candy.git -b c7.1.2
(iv). repo init -u https://github.com/BlissRoms/platform_manifest.git -b n7.1
Go get a coffee till the source is syncinc. It will take time depending on your internet speed.
2.To find the kernel tree link follow the below steps:
(i)Google search "lineage os github".
(ii)Input your chipset name in the search box and select the repository for your device.
(iii)Copy the link.
3.To find the vendor tree link follow the below steps:
(i)Google search "The Muppets Github".
(ii)Find the repository for your device and copy the link.
If you can't find any tree with the above methods, then simply google search that tree for your
device!!!!
Now it will take approx 7-8 hrs or more depending upon your internet speed.Go get a sleep till
then.
CYNGAEMOD TUTORIAL
Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android.
Directory tree
• build/
• bootable/
• devices/
• frameworks/
• kernel/
• out/
• packages/
• vendor/
rm -rf out/target/common/obj/JAVA_LIBRARIES
make -j16
IPC Binder IPC Binder — — The IPC Binder is The IPC Binder is an
Inter-Process Communication (IPC) mechanism. It allows an Inter-
Process Communication (IPC) mechanism. It allows processes to
processes to provide services to other processes via a set of higher-
level APIs than are available in standard Linux. An provide services to
other processes via a set of higher-level APIs than are available in
standard Linux. An Internet search indicated that t Internet search
indicated that the Binder concept originated at Be, Inc., and then made
its wa he Binder concept originated at Be, Inc., and then made its way
into Palm‘s y into Palm‘s software, before Google wrote a new Binder
for Android. software, before Google wrote a new Binder for Android.
RAM Console and Log Device RAM Console and Log Device — — To
aid in To aid in debugging, Android adds the ability to store debugging,
Android adds the ability to store kernel log messages kernel log
messages to a RAM to a RAM buffer. Additionally, Android adds a
separate logging module so buffer. Additionally, Android adds a
separate logging module so that user processes can read and that
user processes can read and write user log messages. write user log
messages.
Android also adds a new real-time clock, switch support, and timed
GPIO support. We list t Android also adds a new real-time clock,
switch support, and timed GPIO support. We list the impacted files he
impacted files for these new modules at the end of this document. for
these new modules at the end of this document.
You can easily download and install Gdrive on your Linux box by heading to the tool's
official GitHub page, and downloading the executable file for your system. For example,
I downloaded a file named gdrive-linux-386 as I work on a 32-bit Linux
distribution.
Once downloaded, make sure that the file has executable permissions. If not, grant it
the permissions through the chmod command. For example, I used the following
command:
chmod +x gdrive-linux-386
After this, you need to make sure that the tool is allowed to connect to your Google
Drive account. For this, you need to run the executable file with about argument. Here's
the command:
./gdrive-linux-386 about
You will be asked to enter a verification code, which is obtained by heading to the url
printed in the command's output and authenticating with the google account for the
drive you want access to. The following screenshots will make the process clear:
Clicking the 'Allow' button will produce the required code on the web page itself. After
the verification code is entered on the command line terminal, Gdrive will connect to
your Google Drive account. For example, here is the complete output after I entered
the code in my case:
Important note: The aforementioned authentication process will create a token file
inside a folder - named .gdrive - located in your home directory. "Note that anyone
with access to this file will also have access to your google drive," the tool's official
documentation says.
Using Gdrive
Here are examples of some of the basic Google Drive operations that you can carry out
using Gdrive. I am assuming that the Gdrive executable that you download on your
system is also named gdrive-linux-386 and is kept in your current working
directory.
List contents
To list the contents (files and directories) of your Google Drive, you can use the
following command:
./gdrive-linux-386 list
If you want to limit the maximum number of files that can be displayed in the output
(default is 30), you can add the -m flag followed a number that represents the new
maximum limit. For example:
./gdrive-linux-386 list -m 10
You can also add a query for filtering the output based on your requirement. For
example, If I only want specific files (say, that contain 'Gmail' in their name) in the
output, I can use the following command:
Given that Google Drive is a cloud storage service, so needless to say that you'll want to
use Gdrive to upload and download files to/from your Drive account. Here's how you
can do these operations:
The directory ID ([dir ID] in the command above) can be obtained from the entry of
that particular directory when you list your Drive contents using Gdrive.
To create a new directory in your Google Drive, use the following command:
Of course, you can create a new directory and then use its ID to upload a file to it.
Finally, you can use the following command to download a file from your Google Drive
account to your system:
There are several flags that help you with your download operations. For example, -f
tells Gdrive to overwrite existing file of the same name (if any), -r tells the tool to
download a directory recursively, and --delete makes sure the remote file gets deleted
when download is successful. It's worth mentioning that the last two flags also work
with upload operations.
Share files
Gdrive also lets you share your Google Drive files with others. For example, if you want
to make a file readable to everyone, you can do it through the following command:
Of course, that's not what we always want. Mostly, we share files with our friends or
colleagues. So, for example, if you want to share a file with someone you know, you
can do so using the following command:
Here's an example of how I used this command to share a file with one of my friends as
well as grant write permission to them.
Gdrive also lets you access information related to any of your Google Drive files. Here's
the command for it:
You should see a file in your home directory called something list
uc=0B3X9GlR6EmbnWksyTEtCM0VfaFE. Rename this file to gdrive.
mv uc\?id\=0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive
1 mv uc\?id\=0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive
Windows
How to Build Custom Lineage OS ROM
What you'll need:-
Part 1:- Setting Up Ubuntu Virtual machine for Building lineage OS.
The video below will show you how to setup the virtual machine with Ubuntu running.
Once the installation is done and you have changed to your nearest server enter the below
commands into the terminal to update all the packages.
Part 2:- Downloading the source code and building the Lineage OS .
•Add the following lines of code at the end of the file and then Save and Exit the file
source ~/.profile
•Enter these commands in a single line in your terminal to start downloading and installing all
the required packages
•Type the commands given below to download and grant permission to repo as this tool will be
use to download all the source codes.
•In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by
opening ~/.profile with a text editor using
•and by verifying that the following code exists if its missing add it if not then skip this step.
•if you added the above code then run this command
source ~/.profile
6. Initialize the LineageOS source repository
cd ~/android/system
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
then run the below commands and remember to change email to your email address and user name to
your name
•Run this command to start the download of source code onto your computer but note that this
may take a very long time depending on your computer as you'll be downloading more than 15
GB of files.
repo sync
•After the source has been downloaded run the following command to setup the device specific
code.
source build/envsetup.sh
breakfast bacon
Note: Breakfast bacon where bacon is the code name for the device OnePlus One and instead
of bacon you have to enter the code name of your device. Example for nexus 6P you'll enter
'breakfast angler' here angler is the code name for nexus 6P. If you don't know the code name
for your device then you can check that here.
export USE_CCACHE=1
•Now add the above line at the end of your ~/.bashrc file and save and exit the file.
•Now run the below command in the terminal to limit the maximum cache size to your need else
this will fill all your disk with its cache.
prebuilts/misc/linux-x86/ccache/ccache -M 75G
Note: 75G at the of the commands corresponds to how many GB of space you want to for
cache if you're just building lineage OS for one device then you can allocate around 25-50 GB if
you want to build lineage os for multiple devices then target at least around 75-100GB of cache
disk space.
•You can also enable cache compression to save disk space but this will result in a slight bit of
performance slowdown it's totally up to you to enable it or ignore it.
export CCACHE_COMPRESS=1
•Jack is a new compiler used from lineage 14 but it always runs out of memory so to fix this run
the following command.
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -
Xmx4G"
•Also add the above line to the end of your ~/.bashrc file to configure it automatically
•Now type the below commands to start building Lineage OS for your device
croot
brunch bacon
Note: Brunch bacon where bacon is the code name for the device OnePlus One and instead of
bacon you have to enter the code name of your device. Example for nexus 6P you'll enter
'brunch angler' here angler is the code name for nexus 6P. If you don't know the code name for
your device then you can check that here.
*** It will be obvious if the build has succeeded or not. If succeeded, then the
lineage OS installer package will be store in "/android/system/out/target/product/"
then inside the folder that's named based on your device. In my case the builds
are stored inside "/android/system/out/target/product/bacon/" ***
You could face a lot of errors even if you follow the exact procedure so best advice is to
be patient and google the issue! I'm sure someone will have the solution to the issue that
you're facing. By saying that here are the solutions to few common issues that you may
face.
For most of the devices you're probably going to run into this problem while running the
breakfast command.
Even if the breakfast command looks like succeeded but when you run the brunch command for
your device it will probably show you some error and say that the build failed.
All the above happens because we have to extract and get the propitiatory blobs from the device
for which you'll be building lineage OS, but there are several problems with this like may be
building an version for the device you don't have Etc...
So to overcome this this problem you can get the propitiatory blobs from
'TheMuppets' repository in GitHub https://github.com/TheMuppets.
•Now go to this manifests file link and copy the code from here. Then in the text editor that
opened up you have to past the copied code from the above link and then save and exit the file.
I'll just be building Lineage OS for OnePlus and Motorola devices so i have deleted all the other
lines except the lines where my maufacturer is listed and it looks something like this.
repo sync
2.Ninja wrapper error
While building lineage OS if you have followed all the steps until here you shouldn't get this
error but sometimes it just doesn't work for no reason and may show you something like this.
Before attempting to run the below command to fix the issue and take a look at what it says i
wasn't able to recreate this error and had to fill up my storage device to get this error and it
shows there that there is no space left and only then it shows the ninja error so i can just freeup
mu sapce and the issue will be solved.
But sometimes it just shows this error with some bizarre errors and possibly the errors you
maynot know of then you can run the below command to disable Ninja Wrapper.
•Just type the below command in the terminal and the error will be fixed
export USE_NINJA=false
Well we already discussed this above that jack runs out of memory and even though we fixed it
above there is a slight bit if chance you may get the error which many look like the these
•When you get an error like this you just have to increase the size by entering the below
command.
Notice the above command at the end which says -Xmx4G where 4G corresponds to
4GB of space that we allowed it, even after this if you get this error just try increasing
this by changing this to '-Xmx6G' or something like that.
•Also remember to change the line at the end of your ~/.bashrc file to configure it automatically
Well these are most common errors that you'll face while building Lineage OS well if you face
any other issues comment down below
NOTE: The method explained here is to be followed for compiling ParanoidAndroid
v3.+
The process is WIP.(thanks to the DEV in xda that posted IT)
Feel free to try & compile, post your results/errors here. Community effort would
WELCOME TO
PARANOIDANDROID
Source Compilation Guide v3.+
This guide will walk you through each & every step involved in compiling the ROM,
right after the stage of installing Ubuntu.
Remember, I'm NOT responsible if something, or anything goes wrong at your end,
on any device or system.
I, & others, will try & help you out whenever possible. If there's some delay, don't
whine or complain, just have patience & you'll be helped.
I can't practically reach out to everybody, but I'll try my best.
Good Luck
------------------Pre-requisites------------------
------------------Steps Involved------------------
Before compiling any ROM, we need some basic 'stuffs', or tools if you may.
In short, here's what we need:
Code:
$ sudo apt-get install libssl1.0.0=1.0.1-4ubuntu5.3
$ sudo apt-get install libssl-dev
# Install Dependencies:
There are some dependencies that might not be useful. But just in case, I'm gonna give you all
dependencies that any Android compilation would need. Its better than facing errors while compiling.
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev \
ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
lib32z-dev libgl1-mesa-dev g++-multilib mingw32 \
tofrodos python-markdown libxml2-utils xsltproc readline-common \
libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev \
lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 \
libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev
\
libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.6-dev
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-
gnu/libGL.so
# Configure USB:
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules
-> Add these lines:
Code:
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
3) Set proper permisisons: (Provide read permission to all users, in addition to whatever other
permissions are pre-set)
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
1) Download & keep aside the latest Oracle Java 6 JDK. (I dislike OpenJDK. Feel free to use it if you prefer
that )
Remember: WE NEED JAVA 6, not any other version (5 or 7 etc). Or this will not work for you.
http://www.oracle.com/technetwork/ja...s-1637591.html
Code:
$ sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
3) Install JAVA JDK:
Code:
$ sudo mkdir -p /opt/java/64/
$ sudo cp jdk-6u##-linux-x64.bin /opt/java/64
$ sudo su -
$ cd /opt/java/64
$ chmod +x jdk-6u##-linux-x64.bin
$ ./jdk-6u##-linux-x64.bin
$ exit
REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.
Code:
$ gksudo gedit ~/.bashrc
-> Add these lines:
Code:
# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin
REPLACE THE HASHes (#) WITH YOUR VERSION NUMBER.
# Python Installation:
For Python installation, I give you two choices. Pick whichever you like. But pick ANY ONE.
Code:
$ sudo apt-get install python
-----OR------
Option 2: Self compile Python from source: (Advanced way. Not recommended if you have no
experience with software compilation)
http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
-> For 2.7 you need to explicitly enable SSL after running the ./configure script and before running make:
2) Configure Python:
Code:
$ ./configure
3) Navigate to & open Modules/Setup.
There are lines like this:
Code:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# -L$(SSL)/lib -lssl -lcrypto
4) Uncomment these lines and change the SSL variable to /usr:
Code:
SSL=/usr
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
5) Install Python:
Code:
$ make
$ sudo make install
6) Add Python PATH to .bashrc:
Code:
$ gksudo gedit .bashrc
-> Add these lines:
Code:
# Python
export PATH=/usr/bin:$PATH
-> Save & Exit
# Android SDK:
http://developer.android.com/sdk/index.html
Code:
$ gksudo gedit .bashrc
-> Add the following lines:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
->Save & Exit
Code:
$ gksudo gedit .profile
-> Add these lines:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
-> Save & Exit
*To use the ADB Update software (or to verify a working adb path), use the following command:
Code:
$ android
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Code:
$ mkdir android
$ cd android
$ mkdir system
$ cd system
$ repo init -u git://github.com/ParanoidAndroid/manifest.git -b jb43-legacy
VERY IMPORTANT: Now, before the final stage sync, make sure there's no code referring to
'ParanoidPreferences' in manifest.
To check that
Add your own device tree, kernel tree, hardware source tree, & vendor proprietaries tree in the local
manifest.
For this, create a new file .repo/local_manifest.xml, & use something in similar terms:
For example, I'm using all corresponding trees for Samsung Galaxy S3 i9300 - International
Following is just an example, not what you should copy/paste. SEARCH & USE YOUR OWN DEVICE
SPECIFIC TREES.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="ParanoidAndroid/android_device_samsung_i9300"
path="device/samsung/i9300" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_kernel_samsung_smdk4412"
path="kernel/samsung/smdk4412" remote="github" revision="cm-10.2" />
<project name="ParanoidAndroid/android_device_samsung_smdk4412-common"
path="device/samsung/smdk4412-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_packages_apps_SamsungServiceMode"
path="packages/apps/SamsungServiceMode" remote="github" revision="cm-10.2" />
<project name="CyanogenMod/android_hardware_samsung"
path="hardware/samsung" remote="github" revision="cm-10.2" />
</manifest>
CAUTION: Your device tree, kernel source, vendor props etc WILL be different. Search & find out
where your device specific sources are located.
Code:
$ repo sync <-parameters->
Now, here's a reference to the repo sync parameters:
“make” command has ‘-j’ option to run multi jobs parallely. “repo sync” has similar option, too.
Let’s examine command line help:
Code:
$ repo sync -h
Usage: repo sync [...]
Options:
-h, --help show this help message and exit
-f, --force-broken continue sync even if a project fails to sync
-l, --local-only only update working tree, don't fetch
-n, --network-only fetch only, don't update working tree
-d, --detach detach projects back to manifest revision
-q, --quiet be more quiet
-jJOBS, --jobs=JOBS number of projects to fetch simultaneously
-s, --smart-sync smart sync using manifest from a known good build
Code:
$ repo sync -j8
I personally use -j4, due to my awful internet. You may use any no. of jobs value, like -j16.
This can reduce the download time. However, this'll suck lots of the bandwidth of the network. Just so
you know
Now that you have the sources, its time to deal with the precompilation & compilation steps
Move on to Post 2.
---------------------------------------------------------------------------------
HOW TO COMPILE ANDROID ROM FROM SOURCE?
There are lots of custom Android Distributions available out there, with the popular ones being CyanogenMod, SlimROM, Paranoid Android, AOKP,
Liquid Smooth, MIUI, Xylon, Ice Cold Jelly etc.
For today’s guide, we will compile CyanogenMod 10.2, the most popular Android aftermarket ROM. The procedure is 99% same for all custom ROMs out
there, so this guide can be used as a reference to compile other ROMs too.
Pre-requisites
1. An Android Phone with readily available Kernel and Device Source, already rooted and with a custom recovery installed.
2. 64 bit Linux Distribution (We prefer Ubuntu).
3. At Least 100GB free on your Hard Disk.
4. Working knowledge of Linux Terminal Commands.
5. Reasonably fast internet connection.
Point to note: 64 bit Linux OS is a must, and it must be a native installation, not a Virtual Machine.
1. Install the Linux OS of your choice: 64 bit version, according to the official instructions. (The guide will assume that we are running Ubuntu 13.04).
Keep a partition of at least 100GB with 16GB Swap Partition.
2. Install the following list of packages: Open Terminal app, and type
Package List
1. git-core
2. gnupg
3. flex
4. bison
5. python
6. rar
7. original-awk
8. gawk
9. p7zip-full
10. gperf
11. libsdl1.2-dev
12. libesd0-dev
13. libwxgtk2.6-dev
14. squashfs-tools
15. build-essential
16. zip
17. curl
18. libncurses5-dev
19. zlib1g-dev
20. pngcrush
21. schedtool
22. libc6-dev
23. x11proto-core-dev
24. libx11-dev
25. libg11-mesa-dev
26. mingw32
27. tofrodos
28. python-markdown
29. libxml2-utils
30. g++-multilib
31. lib32z1-dev
32. ia32-libs
33. lib32ncurses5-dev
34. lib32readline-gplv2-dev
35. gcc-multilib
36. g++-multilib
37. xsltproc
3. Install Java JDK 1.6 for Linux 64-bit: File name should be jdk-6u##-linux-x64.bin, ## are version numbers. Move the downloaded package to your
home directory. Open Terminal app and run the following set of commands:
1. # Java Path
2. export JAVA_HOME=/opt/java/64/jdk1.6.0_##
3. export PATH=$PATH:$JAVA_HOME/bin
1. cd ~
2. mkdir android && cd android
3. mkdir sdk
Download Android SDK from http://developer.android.com/sdk/index.html. Extract the package contents to ~/android/sdk We must add Android SDK
path to .bashrc
1. android
5. Set up your github account and remote repo: You can skip this step if CyanogenMod supports your phone officially. Go to github.com, and make an
account for yourself. For this guide, I am considering your username as ‘user’.
Visit ‘github.com/CyanogenMod/android’, press Fork. The remote manifest will be forked, and available in your personal repo.
Now, go to ‘github.com/user/android’. Open the file default.xml, press Edit. Find this line:
I am considering your device’s kernel source, device source and vendor libs for Android 4.3 to be at
1. github.com/user2/kernel_source
2. github.com/user2/device_source
3. github.com/user2/device-common_source
4. github.com/user2/vendor
I am assuming the branch to be named ‘jb4.3’. You can find the exact name in the actual repo. Then, at the end of the file, add these lines, modifying them
according to your device’s source code.
1. cd ~
2. mkdir ~/bin
3. curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
4. chmod a+x ~/bin/repo
1. mkdir ~/android/cm
2. cd ~/android/cm
Now run
Go grab a coffee, or a meal, it’s gonna take a long time. The source code is well over 10GB in size, so it will take quite some time.
8. Set up the Device Specific Stuff: If your device supports CyanogenMod 10.2 officially, then open Terminal and type
1. cd ~/android/cm
2. . build/envsetup.sh && breakfast <device_codename>
It will take some time, the device source is about 3GB in size. Then, you need to have official CM10.2 installed on your phone, connect it to your PC in
USB Debugging mode, and run the following commands:
1. adb root
2. cd ~/android/cm/device/<your_company>/<your_device>/
3. ./extract-files.sh
If your device does not support CyanogenMod 10.2 officially, then you got nothing to do in this step, the sources are already waiting for you.
9. Download Prebuilt Stuff and set up Toolchain: Open Terminal and type
1. cd ~/android/cm/vendor/cm
2. sh ./get-prebuilts
1. cd ~/android/cm
2. sudo gedit ~/.bashrc
1. # Android Toolchain
2. export ARCH=arm
3. export CCOMPILE=$CROSS_COMPILE
4. export CROSS_COMPILE=arm-eabi-
5. export PATH=$PATH:~/android/cm/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
10. Build your ROM: So, everything is all right and ready. It’s time to build the ROM. Open Terminal and type
1. cd ~/android/cm
2. . build/envsetup.sh
3. brunch <device_codename>
Time to go take a nap. It will take a zillion years to build the ROM on an average computer. Well, that was exaggeration, but on my home PC (Core i5 2nd
gen with 8GB RAM), it takes over 3 hours to build from scratch. Hopefully, there will be no errors, and the build will complete fine. You will get the
output package in
1. ~/android/cm/out/target/product/<your_device>/cm-10.2-something-UNOFFICIAL-<your_device>.zip
It’s time to install your newly compiled ROM on your phone. Download Google Apps package from “www.goo.im/gapps” for the appropriate Android
version. Put both those packages in your phone, and flash them in recovery mode. Voila, your own compiled ROM is now running your device.
To fetch new source code updates to your locally downloaded source code, open Terminal and type
1. cd ~/android/cm
2. repo sync –j16
To build your ROM, after updating source code, open terminal and type
1. cd ~/android/cm
2. make installclean
3. find ./out/ -name ‘build.prop’ | xargs rm
4. find ./out/ -name ‘cm_<your_device>-target_files-eng.*.zip’ | xargs rm
5. . build/envsetup.sh
6. brunch <your_device>
Since you are not re-building from scratch, but re-building as it is, it will take significantly less time, only about 15-30 mins in most cases. You should sync
your local source every week or so, to keep your local source fresh.
To clean your working directory completely (read: return your source folder to stock condition), open Terminal and type the following commands.
1. cd ~/android/cm
2. make installclean
3. make clobber
Bear in mind, that after running these commands, all your output data will be removed, so the next build will take 3-4 hours again, as everything is re-built
from scratch. If your Hard Disk partition is small, say around 100GB, you should clean your working directory about once every 4 builds, or else, you will
run out of Hard Disk space.
Building a ROM takes a lot of time. But the time can be cut down by about 30-45% by using CCACHE. CCACHE stands for compiler cache, it caches the
compilation output from your earlier builds, so that it can be re-used in later builds.
Note that CCACHE needs a lot of space on your Hard Disk for caching the content, so its recommended if and only if your Hard Disk partition is
somewhere in the vicinity of 200GB or higher. To set up CCACHE, open Terminal and type:
1. cd ~/android/cm
2. export USE_CCACHE=1
3. export CACHE_DIR=~/.ccache
4. prebuilts/misc/linux-x86/ccache/ccache –M 50G
You can change the maximum size allocation to CCACHE from 50GB to whatever you want, but a minimum of around 30GB should be used for good
results.
You can cherry-pick features from other ROMs source code. Say for example, I want to pick Feature A , with commit ID “12345” from repository
“github.com/user/reporepo”.
You navigate to the package in your local source code and run these in Terminal.
1. cd ~/<path_to_reporepo_packages>
2. git fetch https://github.com/user/reporepo
3. git cherry-pick 12345
CREDITS
1. MICHAEL(SMHOS.ORG) IN XDA
AND MY TEAM SPEEDEVS TEAMS
PLS DONATE TO ME
BITCOIN ADDRESS (VERY IMPORTANT)
12E4FPWQQYAN6V9YWK6HTN6PC1TXYZBNEP
2. @AKHILNARAG (Resurrection Remix with ACAR in telegram)
3. ALL THE DEVS IN XDA ,MIUI FORUM AND GOOGLE PLUS
FOR THEIR HELP
WEBSITE
HTTP://SPEEDDEVS.BLOGSPOT.COM OR http://SPEEDEVS.CF