[RECOVERY][DUALBOOT][MAGISK][3.3.1-79][Unified]Unofficial TWRP for OnePlus 7/7 Pro/5G

Search This thread

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
If you want to make something like this for your device, check out this guide here

Since I no longer have an OP 7 series device, this mod is now deprecated and won't be receiving any more updates. @invernomut0 has made a continuation of this mod using orangefox recovery. Check it out here!

Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.

Code:
#include <std_disclaimer.h>
/*
 *
 * We are not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at us for messing up your device, we will laugh at you.
 *
 */
Compatibility
This has only been tested by me on Oxygen OS Stable - Android Q.

Disclaimer
This is a DANGEROUS mod. Anything involving repartitioning is. If you fail to read and bad things happen, that's on you. Although I thoroughly tested this (managed to brick my phone once), there's always the possibility that something could go wrong with the worst case scenario resulting in a brick.
YOU'VE BEEN WARNED - Use at your own risk

What is this?
This is @mauronofrio's TWRP (see official thread here) that's been modified for true dual booting by splitting userdata into a/b slots (also does the same for metadata for encryption support). The installer script repartitions userdata for dualboot or stock based on your input.

Limitations
See the section in the github readme. MAKE SURE YOU READ THIS!

Features:
  • Same as mauronofrio's TWRP
  • Can choose between stock layout, a/b userdata, or a/b/c userdata where 'c' is a common data partition that'll show up in both roms - it's quite handy
  • Option to choose between ext4 and f2fs
  • Disables verity - fstabs are modified for dual boot and so this is a must unless you choose stock layout in which case it's optional
  • Option to disable forced encryption
  • Option to install magisk

Common Data
I recommend the a/b/c layout which includes this common data partition
  • If you choose a/b/c layout - you'll have a/b userdata, but you'll also get a 3rd userdata partition I call 'Common Data'
  • The name 'Common Data' gives away its purpose - to store files that you'll access on both slots/roms. So stuff like zips, pictures, music, TWRP backups, etc.
  • In TWRP, this shows up as another storage option for backup/restore and on your pc as well - your phone will have 'Common Storage' and 'Internal Storage'
  • In order to be accessible when booted, some parts of the system are modified so that the it'll be accessible WITHOUT root by the following mechanisms:
    - The common data partition is mounted to /sdcard/CommonData
    - .nomedia file is placed in CommonData so files in it won't be picked up twice if you decide to mount over internal storage as outlined below
    - Furthermore, if your use case is like mine where my music files are in common data, you can make 'mounts.txt' file in /datacommon containing a list of every FOLDER to mount directly over top of sdcard. So for example:
    /datacommon/Music -> /sdcard/Music
    + This of course mounts over anything there (overwrites it for as long as it's mounted) so make sure that you don't have the same folder in both datacommon and regular data
    + Note that there are 3 exceptions to this folder mounting rule:
    1) All - if this is the FIRST line, ALL folders in datacommon will be mounted
    2 )Android
    3) lost+found
    + The reasoning should be obvious - lost+found isn't something you should need to mess with and Android is for regular data partition only - that's OS specific and should be on separate slots
    + Note that you should have 1 folder listed on every line, for example:
    Code:
    DCIM
    Music
    Pictures
    ViPER4AndroidFX

Flashing Instructions
  • You MUST be booted into TWRP already when flashing this zip. You can grab a bootable twrp img from here
  • Since this modifies data - the zip CANNOT be on sdcard or data at all UNLESS you do not want to repartition/format
    - If you flash from data, the zip will copy itself to /tmp and instruct you to flash it from there OR you can just install twrp/magisk/disver-fec
    - You could do the above or copy it to a place like /dev or /tmp and flash it from there
    - Alternatively, you can adb sideload it
  • Read through ALL the prompts - there's lots of options :)
  • Note that if you change partition layout, THIS WILL WIPE ALL DATA INCLUDING INTERNAL STORAGE

How to Flash Roms - If you're NOT stock layout
  • Nothing changes here except ONLY FLASH IN TWRP
    - Roms always flash to the opposite slot. Keep that in mind and you'll be fine
    - So don't take an OTA while booted - boot into twrp, switch slots, reboot into twrp, flash rom
  • Normal flash procedure:
    1) Boot into twrp
    2) reboot into twrp selecting slot you do NOT want rom installed to
    3) Flash rom
    4) Flash this zip
    5) Reboot into twrp
    6) Flash everything else

Help! I Can't Boot!
  • Usually this is because you switched roms without formatting data first. This should be flashing 101 but we all forget sometimes. Plus this slot stuff can get confusing
  • If it only happens with a/b/c and not any other layout, there's a good chance it's selinux related. Try setting selinux to permissive at kernel level with this mod(source here). If this doesn't fix it, it could be because selinux can't be set to enforcing even with the mod depending on the rom

