Flashing

Flashing

wiki.orangefox.tech

Flashing ROMs

Flashing a ROM is usually a straightforward process. You can either do a "clean" flash, or a "dirty" flash. "Clean" flash is always recommended, but in some cases, like flashing ROM's update "dirty" flash will be fine.

Always make backups.
Make a full backup of your current ROM - before performing any other operations in the recovery. At the very least, backup the /boot, /data, system_image (or system - if system_image is not available for backup) and vendor_image (or vendor - if vendor_image is not available for backup) partitions.
Xiaomi ARB
Xiaomi has broken ARB implemention which can brick your phone forever!
If your Xiaomi device has ARB, and you are on a MIUI ROM, then you had better tread very carefully if you want to change your MIUI ROM to a different MIUI ROM, or to a different version of the same MIUI ROM. Search on Google for "ARB", read and understand everything, and then decide whether you really need to proceed.

"Clean" flashing (Strongly recommended)

  1. Bootup OrangeFox Recovery
  2. Select "Wipe", and tick data (only if your device is not encrypted, or if it is encrypted with FDE). Then tick cache, and tick dalvik. Unless there is a very specific reason which requires it, do NOT wipe system or vendor - wiping them manually might end in tears (in any case, if your device has dynamic partitions, then you will not find system or vendor in the "wipe" list - which is a very good thing indeed). If you are changing ROMs on a device that is encrypted with FBE, then you must format data either before or after flashing the new ROM
  3. Swipe to wipe (this will restore the installed ROM to a known state, and will remove apps/settings that might be incompatible with the ROM that you wish to install).
  4. Select the ROM that you want to flash
  5. Swipe to flash
  6. Reboot OrangeFox recovery - before doing anything else - so that any changes to partitions/filesystems done by flashing the new ROM will take full effect
  7. Flash whatever else you might want to flash (eg, GAPPs, magisk, etc)
  8. Reboot your device
  9. Wait for a long time while the new ROM sets itself up (go and make a cup of tea!)
  10. Enjoy

NOTES:
A. Sometimes you might need to format (not just wipe) the data partition. If you format the data partition before flashing the new ROM, then you must reboot OrangeFox immediately afterwards, and, most definitely, before doing anything else.
B. If you are moving from a ROM that uses a different encryption protocol (eg, from FDE ROM to FBE ROM or vice-versa), then you must format the data partition preferably after flashing the new ROM, and then boot to system.
C. If you are moving from a stock ROM to a custom ROM (or vice versa), then you must format the data partition.
D. If you boot the newly flashed ROM, and it gets stuck forever on the Google/Android logo, or just dumps you at fastboot or straight back to OrangeFox, this might be a sign that you need to format the data partition.

"Dirty" flashing (NOT recommended)

Please not that dirty flashing a ROM is not recommended. It can cause all kinds of random problems.

  1. Bootup OrangeFox Recovery
  2. Choose the ROM that you want to flash
  3. Swipe to flash
  4. Wipe cache and dalvik
  5. Reboot OrangeFox
  6. Flash whatever else you might want to flash (eg, GAPPs, magisk, etc)
  7. Reboot your device (if it does not bootloop)
  8. Enjoy (if the device actually manages to boot, and you do not get random errors)

A/B devices

  • Most of the information on this page relates to A-only devices. A/B devices require some different considerations, which are not covered here.
  • If you have an A/B device, it is best to refer to the specific flashing instructions given by your ROM's developers, instead of the general information supplied here.
  • One thing to note with respect to A/B devices is that, with respect to flashing ROMs, unless the maintainer of the ROM that you are about to flash has embedded OrangeFox within the ROM itself (and has announced this fact), you must, immediately after flashing a ROM (including an OTA update), flash the OrangeFox zip again, then change slots, then reboot OrangeFox, before doing anything else. If you do not follow these steps, then you can expect problems (including the installed OrangeFox having been overwritten by the ROM installation).

I want to "clean" flash a new ROM. What do I need to wipe before flashing?

  • At the very least, you should wipe Dalvik/Art Cache, Cache, and Data.
  • Some ROM developers recommend also wiping System. Unless there is a very specific reason why you really need to do this, we do not recommend wiping System or Vendor.
  • Note that, on some ROMs with FBE encryption, wiping data and rebooting the recovery may leave your internal storage inaccessible (you will just see gibberish characters instead of filenames, and you will not be able to read or write to your internal SD). Normally you should be able to just go ahead and flash your ROM. But if trying to boot to system (after flashing the ROM) just reboots straight back to recovery, then you will need to format the data partition.

I want to flash something. How do I do select the file that I want to flash?

Tap on "Files", and navigate to the file that you want to flash. Tap on it, and you will see
the options for flashing. If you long-press on a file name, you will see a list of all the
operations that you can perform on that file.

