How To Guide Guide to TWRP building

Search This thread

physwizz

Senior Member
Sep 16, 2013
3,762
844
Sydney
TWRP for a12s
=============



1. Setup
--------

sudo apt update
sudo apt upgrade
sudo apt-get install git-all

sudo apt install python-is-python3

git config --global user.email "your email"
git config --global user.name "your name"


2. swapfile
-----------

sudo swapoff -a

sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo mkswap /swapfile
sudo swapon /swapfile

free -m

3. repo
-------

mkdir -p ~/.bin
PATH="${HOME}/.bin:${PATH}"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+rx ~/.bin/repo



Basic Device Tree
==================

mkdir TWRP
cd TWRP
git init
git clone https://github.com/twrpdtgen/twrpdtgen
pip3 install twrpdtgen
sudo apt install cpio
copy stock recovery.img to ~/TWRP/twrpdtgen

cd twrpdtgen
python3 -m twrpdtgen recovery.img

rename ~/TWRP/twrpdtgen/output/samsung/a12s/omni_a12s.mk to twrp_a12s.mk

delete vendorsetup.sh

Add this to recovery.fstab

# Removable storage
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=storage;wipeingui;removable
/usb-otg auto /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable

Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)

open twrp_a12s.mk and
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)

2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)

open AndroidProducts.mk
change omni to twrp (4 spots)

Optional: add extra items to BoardConfig.mk


cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh


• Make a directory called ~/a12s-twrp
cd ~/a12s-twrp

repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11


repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1

copy ~/TWRP/twrpdtgen/output/samsung to /a12s-twrp/device


Building
========


. build/envsetup.sh
lunch twrp_a12s-eng
mka recoveryimage

Recovery.img at out/target/product/a12s/recovery.img
 
Last edited:
  • Like
Reactions: Anonymous V

physwizz

Senior Member
Sep 16, 2013
3,762
844
Sydney
Screenshots
 

Attachments

  • 20221117_073639(0).jpg
    20221117_073639(0).jpg
    1.3 MB · Views: 49
  • Screenshot_2022-11-09-13-17-53.png
    Screenshot_2022-11-09-13-17-53.png
    79.4 KB · Views: 49
  • Screenshot_2022-11-07-14-05-46.png
    Screenshot_2022-11-07-14-05-46.png
    63.7 KB · Views: 49
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,762
844
Sydney
physwizz twrp updated
For a127f u5 u6 u7
And a127m u5
Android 11 & 12

Bugs:
None reported

Installation
Next post

Code

@physwizz
 

Attachments

  • TWRP-physwizz-a12s.tar
    51 MB · Views: 15
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,762
844
Sydney
Installing Custom Recoveries

A. Preparation.

1. Download firmware for your device
2. Extract ap file using Zarchiver

3. Patch the ap file with a magisk which will patch both boot.img and vbmeta.img

For Exynos 850 android 11 use a21s patched magisk.

For Exynos 850 android 12 and most other devices use delta magisk

4. Unlock OEM in developer options
5. Attach phone to pc and reboot to download mode
6. flash patched ap file.

7. Download recovery.img or download twrp.tar and extract recovery.img using Zarchiver.

B.Installation

Method 1.
1. Connect to pc and boot into stock recovery
2. Factory reset
3. Reboot into download mode.
4. flash twrp.tar into the ap slot
5. reboot to recovery.
6. Advanced, terminal.
7. Type multidisabler (twice).
Or flash samsung multidisabler zip
Or, for older phones flash dmverity zip
8. Reboot to recovery
Backup boot, data, super and dtbo
9. Reboot to system

Method 2.
If you have already installed recovery and decrypted.
1. Boot to recovery.
2. Install recovery.img
3. Choose recovery partition
4. Reboot to recovery
Backup boot, data, super and dtbo
(For Pitch-black just install the zip)

