[OnePlus 7 & 7 Pro Cross Device Development] invernomut0:
Orangefox-DualBoot-Guac-Unified - Android 10/11 version

THANKS TO:

- Zackptg5 - The father of this mod

- DrakePL (Orangefox Recovery)

- Ae3NerdGod, Neel P, Whismasterflo

- Muphetz, Varun Soma, Pranav - for testing

Modified recovery and installer script for all OP7/Pro/5G variants that re-purposes userdata for true dual booting. You can still use this as a regular stock twrp zip - one stop shop for magisk, verity, and/or forced encryption modifications

Disclaimer

Limitations

If you set a password, regardless of encryption status, it'll corrupt the other slot if it's also password protected.

Note that some roms set one automatically Either don't use a password on one slot, or leave one slot (I'll use 'a' in this example) unencrypted and:

Setup rom, password, and everything on slot a

Boot back into twrp, choose common data as storage, and backup userdata (if not using a/b/c layout, backup TWRP folder to your computer)

Setup rom, password, and everything on the other slot (b)

Boot back into twrp, switch back to slot a (reboot back into twrp), and restore the twrp backup

If you messed this up and are unencrypted - delete these files in /data/system if present: locksettings.db gatekeeper.password.key password.key gatekeeper.pattern.key pattern.key gatekeeper.gesture.key gesture.key

If you messed this up and are encrypted - you lost the data on that slot:

Unmount metadata in twrp gui

Format metadata with this command:

mke2fs -t ext4 -b 4096 /dev/block/sda$metadata_partnum

where metadata_partnum is the partition number of the current metadata partition (you can find this with sgdisk /dev/block/sda --print).

DO NOT FORGET THE PARTITION NUMBER

. If you do, you'll format all of sda which results in a brick

Reboot into twrp and format data in gui

Storage settings only supports 128 and 256gb userdata partitions

Just a cosmetic issue as it'll say that system is taking up the difference

Some other features/notes

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

Quickmode for faster rom testing

Failsafe to keep from changing slots automatically when used in conjunction with rom install

Common Data

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:

All - if this is the FIRST line, ALL folders in datacommon will be mounted

Android

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:

Music
Pictures
ViPER4AndroidFX

Flashing Instructions

(if Android 11, see second post)

You MUST be booted into TWRP already when flashing this zip (you can grab a bootable twrp image 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 :)

How to Flash Roms

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:

Boot into twrp

reboot into twrp selecting slot you do NOT want rom installed to

Flash rom

Flash this zip

Reboot into twrp

When using failsafe mode,

TWRP will boot into the slot you were in BEFORE you flashed the rom.

TWRP will almost certainly show the incorrect "current slot" at the reboot menu.

The slot selection buttons still work. If youve kept track in youre head, and the zip didnt fail; pick the correct slot now

or reboot to recovery, then switch into the slot which contains the new rom youve just installed

Flash everything else

Quickmode usage NOT RESPONSIBLE FOR BUGS, BRICKS OR MISTAKES! USE AT OWN RISK!

Change the zip name to enable quickmode options (Case Sensitive!)

keeps current layout

add the words fast or quick in the zip file to enable quickmode with the following default options:

ForceEncryption disabled for both slot

s​

Magisk installed to both slots

add any of the following options to the name of the zipfile to custimize quickmode to your liking, capitilizing the letter of the slot youd like to enable that option for:

fec.ab will ENABLE force encrytion for the capitalized slot letter

su.ab or magisk.ab will ENABLE the installation of magisk for the capitalized slot letter

Example: if the file is named Orangefox-DualBoot-fast-fec.AB-su.aB.zip then:

ForceEncryption will be ENABLED on both slot _a and slot _b

Magisk will be installed on slot _b, but NOT installed on slot _a

ADVANCED USERS ONLY NOT RESPONSIBLE FOR BUGS, BRICKS OR MISTAKES! USE AT OWN RISK!

confirm.y will skip the final confirmation before any work is done, and run the options chosen or defaults if none specified

the word warp this can be used instead of fast or quick and confirm.y if you'd also like to use quickmode without confirmation

Failsafe usage / explaination

I've had a few instances where a rom doesnt agree with whats going on, and the dualboot zip gets stuck on a slot and never finishes. This results in forcing the phone off, and leaves the phone in a non bootable state, with an unprepared slot. Not to mention a stock, or worse, no recovery at all. Bootloop city.

Enter the failsafe option: just add ` nofail ` or ` failsafe ` (case sensitive) to the zip name like above, and the zip will revert the slot change caused by the rom install and keep you able to boot back into the current slot's TWRP so you can sort out the slot youre working on. Pair this with a usb drive or commondata, and youre (relatively) safe to flash on the go, or from your bed with the computer off.

Notes

After applying the failsafe, the reboot screen in TWRP will ALMOST CERTANLY show the incorrect slot until you either manually select a slot or reboot recovery.

This adds a step or two to the flashing process, make sure you've read that.

[/QUOTE]

Help! I Can't Boot!