How To Build Any Custom Recovery For Your Android Phone! Compile Recovery From Source Without PC

5
(2)

Compile Recovery From Source Without PC – Hello, guys if you are here, it means you want to learn How To Build Any Custom Recovery For Your Android Phone or Compile Recovery From Source. So finely I am back with a great guide for everyone.

In that guide, I will tell you how you can Build Any Custom Recovery For Your Android Phone without pc. Yes, you can build without pc. We will use our great Android Phone to Build Any Custom Recovery For Your Android Phone. So guys if you want to Compile Recovery From Source then you will need to follow step by step guide. So without wasting a time let’s get started.


What is an Android Custom Recovery :


Custom Recovery is an open-source project software that modifies your stock recovery and bypasses it.

It is specially used for rooted phones. If you want to install custom ROMs, custom karnals on your phone then you will need Custom Recovery On your phone.


Requirements To Compile Recovery From Source Without PC :


We are working on our Android device, so you will need to full fill all the requirements.

(1) Ubuntu 16.04 Server (VM):

You will need an Ubuntu 16.04 Server to build custom Recovery. Because I use Ubuntu 16.04 Server always. You will get servers from AWS, Google cloud platform, Microsoft Azure, many more websites that provide every server.

I recommend you to use AWS or Google cloud platforms. They provide free trials. You need to register on that website and now you are Rady to launch your server. For more info, Google it.

For Your Ubuntu 16.04 Server you will need that :

RAM 4GB OR Higher.
Storage 100GB?+

(2) familiar with the GitHub and Linux commands :

You need some basic knowledge about Github and Linux command. If you do not know that they don’t worries I will teach you some basics in that article. But if you want to learn like a pro then just Google it.

(3) Required Any android phone :

You can use any android phone for compiling a Custom Recovery.

(4) Device sources Needed :

Every custom Recovery or any stock Recovery build from your device sources. We will not talk about it in deep. Just you need to know about device sources. In that device sources, we will need only a recovery device tree of your phone

Device sources :

Recovery Device tree.

The above tree is required to build custom Recovery. Every device has its specific device sources.

(5) Recovery Source :

There are lots of custom Recoveries available on the internet. Like TWRP Recovery, OrangeFox Recovery, pitchblack recovery, Redwolf Recovery, etc. Select any recovery and get the source from GitHub.

(6) Download :

 JuiceSSH – SSH Client App. This app will help you to connect your server via SSH on Android.

Also Read :Compile Rom From Source. 


How To Build Any Custom Recovery For Your Android Phone! Compile Recovery From Source Without PC :


Compile Recovery From Source Without PC

Finally, guys, we are going to compile recovery from the source. We are going to compile Pitchblack Recovery from the source for our device. I am using my xiaomi mi Max 2 phone to build Pitchblack Recovery from the source. So all steps are similar for every device. so without wasting a time let’s get started.

Also Read : Top 5 Best Custom Recovery For Android Device 2020. 

(1) create Ubuntu 16.04 server On AWS (Amazon Web Service) :

Guys, first you need to create Ubuntu 16.04 VM server on AWS. For that, you will need to create an Amazon Web Services account.

If you don’t know how to create an Ubuntu server on AWS. Plus if you also don’t know how to connect with your Android phone via SSH client, then click below link to access my detailed article with Video Tutorial.

Click here! 

(2) Setting Up Build Environment For Compiling ROM’s :

You need to install some packages for building a custom Recovery. So you need to copy-paste that commands one by one and press enter. # lines are an explanation of commands so don’t copy # lines.

All commands Here! 

(3) Create a Github account :

Guys if you want to Compile Recovery From Source Without PC then you will need to get more information about Github. You can get full information from Google. But you need to have an account on GitHub.

So go to github.com and create your new account. If you have an account already then use the old one. We required your Github: username and email address for a letter use.

(4) Clone or Download Recovery source :

 

Now finally we are going to download a pitchblack Recovery source in our server. You can use your favorite recovery source if you want. For downloading source first follow these steps and copy-paste bellow commands In your server:

# create a Recovery folder.

mkdir recovery name

(like I am creating a pitchblack folder, so my command is mkdir pitchblack).

# Go to the Recovery folder.

cd pitchblack

