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.
- 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 Fairphone's factory image for your phone from Fairphone, as its manual install guide describes.
- Check its SHA-256 against the checksum Fairphone publishes:
sha256sum FILE.zip, orshasum -a 256 FILE.zipon macOS. Stop if the checksum differs. - Use the Fairphone 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. Hold Volume down while it starts, until it shows Fastboot Mode.
- Run
fastboot flashing unlock, or press Unlock bootloader on the installer page. Confirm on the phone. This erases all data. - 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
- 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. - Unpack the factory image. Copy its flash script into the same folder, and in the copy
change
REBOOT_TO_BOOTLOADER="false"toREBOOT_TO_BOOTLOADER="true". Change nothing else. - Run the copy, as Fairphone's guide describes. The phone then stays in Fastboot Mode instead of starting Android.
- 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.
- 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. Hold Volume down 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 Fairphone's order: the critical partitions first, then the bootloader. Never use
fastboot flashing lock_critical with DiamaneOS.