How to Manually Repartition Back to Stock
In the event any step in the repartioning fails, the entire installer aborts. The good news is that this prevents a potential brick. The bad is that you need to manually revert back. See the README on github for the procedure. Note that if the install went fine and you want to switch back to stock later, just flash the installer again and choose stock layout

Download

Source Code

Credits
  • Mauronofrio
  • Teamwin
  • CosmicDan
  • TopJohnWu
 
Last edited:

Kris Chen

Senior Member
Jan 10, 2013
754
326
Taoyuan
Google Pixel 6 Pro
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)
 

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)

The installer will tell you if it'll wipe internal storage or not.
Basically, if you choose to change the partition layout, data will all be wiped since it'll be repartitioned. If you choose to keep your partition layout at the beginning of the install, your data will be fine.
You could just use this zip as twrp, magisk, verity/fec modifer/installer to save you the extra steps and keep with stock layout
 

f41lbl0g

Senior Member
Mar 15, 2014
303
423
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?
 
Last edited:

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?

Yup. You can do whatever you want with either slot. This mod formats all data partitions as ext4 since that's what oneplus does. You can always reformat userdata to f2fs in twrp gui later if you want though. Same goes for common data although I don't think there's a gui option for that
 
  • Like
Reactions: Patrickzhong

f41lbl0g

Senior Member
Mar 15, 2014
303
423
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?

From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.
 

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?

From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.

It's automated by installer. If you have a 128gb device:
32gb for each userdata slot, commondata gets what's left
256gb device:
Everything's doubled from above
 

eyespunker

Senior Member
Jan 16, 2009
180
93
The Beach
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)

Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #

What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.
 
Last edited:

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)

Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #

What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.

I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock

But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim
 
  • Like
Reactions: arvindgr

eyespunker

Senior Member
Jan 16, 2009
180
93
The Beach
I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock

But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim

It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. and when I send the commands to flash system a or b the reply is partition not found?! I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.
 
Last edited:
  • Like
Reactions: 1DvsBstrd

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.

The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/

Why were you manually restoring? Did the zip cut off with partition error?

You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691
 
  • Like
Reactions: arvindgr

eyespunker

Senior Member
Jan 16, 2009
180
93
The Beach
The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/

Why were you manually restoring? Did the zip cut off with partition error?

You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691

When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.
 

Zackptg5

Recognized Developer
Sep 18, 2014
4,127
6,925
zackptg5.com
Google Pixel 4a
Google Pixel 5a
When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.

In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244

Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them
 
Last edited:

eyespunker

Senior Member
Jan 16, 2009
180
93
The Beach
In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244

Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them

