Skip to content

Instantly share code, notes, and snippets.

@T-rex2017
Last active October 2, 2020 08:32
Show Gist options
  • Save T-rex2017/d285f2536065cb72348fe81e4c0aefd5 to your computer and use it in GitHub Desktop.
Save T-rex2017/d285f2536065cb72348fe81e4c0aefd5 to your computer and use it in GitHub Desktop.
rom compiling guide
# not an actual script but you could convert it though
# links are for lenovo vibe P1m nougat roms for other devices and android version these may or ma not be different
# selecting the os
# you could use any varient of ubuntu but i suggest to use on above 16.xx
#update what you have
sudo apt-get update && sudo apt-get upgrade
# install all the tools
git clone https://github.com/akhilnarang/scripts.git scripts && cd scripts
bash setup/android_build_env.sh
bash setup/install_android_sdk.bash
bash setup/setup_android_sdk_packages.bash
# make a new dir for syncing the source
mkdir MyRom && cd MyRom
# configure your github
git config --global user.name "your user name"
git config --global user.mail "your mail id"
# i'm going to compile lineage os
repo init -u git://github.com/LineageOS/android.git -b cm-14.1
repo sync # this will start the sync and will take sometime
# time to clone the device sources
git clone https://github.com/darklord4822/android_device_lenovo_P1m.git -b cm-14.1 device/lenovo/P1m
git clone https://github.com/z3r0c00l-2k/android_vendor_lenovo_P1m.git -b n vendor/lenovo/P1m
git clone https://github.com/darklord4822/android_kernel_lenovo_P1m.git -b master kernel/lenovo/P1m
# apply pathes
# this is device specific , if your device doesn't require patches , just skip this
cd device/lenovo/P1m/patches
bash apply-patches.sh
cd ../../../../
# if some patches didn't get applied properly manually patch them
# setup cache
export CCACHE_DIR=./.ccache
ccache -C
export USE_CCACHE=1
export CCACHE_COMPRESS=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
# start compiling
source build/envsetup.sh && lunch lineage_P1m-userdebug && brunch lineage_P1m -j$(nproc --all)
# if you get an error google it and fix it
# to compile for a different rom you have to prepare device tree according to that rom
# there is no universal way of doing this
# simplest way to do this is by looking at the official device trees for devices which have that rom
# for some roms like rr , there is no need for such changes cm or lineage tree can be use for rr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment