How to build Android Roms

What is Android rom building?

Basically Android rom building means that you are bored with stock rom provided by your OEM or your stock rom is very old so you want to upgrade. So you sync the AOSP source or something related to it ( as per your needs) then build it and flash it.

1. Installing repo tool

mkdir -p ~/bin && curl > ~/bin/repo && chmod a+x ~/bin/repo
ls ~/bin/

2. Open .bashrc to set repo tool

gedit .bashrc
--- At last of bashrc file---
# Android Tools
export PATH=${PATH}:~/bin

3. Syncing rom source

mkdir -p android/roms/los-n
cd android/roms/los-n/
repo init -u git:// -b cm-14.1
repo sync -c -f --force-sync --no-clone-bundle --no-tags -j10

4. Syncing device source (ex: for kuntao codenamed device)

git clone -b cm-14.1 device/lenovo/kuntao/
git clone -b cm-14.1 kernel/lenovo/msm8953/
git clone -b cm-14.1 vendor/lenovo/kuntao/
git clone -b cm-14.1 packages/resources/devicesettings
git clone -b cm-14.1 device/qcom/common

5. How to build?

source build/
make -j10 bacon

6. Where to find my build?

cd $OUT