Skip to content

Instantly share code, notes, and snippets.

@lopestom
Last active September 19, 2024 12:43
Show Gist options
  • Save lopestom/d85ce99bb244d308c5e681db31018626 to your computer and use it in GitHub Desktop.
Save lopestom/d85ce99bb244d308c5e681db31018626 to your computer and use it in GitHub Desktop.
Building custom recovery - TeamWin - Fox - SHRP - PBRP online

Using online resource to build custom recovery - TeamWin - Fox - SHRP - PBRP

logo

Q&A - A quick understanding of the meaning of this tutorial.

  • What is the purpose of this tutorial?

    Understand that more and more you need a good PC/laptop/notebook equipment to compile Custom Recovery. Unfortunately, many people cannot or do not have the time to test/compile the device tree.

  • Why am I writing this?

    Because I appreciate the presence of good people who share their experience, and the more people who help, the better.

  • Who are these instructions for?

    First, people who want to help themselves. Then these people will be able to help others.

  • Is programming experience necessary?

    It depends on how much you want to learn, some steps are important and others will be done automatically. A good Device Tree setup&configs saves you time. It has always been said in fact and will never change.

  • Who made it work?

    It involves many people, most notably a special character called @rokibhasansagar. You can then search for the topic on Github.

  • What version of Linux is the process running on?

    Usually Ubuntu version 18.04.6 [deprecated by github] - but there are other projects with Ubuntu 20.04. Works successfully:

    2022/07/08 => TWRP-based 5.X ~ 12.X are ALL COMPILED SUCCESSFULLY

    Scripts have been updated for some time and the improvements have been good. Bodya-Kolibass - Was one of the authors of the speed improvement - Set Swap Space. CaptainThrowback - One of the TeamWin guys who helped the most with the TWRP code at the moment. And others (us) who tested and put something to improve the assembly code.............

    Action-TWRP-Builder: https://github.com/azwhikaru/Action-TWRP-Builder

    Others: https://github.com/rokibhasansagar/Recovery-Compiler

    https://github.com/Area69Lab/Recovery-Builder-NoKernel

    https://github.com/mujianwu/Action-Recovery-builder

End of part 1 of 4

A Actions on github

Github image

Quickstart for GitHub Actions

  1. First of all, you must have a ✨github account✨.

  2. Save the Device Tree as follows:

    device_manufactor_devicename

    Exmaple: device_ulefone_Armor_10_5G

    * TWRP-A11+ * twrp_ - Click to open

    |__ prebuilt

    |__ recovery/......

    | Android.mk -------------------------------- twrp_Armor_10_5G

    |||||||||||||||||||| -------------------------- COMMON_LUNCH_CHOICES := twrp_Armor_10_5G -eng

    | AndroidProducts.mk --------------- twrp_Armor_10_5G

    | BoardConfig.mk --------------- device/ulefone/Armor_10_5G

    | device.mk --------------- device/ulefone/Armor_10_5G

    | twrp_Armor_10_5G.mk --------------- ..... vendor/twrp/config/common.mk

    | Any other files you need.

    * TWRP-A10-* - ** PBRP ** omni_ - Click to open

    |__ prebuilt

    |__ recovery/......

    | Android.mk -------------------------------- omni_Armor_10_5G

    |||||||||||||||||||| -------------------------- COMMON_LUNCH_CHOICES := omni_Armor_10_5G -eng

    | AndroidProducts.mk --------------- omni_Armor_10_5G

    | BoardConfig.mk --------------- device/ulefone/Armor_10_5G

    | device.mk --------------- device/ulefone/Armor_10_5G

    | twrp_Armor_10_5G.mk --------------- ..... vendor/pb/config/common.mk

    | Any other files you need.

  3. Login to your github.

    • Understand that device_tree must be in public mode. If it's private, the Actions won't work.
  • Fork the Action-TWRP-Builder project. Copy (fork) the Action-TWRP-Builder project to your github account or you can copy the script files into a folder directly in your device tree.

    Example - Click to open

    github fork

  1. Log in to your account under Settings

    Developer Settings: Personal Access Tokens. - Click to open

    Developer Settings

    Developer Settings2

    Generate token - Click to open

    Generate token

    Confirm access.

    Set the Select scopes options to any options or whatever is needed for the token to have the necessary permissions.

  2. Remember the word you created and copy the access key (token) somewhere for future use.

    You will see that letters and numbers will be generated that will be the key (token) to be used in the Custom Recovery project.

    • Example of Generated key token: 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
    At the end select: - Click to open

    Generated key token

  3. If you want copying the Action-TWRP-Builder into your repository DT

  • Go to your Action-TWRP-Builder project and select the Settings option and select Secrets.

    • Pay attention to the New repository secret parameter.

    • In the name, write the secret word (in our case TEST) and copy the key (token).

      Select Add secret. - Click to open

      New repository secret

      secret

  • Go to the Action-TWRP-Builder/.github/workflows/Recovery Build.yml and edit the file. About workflows

    • Enter the secret word (TEST) into the project.
    • Change the user.name and user.email to your own
    • The last lines will contain: secrets.GITHUB_TOKEN
      • GITHUB_TOKEN ==>> TEST
        • Replace the word with secrets.TEST

          Examples of changes - Click to open

          changes

