-
Notifications
You must be signed in to change notification settings - Fork 0
Common Tree
Working on multiple TWRP trees can be overwhelming, especially when you notice many common targets across devices. To simplify the process, I’ve created a universal tree that you can easily adapt for various devices. Let’s dive into how you can use it! 🌱
-
Include the Common BoardConfig
First, add this line to yourBoardConfig.mk
:include device/android/common/BoardConfigCommon.mk
-
Inherit the Common Device Makefile
Then, in yourtwrp_"codename".mk
, include:$(call inherit-product, device/android/common/device.mk)
No additional inheritance needed—everything is pre-installed. 🔧
If your device uses the A/B partition system, add this line to your twrp_"codename".mk
:
ENABLE_VIRTUAL_AB := true
For devices made by Samsung, set the vendor in your BoardConfig.mk
:
BOARD_VENDOR := samsung
Define header versions for your recovery or boot partition:
- For Recovery or Boot:
BOARD_BOOTIMG_HEADER_VERSION := 2
- For Vendor Boot:
BOARD_BOOT_HEADER_VERSION := 4
Depending on how your device handles boot/recovery:
- If using boot as recovery:
BOARD_STORE_RAMDISK_IN_BOOT := true
- If using vendor boot:
BOARD_STORE_RAMDISK_IN_VENDORBOOT := true
- If using recovery partition, no extra configurations needed! ✅
For boot, vendor boot, and recovery, you need to define kernel and ramdisk offsets:
-
For Boot:
BOARD_RAMDISK_OFFSET := BOARD_KERNEL_TAGS_OFFSET := BOARD_KERNEL_BASE :=
-
For Vendor Boot:
BOARD_KERNEL_OFFSET := BOARD_RAMDISK_OFFSET := BOARD_KERNEL_TAGS_OFFSET := BOARD_DTB_OFFSET := BOARD_KERNEL_BASE :=
-
For Recovery:
BOARD_KERNEL_BASE := BOARD_RAMDISK_OFFSET := BOARD_KERNEL_TAGS_OFFSET :=
Set your device’s SoC:
-
Snapdragon:
BOARD_USES_QCOM_HARDWARE := true
-
MTK:
BOARD_USES_MTK_HARDWARE := true
-
UniSoC:
BOARD_USES_SPRD_HARDWARE := true
Ensure your prebuilt kernel and DTB are correctly placed in the tree.
- The kernel should be named
kernel
, and the DTB should bedtb.img
. 🧰
To fix system reboot issues, add this to BoardConfig.mk
:
TW_NO_FASTBOOT_BOOT := true
Depending on your boot setup, set the image sizes:
-
For Vendor Boot:
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE :=
-
For Recovery:
BOARD_RECOVERYIMAGE_PARTITION_SIZE :=
-
For Boot:
BOARD_BOOTIMAGE_PARTITION_SIZE :=
Check out these sample trees for reference:
-
Samsung Recovery:
Git Repository -
Vendor Boot Devices:
Git Repository -
Boot Devices:
Git Repository
Now you’re all set to work with a unified TWRP tree. Feel free to tweak it according to your device’s specific needs.