(replace pitchblack with your folder name).

# Connect your Github account.

git config –global user.email “EMAIL” && git config –global user.name “USERNAME”

(Remove EMAIL and put your email. Remove USERNAME and put your username.) like this :

git config –global user.email “[email protected]” && git config –global user.name “MaheshTechnicals”

You need to understand some Github Commands.

git clone – git clone Command use for downloading repositories from GitHub.

branch (-b) – brach is defined for which brach you want to use. Like pie brach, oreo brach, Android Q brach, etc.

# To initialize pitchblack Recovery (Android 9.0) source.

repo init -u git://github.com/PitchBlackRecoveryProject/manifest_pb.git -b android-9.0

# To sync up or downloading the source.

repo sync

After repo sync, it will take some time to download your source. Because sources are large in size like 10-20 GB. So wait until it stop downloading.

(5) Clone your Recovery device Tree:

 

Now I am going to clone my device tree. So if you are building with the same device like xiaomi Mi Max 2 then you can use these commands without changing anything. If you are using another device then use your phone’s device tree URL, BRANCH, and PATH.

# make sure you are in the Recovery folder (in my case it is pitchblack). If you are not in the Recovery folder then go using the cd command.

cd pitchblack

# device tree.

git clone https://github.com/PitchBlackRecoveryProject/android_device_xiaomi_oxygen-pbrp git -b android-9.0 device/xiaomi/oxygen

(6) Recovery Bring up Or Fixing Device Tree :

Guy’s Recovery + Device trees are cloned successfully. But now we are going to do a Recovery bringup. In simple words, you are going to connect your device tree with Recovery Source. For that, you need to modify some files in your Device Tree. So first go to your device tree using a command from Rom folder.

# going to device tree folder.

cd device/xiaomi/oxygen

# what file and folders we have.

ls

You will see lots of files and folders. But we need to modify only five files. So which files we need to modify? listed here :

rom.dependencies
rom_oxygen.mk
vendorsetup.sh
AndroidProducts.mk

# Let’s start with a first file. You need to rename rom.dependencies file to your recovery name.dependencies. we will use mv command for rename files and folders. In my case, I am building pitchblack so the command is.

mv rom.dependencies omni.dependencies

# rom_oxygen.mk rename according to your Recovery.

mv rom_oxygen.mk omni_oxygen.mk

You can refer to this from the official recovery device tree of another device. Like if you want to know pitchblack recovery device tree modification, then search in Google like pitchblack recovery device git. And refer to any device tree.

# create or modify vendorsetup.sh file.

nano vendorsetup.sh

# it will open that file. Clear all lines if you have and add some lines from bellow :

add_lunch_combo omni_codename-userdebug

add_lunch_combo omni_codename-eng

Replace the code name with your device code name. Like in my case my command is

add_lunch_combo omni_oxygen-userdebug

add_lunch_combo omni_oxygen-eng

# Save vendorsetup.sh file. You need to press :

CNTRL+O
ENTER
CNTRL+X

# AndroidProducts.mk. We need to open this file.

nano AndroidProducts.mk

# replace with your recovery name and device code name like this :

PRODUCT_MAKEFILES := \
          $(LOCAL_DIR)/omni_oxygen.mk

# Save AndroidProducts.mk file.

CNTRL+O
ENTER
CNTRL+X

# Now we need to change some lines in omni_oxygen.mk file. open lineage.mk file.

mano omni_oxygen.mk

# replace with the recovery config file and recovery name like this :

$(call inherit-product, vendor/pb/config/common.mk)

# change recovery name in that line.

PRODUCT_NAME := omni_oxygen

# Save lineage.mk file.

CNTRL+O
ENTER
CNTRL+X

Done your device tree is now fixed. So now your device tree is properly connected to your pitchblack Recovery source. Now you are ready to build your first Recovery.

(7) Build Or Compile Your Recovery :

After all these steps you are ready to Compile Recovery From Source Without PC. So, guys, let’s start building or start a compilation of your Recovery. Just follow the commands.

# first go to Recovery folder for that.

cd

cd pitchblack

# Run build script.

. build/envsetup.sh

# lunch your device. With your device code name like this.

lunch omni_oxygen-eng

# Start your build now.

mka recoveryimage