I get an "error 7" when trying to flash (whatever)

  • The dreaded "error 7" can be caused by any number of things. Whatever is the specific cause in your case will be clearly displayed in red, and it will also be in the recovery log file.
  • Usually, the proximate cause is a check that the author of your zip installer's updater-script has added - whether it is for a specific firmware version, or some other specific feature, or you are simply trying to flash a zip meant for another device onto a wrong device. There will be an "assert" statement, which means that if the check fails, an error will be triggered. Other possible causes include trying to flash a zip file that is corrupted, and trying to flash something meant for one device onto another device.
  • Read very carefully what is on your screen and in the recovery log file, and address it.
  • You may also want to run a Google search
  • Do not ask for support, simply stating that you have got an error 7. You must provide details as to what is stated to be the cause, and you must attach a copy of the recovery log. If you do not do these, any request for support will simply amount to noise, and we will just ignore it.

Should I flash a DFE zip after flashing a ROM?

  • Under normal circumstances, there is no reason why you need to do that.
  • However, if the developer of your ROM advises you to do so, then you should always follow the advice of your ROM's developer.

Should I tick "Disable DM-Verity" before flashing my ROM?

  • It all depends on the ROM, and the device.
  • For newer (2019 and after) Xiaomi devices, and for Android 10 (or recent Android Pie) ROMs, you normally should not tick that box. But note the following below:
    1. Some ROMs will not boot if you disable DM-Verity
    1. Some ROMs will not boot if you don't disable DM-Verity
    1. How do you know the difference? Ask in your ROM's forums - or by trial and error - ie, test for yourself to see which is which (and you may need to do this for different ROMs even on the same device).

Should I tick "Disable Forced-Encryption" before flashing my ROM?

  • It depends on how you use your device, and what device you have.
  • Normally, you should keep your device encrypted, because that is the best way to secure your personal data if you phone gets lost or stolen. If you care at all about the security of your personal data, you should not tick that box.
  • On some devices (eg, lavender) if the phone is not encrypted, then you cannot successfully set up a lockscreen password/PIN/pattern. So your phone will be completely unsecured. If it gets lost or stolen, anybody who has the phone will be able to access all your private files. For most people, that would be a disaster.
  • On devices with dynamic partitions, some (Android 10/Android 11) ROMs set the dynamic partitions to read-only mode. This means that trying to disable forced-encryption will not work, as nothing can be written to the vendor or system partitions. One of these kinds of ROM is MIUI - so do not even attempt this with a MIUI ROM on a device with dynamic partitions. But there are many other ROMs that do the same thing as MIUI in this regard.

Should I wipe System and/or Vendor before flashing my ROM?

  • No! No! No!
  • Is that clear enough?
  • Please do NOT come to our groups or forums to ask about this. The answer will ALWAYS be "No".
  • You should NEVER have to wipe system or vendor manually.
  • If the instructions for flashing your ROM recommend doing this, you should ignore the recommendation.
  • If you really insist on trying to wipe these partitions, then you are on your own.
  • If your device has dynamic partitions, then you cannot wipe system or vendor anyway, even if you wanted to (unless you do it via fastboot - and if you attempt this, you are on your own).
  • A "clean flash" simply means: Flash the ROM + Wipe cache & dalvik + Wipe or format data (as may be required) + Boot the ROM.

How does "format data" differ from "wipe data"?

  • Wiping data simply deletes all the user apps and user data. This leaves intact the contents of the internal storage (eg, your pictures, movies, personal files, etc). It also leaves encryption intact - unless your device has FDE (see below).
  • Formatting data (you would have to type "yes" to agree to the format) will delete all user apps, all user data, all the contents of the internal storage, and will also remove encryption. After this process, the device is unencrypted, and all the contents of the internal storage (eg, your pictures, movies, personal files, etc) will be gone. So, if there are things in your internal storage that you do not wish to lose, then you must first make a backup of your internal storage (to an external storage medium) before trying to format data.
  • If the device has a full-disk encryption (or FDE) then wiping data + caches is effectively equivalent to a "factory reset". This should be sufficient in most cases for a "clean flash".
  • If the device has a file-based encryption (or FBE) just wiping data will leave the encryption in a messy state, and may lead to problems. This is really not equivalent to a "clean flash", and should be avoided.
  • For FBE devices, you should format data if you want a clean flash (and most certainly if you are changing your ROM). This should be done after flashing the ROM, and you should reboot to system immediately afterwards.
  • If you do not format data when changing ROMs on an FBE device, you WILL definitely have problems. This may range from being stuck forever at the boot logo, to being always unceremoniously dumped back to recovery mode or to the bootloader. The solution is to boot the recovery, and format the data partition (which you really should have done in the first place, thereby avoiding all the problems).
  • Most persistent issues with encryption require formatting data.

Source wiki.orangefox.tech

Report Page