Method 3.
1. Install TWRP app
2. Install TWRP
3. Choose file to flash.(don't select device)
4. Select recovery.img.
5. Reboot to recovery.
6. (You may need to change data partition to ext4 first if format ruins your system)
7. Reboot to recovery.
8. Wipe, format data, type YES.
9. Advanced, terminal.
10.Type multidisabler (twice).
Or flash samsung multidisabler zip
Or, for older phones flash dmverity zip
11.Reboot to recovery
12. Flash Magisk for root(only for method 3)
13. Backup boot, data, super and dtbo

C. Recovery Problems

Most recovery issues can be solved by attending to the following issues.

1. Did you root using the full ap file patched Magisk .
(This contains the patched boot.img and vbmeta.img)
Exynos 850 users must use the special a217 magisk?

2. Did you then go all the way through the setup process?

3. Did you download the recovery to match your baseband?
See https://t.me/a127f_res/54 for Exynos 850 recoveries

4. Did you hold down power and volume up after Odin says pass?

5. Did you format data, not just wipe?

6. Did you type multidisabler twice?

7. Did you reboot to recovery by choosing reboot from the menu and then choosing recovery?

8. To avoid touch issues go to settings and untick "allow time out"

D.To restore Stock Recovery

1. Attach phone to pc and reboot to download mode
2. flash patched ap file.
3. reboot

@physwizz
 

Anonymous V

Senior Member
Jan 16, 2021
100
16
15
Phillippines
TWRP for a12s
=============



git config --global user.email "your email"
git config --global user.name "your name"



Basic Device Tree
==================

mkdir TWRP
cd TWRP
git init
git clone https://github.com/twrpdtgen/twrpdtgen
pip3 install twrpdtgen
sudo apt install cpio
copy stock recovery.img to ~/TWRP/twrpdtgen

cd twrpdtgen
python3 -m twrpdtgen recovery.img

rename ~/TWRP/twrpdtgen/output/samsung/a12s/omni_a12s.mk to twrp_a12s.mk

delete vendorsetup.sh

Add this to recovery.fstab

# Removable storage
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=storage;wipeingui;removable
/usb-otg auto /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable

Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)

open twrp_a12s.mk and
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)

2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)

open AndroidProducts.mk
change omni to twrp (4 spots)

Optional: add extra items to BoardConfig.mk


cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh


• Make a directory called ~/a12s-twrp
cd ~/a12s-twrp

repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11


repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1

copy ~/TWRP/twrpdtgen/output/samsung to /a12s-twrp/device


Building
========


. build/envsetup.sh
lunch twrp_a12s-eng
mka recoveryimage

Recovery.img at out/target/product/a12s/recovery.img
dude im stuck at mka recoveryimage part its stuck at 96% while im creating it says there a error while creating how to solve it?? btw my phone is not samsung its oppo and its says error exit code 130 how to solve this??
 

Edne12803

New member
Jan 19, 2023
2
0
Does anyone knows something about this error
 

Attachments

  • 20230118_213318.mp4
    20.9 MB · Views: 0

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    TWRP for a12s
    =============



    1. Setup
    --------

    sudo apt update
    sudo apt upgrade
    sudo apt-get install git-all

    sudo apt install python-is-python3

    git config --global user.email "your email"
    git config --global user.name "your name"


    2. swapfile
    -----------

    sudo swapoff -a

    sudo dd if=/dev/zero of=/swapfile bs=1G count=8
    sudo mkswap /swapfile
    sudo swapon /swapfile

    free -m

    3. repo
    -------

    mkdir -p ~/.bin
    PATH="${HOME}/.bin:${PATH}"
    curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
    chmod a+rx ~/.bin/repo



    Basic Device Tree
    ==================

    mkdir TWRP
    cd TWRP
    git init
    git clone https://github.com/twrpdtgen/twrpdtgen
    pip3 install twrpdtgen
    sudo apt install cpio
    copy stock recovery.img to ~/TWRP/twrpdtgen

    cd twrpdtgen
    python3 -m twrpdtgen recovery.img

    rename ~/TWRP/twrpdtgen/output/samsung/a12s/omni_a12s.mk to twrp_a12s.mk

    delete vendorsetup.sh

    Add this to recovery.fstab

    # Removable storage
    /external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=storage;wipeingui;removable
    /usb-otg auto /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable

    Make a copy of recovery.fstab and rename to twrp.flags
    Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
    (create these folders)

    open twrp_a12s.mk and
    1. delete the 3 lines below # Inherit from those products, Most specific first.
    replace those 3 lines with this
    $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)

    2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
    3. change omni to twrp (2 places)

    open AndroidProducts.mk
    change omni to twrp (4 spots)

    Optional: add extra items to BoardConfig.mk


    cd ~
    sudo apt install git aria2 -y
    git clone https://gitlab.com/OrangeFox/misc/scripts
    cd scripts
    sudo bash setup/android_build_env.sh
    sudo bash setup/install_android_sdk.sh


    • Make a directory called ~/a12s-twrp
    cd ~/a12s-twrp

    repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11


    repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1

    copy ~/TWRP/twrpdtgen/output/samsung to /a12s-twrp/device


    Building
    ========


    . build/envsetup.sh
    lunch twrp_a12s-eng
    mka recoveryimage

    Recovery.img at out/target/product/a12s/recovery.img