/BuildGuide

buildGuide: A Beginner's Guide on How to Compile a Custom ROM

Custom ROM Build Guide !!

A Beginner's Guide on How to Compile a Custom ROM.

Step 1: Initiate Directory:

mkdir romname
cd romname
git config --global user.email "yourname@mail.com" && git config --global user.name "yourname" 


Step 2: Cloning ROM Source:

repo init -u https://github.com/romname/android_manifest.git -b branches
repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags

Refer to your ROM's Manifest for detailed clone guide.


Step 3: Cloning Trees:

I have opted for begonia so clone your DT's according to the device you are going to build for.
Check your device on your ROM's Official Devices Repo to figure out all the trees required for it.


Cloning Device Tree:

git clone https://github.com/username/device_redmi_begonia -b 13.0 device/redmi/begonia


Cloning Kernel Tree:

git clone https://github.com/username/kernel_xiaomi_mt6785 -b 13.0 kernel/xiaomi/mt6785


Cloning Vendor Tree:

git clone https://github.com/username/vendor_redmi_begonia -b 13.0 vendor/redmi/begonia
git clone https://github.com/username/vendor_redmi_begonia-ims -b 13.0 vendor/redmi/begonia-ims
git clone https://github.com/username/vendor_redmi_begonia-firmware -b 13.0 vendor/redmi/begonia-firmware


Cloning Sepolicy Tree:

git clone https://github.com/username/device_mediatek_sepolicy -b 13.0 device/mediatek/sepolicy


Step 4: Editing Device Tree:

cd device/devicename/codename

Rename the aosp.dependencies & aosp_devicename.mk to your current ROM.
Edit AndroidProducts.mk. Rename the pre-existing aosp to your current ROM.
Edit aosp_devicename.mk. Adapt the flags according to your ROM. Check Devices Repo for more information on flags.


Step 5: Compiling the ROM:

Setup Build Environment:

. build/envsetup.sh

Setup Lunch:

lunch romname_devicename-userdebug

Compile:

mka bacon -j$(nproc --all)

Refer to your ROM's Manifest for Compile Flags.


Fixing Errors:

Fixing errors that arise during a ROM Development is a whole another branch of headache. Your build might get an error. It might not get an error. Each build might get an different error. It takes a lot of research and understanding to figure out the solutions. Wishing you Best of Luck !!


Reach out to me in case of issues. bishwofic !!