How to Compile/ Build SHRP Recovery

SHRP Recovery is a twrp based custom recovery which will bring modern design to native twrp recovery. if you want to Compile it for your Phone then you can do it by following the below Instructions.

Requirement’s

  • Linux PC
  • high speed Internet ( to sync source)

Prepare Development Environment:

open terminal and type below code

git config --global user.name "your github username"
git config --global user.email "your github email"
sudo -E apt-get -qq install bc build-essential zip curl libstdc++6 git wget python gcc clang libssl-dev repo rsync flex curl bison aria2
sudo curl --create-dirs -L -o /usr/local/bin/repo -O -L https://storage.googleapis.com/git-repo-downloads/repo
sudo chmod a+rx /usr/local/bin/repo

Sync SHRP source:

mkdir shrp
cd shrp

for android 11

repo init -u https://github.com/SHRP/manifest.git -b v3_11.0

for android 10

repo init -u https://github.com/SHRP/manifest.git -b v3_10.0

for Android 9.0:

repo init -u https://github.com/SHRP/manifest.git -b v3_9.0

then sync (it will take around 4-5 hrs according your Internet speed) define j value according your system’s cpu core

repo sync -c -j8 --force-sync --no-clone-bundle --no-tags
rm -rf .rep

done. now we have development environment, let’s start building

prepare your device tree and move it to shrp/device/ folder
ex. shrp/device/xiaomi/kenzo

Start build:

cd shrp
export ALLOW_MISSING_DEPENDENCIES=true
lunch twrp_kenzo-eng
mka recoveryimage

Note:

  • replace ‘kenzo’ with respective device makefile
  • for android 10 or below replace ‘twrp’ tag with ‘omni’
  • for AB device’s use ‘mka bootimage’

Additional flags:

you can use additional flags with boardconfig.mk

#use prebuild kernel:

TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz

use custom kernel or kernel Source:
create file with the name twrp.dependencies in tree folder and add below code:

[
{
"remote": "github",
"repository": "redmi/kernel_xiaomi_kenzo",
"target_path": "kernel/redmi/kenzo",
"revision": "R"
}
]

Note: define correct location of kernel source in above code, then define in BoardConfig

define in board config:
TARGET_KERNEL_SOURCE := kernel/redmi/kenzo
TARGET_KERNEL_CONFIG := kenzo_defconfig
TARGET_KERNEL_CLANG_COMPILE := true

# use Properties

TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop

# use SHRP Stuff

SHRP_MAINTAINER := unofficialtwrp.com
SHRP_DEVICE_CODE := kenzo
SHRP_REC_TYPE := Treble
SHRP_DEVICE_TYPE := A_Only
SHRP_NOTCH := true
SHRP_EDL_MODE := 1
SHRP_EXTERNAL := /external_sd
SHRP_INTERNAL := /sdcard
SHRP_OTG := /usb_otg
SHRP_FLASH := 1
SHRP_DARK := true
SHRP_REC := /dev/block/bootdevice/by-name/recovery
SHRP_EXPRESS := true

# USE SHRP Addons

SHRP_EXTERNAL_ADDON_PATH := “device/xiaomi/kenzo/addon/”
SHRP_EXTERNAL_ADDON_1_NAME := “SELinux Permissiver”
SHRP_EXTERNAL_ADDON_1_INFO := “Makes SELinux Permissive”
SHRP_EXTERNAL_ADDON_1_FILENAME := “permissiver.zip”
SHRP_EXTERNAL_ADDON_1_BTN_TEXT := “Flash”
SHRP_EXTERNAL_ADDON_1_SUCCESSFUL_TEXT := “Flashed Successfully”
SHRP_INC_IN_REC_EXTERNAL_ADDON_1 := true
SHRP_EXTERNAL_ADDON_2_NAME := “SELinux Enforcer”
SHRP_EXTERNAL_ADDON_2_INFO := “Reverts Back to Enforcing SELinux”
SHRP_EXTERNAL_ADDON_2_FILENAME := “enforcer.zip”
SHRP_EXTERNAL_ADDON_2_BTN_TEXT := “Flash”
SHRP_EXTERNAL_ADDON_2_SUCCESSFUL_TEXT := “Flashed Successfully”
SHRP_INC_IN_REC_EXTERNAL_ADDON_2 := true
SHRP_EXTERNAL_ADDON_3_NAME := “[MIUI] Disable Replace SHRP”
SHRP_EXTERNAL_ADDON_3_INFO := “Flash in MIUI To Stop MIUI Recovery From Replacing”
SHRP_EXTERNAL_ADDON_3_FILENAME := “disable-replace-shrp.zip”
SHRP_EXTERNAL_ADDON_3_BTN_TEXT := “Flash”
SHRP_EXTERNAL_ADDON_3_SUCCESSFUL_TEXT := “Flashed Successfully”
SHRP_INC_IN_REC_EXTERNAL_ADDON_3 := true
SHRP_EXTERNAL_ADDON_4_NAME := “Magisk-V24.3”
SHRP_EXTERNAL_ADDON_4_INFO := “Flash It To Get Root Access”
SHRP_EXTERNAL_ADDON_4_FILENAME := “Magisk-V24.3.zip”
SHRP_EXTERNAL_ADDON_4_BTN_TEXT := “Flash”
SHRP_EXTERNAL_ADDON_4_SUCCESSFUL_TEXT := “Installed”
SHRP_INC_IN_REC_EXTERNAL_ADDON_4 := true

Download SHRP Additional Addons:

Download Sample tree:

test:

fastboot boot recovery.img