End of part 2 of 4

Building img file

  1. Go to Actions. Please confirm your understanding for use. actions-tab

    • You will see the All workflows option. Select Recovery Build and you will see Run workflow option on the right.

    • Feel free if you want to change something in the settings table of Run Workflow. Please review this in **.

      Actions:Recovery Build option - Click to open

      Run workflow

    Review the options and customize how you want to use Custom Recovery in the codebase (TWRP; Fox; PBRP; ....).

    PS: In the azwhikaru/Action-TWRP-Builder only support TWRP and SHRP compilation.

** Note that you can customize part of the device tree.

Parameter Description - The setting depends on the Android version you are building.

Please read about Minimal Manifest Source Code twrp_aosp & twrp_omni and look the branch options. So relook Actions on github about A10- and A11+ for understand.

Run workflow table - Click to open

  MANIFEST_URL ---> Source Code link of Custom Recovery in the github: https:// github.com/minimal-manifest-twrp/platform_manifest_twrp_omni
  
  MANIFEST_BRANCH ---> Android version: twrp-9.0
  
  DEVICE_TREE_URL ---> Device Tree (DT) repository link on github: https:// github.com/azw…device_xiaomi_archytas
  
  DEVICE_TREE_BRANCH ---> Device Tree branch: twrp-9.0
  
  DEVICE_PATH ---> Device compilation Path from DT - BoardConfig.mk: device/xiaomi/Archytas
  
  COMMON_TREE_URL (if no common tree, leave blank) ---> If your DT uses Common Tree then put the github link of that here.

  COMMON_PATH (if no common tree, leave blank) ---> If your DT uses Common Tree so that's have Common Path then put the path of Commom Tree.
  
  DEVICE_NAME ---> Device .name or.device: Archytas
  
  MAKEFILE_NAME ---> Branch of Source code from MANIFEST_URL: omni_DEVICE_NAME
  
  BUILD_TARGET ---> The partition the recovery_ramdisk is on: recovery

  1. At the end, select Run workflow and the project will run automatically.

    • Keep an eye out for FAILs & Errors or save time with other tasks. If you don't receive an error notification e-mail within forty minutes, rejoice/be glad and wait.

    Sometimes you may experience a build time of over 1 hour and 30 minutes. Even so, some information in the Building Recovery tab may happen and usually it may have FAILED or error even at 99% or 100%. Watch out for the error because this is something you should fix in your Device Tree.

    Run workflow - Click to open

    All workflows

    Set up job

    Chek Out

    Prepare the environment

    Set variables

    Install repo

    Initialize repo

    Repo Sync

    Clone device

    Building

    Building_2

    Building_3

    Building_4

    • If you want to see in the launch part if the img file was created.

      Run workflow - Click to open

      Upload to Release

  2. Where does the compiled file go (img and zip for PBRP - img for TWRP)?

  • Select the link for Release and you will see an img file and a zipped device tree (Source code) file.

    Dowload compiled img file - Click to open

    Releases lopestom device_TWRP_BLU_G0130WW

End of part 3 of 4

  1. Some interesting details for checking/error logging.
  • On the right is an image of a gear. Tighten the gear.

    Logs - Click to open

    Logs

  • Download_log_archive: You will download task-separated files from a script.

    It will contain everything that happened in the early stages through to the late stages. View_raw_logs: will open a log text file on a page https://pipelines.actions.githubusercontent.com/ page with all the steps in one place.

  • If everything went well during the build (there is no guarantee that the recovery.img or boot.img file will be correct); in the Release part you will see an img file to download and test immediately.

  1. Interesting readings and files for Mediatek devices

    Not everything is there, but if you know what you need or want, just search: https://github.com/orgs/mtk-watch/repositories

End of part 4 of 4


Last updated on 2023/06/02.
Thanks and Notes

Thanks Github for releasing Actions Free (limited time/size but has).

Thanks github experts users that create actions-workflows scripts free to anyone use and have good learning/experience with building/compiling custom recoveries

@lopestom for Custom Recovery for MediaTek devices guide.

Thanks of the Source Code Custom Recovery to @TeamWin and to all the people who help update that, as well as the people who help Mediatek devices to have a more functional Custom Recovery.

Thanks to all the people who left some Mediatek device tree repository available so that other users can fork and not waste too much time creating a device tree from nothing.

Thanks to @SebaUbuntu for twrpdtgen.

How I write in gist: Writing on github

Old updated on 2023/06/02.

@Chinonso-HXD
Copy link

thanks so much for this tutorial 🥰

@ZunayedDihan
Copy link

you are pro sir thanks for help

@lopestom
Copy link
Author

Thanks guys.
Although this tutorial is outdated, it was one of the first to exist. Obviously over time, the Build Custom Recovery script has been improved and changed many times.
But, I still believe it has been an interesting reference for unexperienced users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment