Returning to the stock OS

This replaces DiamaneOS with Fairphone's stock OS on a Fairphone 6 and erases all data. 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. Hold Volume down while it starts, until it shows Fastboot Mode.
  4. Run fastboot flashing unlock, or press Unlock bootloader on the installer page. Confirm on the phone. This erases all data.
  5. Hold Volume down while it restarts, so that it returns to Fastboot Mode. If Android starts, turn the phone off and hold Volume down while it starts.

The critical partitions are still unlocked from the install. fastboot oem device-info must 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. Unpack the factory image. Copy its flash script into the same folder, and in the copy change REBOOT_TO_BOOTLOADER="false" to REBOOT_TO_BOOTLOADER="true". Change nothing else.
  3. Run the copy, as Fairphone's guide describes. The phone then stays in Fastboot Mode instead of starting Android.
  4. 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.

The bootloader can stop while it writes Fairphone's super.img, with "Error reading sparse file". Hold Power and Volume down until the phone restarts into Fastboot Mode. Then switch to fastbootd with fastboot reboot fastboot and write the logical partitions from super.img one by one.

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. Hold Volume down 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 Fairphone's order: the critical partitions first, then the bootloader. Never use fastboot flashing lock_critical with DiamaneOS.