I have now tried the latest two and have come up with the same results on the update when the device param load the result of the last communication is device does not match image.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 74
    If you want to make something like this for your device, check out this guide here

    Since I no longer have an OP 7 series device, this mod is now deprecated and won't be receiving any more updates. @invernomut0 has made a continuation of this mod using orangefox recovery. Check it out here!

    Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.

    Code:
    #include <std_disclaimer.h>
    /*
     *
     * We are not responsible for bricked devices, dead SD cards,
     * thermonuclear war, or you getting fired because the alarm app failed. Please
     * do some research if you have any concerns about features included in this ROM
     * before flashing it! YOU are choosing to make these modifications, and if
     * you point the finger at us for messing up your device, we will laugh at you.
     *
     */
    Compatibility
    This has only been tested by me on Oxygen OS Stable - Android Q.

    Disclaimer
    This is a DANGEROUS mod. Anything involving repartitioning is. If you fail to read and bad things happen, that's on you. Although I thoroughly tested this (managed to brick my phone once), there's always the possibility that something could go wrong with the worst case scenario resulting in a brick.
    YOU'VE BEEN WARNED - Use at your own risk

    What is this?
    This is @mauronofrio's TWRP (see official thread here) that's been modified for true dual booting by splitting userdata into a/b slots (also does the same for metadata for encryption support). The installer script repartitions userdata for dualboot or stock based on your input.

    Limitations
    See the section in the github readme. MAKE SURE YOU READ THIS!

    Features:
    • Same as mauronofrio's TWRP
    • Can choose between stock layout, a/b userdata, or a/b/c userdata where 'c' is a common data partition that'll show up in both roms - it's quite handy
    • Option to choose between ext4 and f2fs
    • Disables verity - fstabs are modified for dual boot and so this is a must unless you choose stock layout in which case it's optional
    • Option to disable forced encryption
    • Option to install magisk

    Common Data
    I recommend the a/b/c layout which includes this common data partition
    • If you choose a/b/c layout - you'll have a/b userdata, but you'll also get a 3rd userdata partition I call 'Common Data'
    • The name 'Common Data' gives away its purpose - to store files that you'll access on both slots/roms. So stuff like zips, pictures, music, TWRP backups, etc.
    • In TWRP, this shows up as another storage option for backup/restore and on your pc as well - your phone will have 'Common Storage' and 'Internal Storage'
    • In order to be accessible when booted, some parts of the system are modified so that the it'll be accessible WITHOUT root by the following mechanisms:
      - The common data partition is mounted to /sdcard/CommonData
      - .nomedia file is placed in CommonData so files in it won't be picked up twice if you decide to mount over internal storage as outlined below
      - Furthermore, if your use case is like mine where my music files are in common data, you can make 'mounts.txt' file in /datacommon containing a list of every FOLDER to mount directly over top of sdcard. So for example:
      /datacommon/Music -> /sdcard/Music
      + This of course mounts over anything there (overwrites it for as long as it's mounted) so make sure that you don't have the same folder in both datacommon and regular data
      + Note that there are 3 exceptions to this folder mounting rule:
      1) All - if this is the FIRST line, ALL folders in datacommon will be mounted
      2 )Android
      3) lost+found
      + The reasoning should be obvious - lost+found isn't something you should need to mess with and Android is for regular data partition only - that's OS specific and should be on separate slots
      + Note that you should have 1 folder listed on every line, for example:
      Code:
      DCIM
      Music
      Pictures
      ViPER4AndroidFX

    Flashing Instructions
    • You MUST be booted into TWRP already when flashing this zip. You can grab a bootable twrp img from here
    • Since this modifies data - the zip CANNOT be on sdcard or data at all UNLESS you do not want to repartition/format
      - If you flash from data, the zip will copy itself to /tmp and instruct you to flash it from there OR you can just install twrp/magisk/disver-fec
      - You could do the above or copy it to a place like /dev or /tmp and flash it from there
      - Alternatively, you can adb sideload it
    • Read through ALL the prompts - there's lots of options :)
    • Note that if you change partition layout, THIS WILL WIPE ALL DATA INCLUDING INTERNAL STORAGE

    How to Flash Roms - If you're NOT stock layout
    • Nothing changes here except ONLY FLASH IN TWRP
      - Roms always flash to the opposite slot. Keep that in mind and you'll be fine
      - So don't take an OTA while booted - boot into twrp, switch slots, reboot into twrp, flash rom
    • Normal flash procedure:
      1) Boot into twrp
      2) reboot into twrp selecting slot you do NOT want rom installed to
      3) Flash rom
      4) Flash this zip
      5) Reboot into twrp
      6) Flash everything else

    Help! I Can't Boot!
    • Usually this is because you switched roms without formatting data first. This should be flashing 101 but we all forget sometimes. Plus this slot stuff can get confusing
    • If it only happens with a/b/c and not any other layout, there's a good chance it's selinux related. Try setting selinux to permissive at kernel level with this mod(source here). If this doesn't fix it, it could be because selinux can't be set to enforcing even with the mod depending on the rom

    How to Manually Repartition Back to Stock
    In the event any step in the repartioning fails, the entire installer aborts. The good news is that this prevents a potential brick. The bad is that you need to manually revert back. See the README on github for the procedure. Note that if the install went fine and you want to switch back to stock later, just flash the installer again and choose stock layout

    Download

    Source Code

    Credits
    • Mauronofrio
    • Teamwin
    • CosmicDan
    • TopJohnWu
    16
    Very ****ing badass. ?
    7
    Dualboot TWRP with updated TWRP-3.4.0-0

    I have uploaded the Dualboot TWRP with updated TWRP-3.4.0-0 here.
    7
    I succesfully manage dualboot OOS Beta 11 and Evolution 4.1 ,,heres what i did :
    1.Reboot TWRP >Format Data
    2.Reboot TWRP > Flash original TWRP 79
    3.Reboot TWRP > Flash Dualboot TWRP ( sideload ) - choose a.b.c layout -disable.force encryption
    4.Reboot TWRP (dualboot now) > Flash OOS Beta 11 >Flash Dualboot TWRP
    5.Reboot TWRP > Flash OOS Beta 11 again -
    > Flash Dualboot TWRP
    6.Reboot TWRP > Flash Evolution 4.1-> Flash Dualboot TWRP
    7.Reboot to System,enjoy Dual Boot,,its Awesome!!

    Oneplus 7 Pro 256 gb
    7
    v4 is finally here! There's actually quite the extensive changelog:
    * Add mount all option for datacommon mounts.txt
    * Redid how commondata was mounted - fixed issues with lots of roms like AOSPA
    * Magisk made optional for commondata - it is still needed for some roms though (like oos)
    * Made other vars slot selectable
    * Storage size detection fix
    * Misc fixes/improvements
    * Updated to magisk 20.4

    Download is in github releases like always :D

    Edit: Reuploaded v4 - needed to make partition size detection more robust