Returning to the stock OS
This replaces DiamaneOS with the device maker's stock OS and erases all data. The notes for
each device on the supported devices
page link the device maker's factory images and install guide. It
uses fastboot from Google's
Android SDK
Platform-Tools. Back to the web installer.
- Run each command on its own and read its result before the next.
- Let every command finish. The bootloader stops answering when a command is cut off while the phone replies.
- Finish every lock step before starting Android. Stop if something fails. Do not repeat a lock command after an error.
Getting the stock factory image
- Download the device maker's factory image for your phone, as its install guide describes.
- Check its SHA-256 against the checksum the device maker publishes:
sha256sum FILE.zip, orshasum -a 256 FILE.zipon macOS. Stop if the checksum differs. - Use the stock release whose firmware the DiamaneOS install wrote, or a newer one. Older firmware than the phone runs can leave it unable to start.
Unlocking
If the bootloader is locked:
- In DiamaneOS, turn on developer options under Settings > About phone by tapping Build number seven times.
- Turn on OEM unlocking under Settings > System > Developer options.
- Turn the phone off and start it in Fastboot Mode with its bootloader keys.
- Run
fastboot flashing unlock, or press Unlock bootloader on the installer page. Confirm on the phone. This erases all data. - Use the bootloader keys while it restarts, so that it returns to Fastboot Mode. If Android starts, turn the phone off and start it in Fastboot Mode.
A locked DiamaneOS has its critical partitions locked too. If fastboot oem
device-info shows Device critical unlocked: false, run fastboot
flashing unlock_critical or press Unlock critical partitions on the installer page.
Confirm on the phone and return to Fastboot Mode the same way.
fastboot oem device-info must then show Device unlocked: true and
Device critical unlocked: true.
Installing the stock OS
- In Fastboot Mode, with the bootloader unlocked, run
fastboot oem reset-rollback. It clears the stored rollback indexes, so an older stock release can boot locked. The bootloader refuses it while locked. - Install the stock OS with the device maker's flash script from the factory image, as its guide describes. The phone must then stay in Fastboot Mode instead of starting Android. The notes for your device on the supported devices page say how, and what to do if the install stops.
- Do not start Android yet. Its first start on an unlocked phone turns OEM unlocking off, and the bootloader can then no longer be locked safely.
Locking on the stock OS
Lock only with the stock OS installed, and before Android starts.
- Remove DiamaneOS's key, so the phone no longer trusts it:
fastboot erase avb_custom_key. - Check that
fastboot getvar current-slotreports a, and thatfastboot oem device-infoshows both unlocks andVerity mode: true. - Check that
fastboot flashing get_unlock_abilityreports 1. If it reports 0, do not lock. - Run
fastboot flashing lock_criticaland confirm on the phone. Use the bootloader keys while it restarts, so that it returns to Fastboot Mode without starting Android. - Check again that
fastboot flashing get_unlock_abilityreports 1, and thatfastboot oem device-infoshows the critical partitions locked. - Run
fastboot flashing lockand confirm on the phone. This erases all data. - Start the stock OS. It starts without a warning screen. Then turn off OEM unlocking under Settings > System > Developer options.
This is the device maker's order: the critical partitions first, then the bootloader. The installer locks DiamaneOS in the same order.