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.

Getting the stock factory image

Unlocking

If the bootloader is locked:

  1. In DiamaneOS, turn on developer options under Settings > About phone by tapping Build number seven times.
  2. Turn on OEM unlocking under Settings > System > Developer options.
  3. Turn the phone off and start it in Fastboot Mode with its bootloader keys.
  4. Run fastboot flashing unlock, or press Unlock bootloader on the installer page. Confirm on the phone. This erases all data.
  5. 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

  1. 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.
  2. 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.
  3. 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.

  1. Remove DiamaneOS's key, so the phone no longer trusts it: fastboot erase avb_custom_key.
  2. Check that fastboot getvar current-slot reports a, and that fastboot oem device-info shows both unlocks and Verity mode: true.
  3. Check that fastboot flashing get_unlock_ability reports 1. If it reports 0, do not lock.
  4. Run fastboot flashing lock_critical and confirm on the phone. Use the bootloader keys while it restarts, so that it returns to Fastboot Mode without starting Android.
  5. Check again that fastboot flashing get_unlock_ability reports 1, and that fastboot oem device-info shows the critical partitions locked.
  6. Run fastboot flashing lock and confirm on the phone. This erases all data.
  7. 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.