It will start Compiling a Recovery For Your device. It will take 10-20 minutes (it totally depends on your servers CPU and RAM) to build Recovery so wait until 100%.

(8) Getting errors! How to fix those errors :

If your Recovery building stop by getting some errors? So you need to fix those errors first then compile again. If you are getting some error. Then cuppy that some error lines and search it on Google to fix.

Then it will fix. Because mostly all errors and solutions you will get from Google. After fixing and error you need to follow to start building again.

# clean first.

make clobber && make clean && rm -rf out/

# Run build script.

. build/envsetup.sh

# lunch your device. With your device code name like this.

lunch omni_oxygen-eng

# Start your build now.

mka recoveryimage

If you really search on Google but not getting any solutions. Then I will give you some telegram groups. Ask your questions there. They will definitely help you.

Android Development Telegram Groups :

Android ROM Development

Android Building Help

Mahesh Technicals My Group. 

(9) Upload Your Recovery On Your Google Drive:

After compile successfully. You need to transfer your Recovery zip file to your Google Drive Account. For that, you will need a Gmail account. I don’t think so if anyone does not have that in this world. But if you did not have it then create that from Google drive website.

OK so now we are ready to upload our first pitchblack recovery on your google drive account. So follow the commands.

# go to the home directory.

cd

# setup Google Drive.

wget https://docs.google.com/uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE&export=download

# Rename to gdrive.

mv uc\?id\=0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive

# set permissions.

chmod +x gdrive

# install drive package.

sudo install gdrive /usr/local/bin/gdrive

# get a link.

gdrive list

After that command, you will get an authentication link in your terminal. So copy that link and paste in any browser. I am going to paste that link in my chrome browser. They will ask you to connect your Google account there. So just click on your Google account. Then they give you a verification code copy that code and paste it in your terminal then press enter.

Done. Now your Google drive account is connected to your Ubuntu server. Now we are going to upload our Recovery file.

# go to your recovery zip file. Replace with your code name.

cd pitchblack /out/target/product/oxygen

ls

# find your recovery file name. upload your Recovery zip file to drive. Replace recovery.zip to your recovery file name.

gdrive upload recovery.zip

Done now your recovery zip file will upload on your Google Drive. So now go to your Google Drive account or Google drive app. Log in with the same email ID which you used to connect the drive in a terminal. So download from it and test your recovery file.

(10) Upload Your Recovery On Android File Host (AFH) Server Via Terminal:

Guys if you are a developer then you should have knowledge about AFH. Android File Host provides cloud storage for your projects and other stuff.

So if you want to upload and share your projects with others you can use that service for free. Finely we have our Custom Recovery Rady to share with your friends. So now we are going to upload our Recovery file into the AFH server via terminal. Let’s start.

(1) First, create an account on androidfilehost.com.

(2) Now request them via email for developer access. They will inform you via email.

(3) If you will get your developer account. Now we need FTP access. Just again contact them via email and request for FTP access. It will take 2-3 days.

(4) After 2-3 days they will inform you. They will send your FTP Details like :

An FTP server: uploads.androidfilehost.com

FTP username: xxx

FTP password: xxx

FTP port: 21

SFTP port: 23

Save that details.

(5) first, go to that directory where your Recovery file is present. Mostly is in out/target/product/oxygen. Now we are ready to upload files On AFH with a terminal via FTP. You need a command for it. See the command below :

curl –ftp-pasv -T FILENAME ftp://USERNAME:[email protected]

NOTE: You need to replace some lines according to your details like example

FILE NAME: Name of your Recovery file (PBRP-oxygen-3.0.0-20200801-1619-UnOFFICIAL.zip)

USERNAME: put your FTP username here.

PASS: Put your FTP Password.

(6) After modifying the above command according to your details. Just press enter. Your Rom will start uploading on AFH. It will take 1-20 sec to complete.

(7) now go to your AFH Account. import your uploaded file from the FTP section. Done now your Recovery file is on AFH. Share your Recovery File with your device community or on xda.

I hope this article will help you a lot. Finely you are ready to Compile Recovery From Source Without PC. If you like my work. Just share this article with your friends.

Guys if you don’t know how to flash a custom recovery on your device.  we have an article for you. Just click here to get that article.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

Leave a Reply