Skip to content

Flashing Image

Flashing Image

Setup Device

Turn on the Device and hold the power and Down Button. This will put the device in to fastboot mode which is used to make changes to the OS and Boot properties.

Check to make sure that the device is in fastboot mode:

>>> sudo fastboot devices
025c3fc9679cb8f0	fastboot

Unlock the OEM if not already done:

>>> sudo fastboot oem unlock
FAILED (remote: Already unlocked)
Finished. Total time: 0.047s

Setting Up Pixel 3a

sudo fastboot boot magisk_patched.img

Flashing Device

Flash the Main OS Partitions. Factory Nexus 5X Image

>>> sudo fastboot flash bootloader bootloader-bullhead-bhz11m.img 
target reported max download size of 536870912 bytes
Sending 'bootloader' (4616 KB)...
OKAY [  0.217s]
Writing 'bootloader'...
OKAY [  0.149s]
Finished. Total time: 0.450s

>>> unzip image-bullhead-n2g48c.zip

>>> sudo fastboot flash boot boot.img 
target reported max download size of 536870912 bytes
Sending 'boot' (12045 KB)...
OKAY [  0.448s]
Writing 'boot'...
OKAY [  0.120s]
Finished. Total time: 0.657s

>>> sudo fastboot flash system system.img 
target reported max download size of 536870912 bytes
Erasing 'system'...
OKAY [  0.572s]
[...]

>>> sudo fastboot flash vendor vendor.img
target reported max download size of 536870912 bytes
Erasing 'system'...
OKAY [  0.572s]
[...]

Flash the Recovery partition and use TWRP

>>> sudo fastboot flash recovery ../twrp-3.2.3-0-bullhead.img 
target reported max download size of 536870912 bytes
Sending 'recovery' (16289 KB)...
OKAY [  0.543s]
Writing 'recovery'...
OKAY [  0.155s]
Finished. Total time: 0.780s

Recovery partition reverts at reboot

TODO Check which one
1:
The system overrides stock recovery with a service in init on every system boot, 'service flash_recovery /system/bin/install-recovery.sh'

You can avoid it by deleting/renaming the install-recovery.sh present in /system/bin/ when you install oos via twrp before booting into system.

2:
dm-verity (a.k.a verified boot) checks certain places to make sure they haven't been tampered with. So if it detects a recovery image it doesn't expect, it restores the original. That's what you're seeing.

Try flashing magisk, as it disables dm-verity. If that doesn't work and you're on custom roms and kernels then maybe ask in those threads to see if people face that issue.

Root the device with SuperSU

Rooting the device can be done through the recovery menu.

  1. Boot into the Recovery partition by either holding both the Power and Down Button or adb reboot recovery
  2. Click on the Advanced Button
  3. Click on the ADB Sideload Button
  4. Run adb sideload ../UPDATE-SuperSU-v2.82-20170528234214.zip
  5. Click the Reboot System Button

Root the Device with Magisk

  1. Download the Magisk Manager
  2. Download the Zip installer
  3. Reboot into Recovery Mode
  4. Install the Zip
  5. Reboot into normal mode

Enable Developer Mode

  1. Launch the setting application
  2. Click the About Phone Button
  3. Click on the Build Number Button 7 times
  4. Click the back button
  5. Click on the Developer Options Button
  6. Click on the USB debugging Button to enable USB debugging
  7. Connect the USB to your computer
  8. In the menu bar click the Bottom button
  9. Change the USB option to Transfer files
  10. Connect using adb devices
  11. Click Trust on the popup.

Changing setting

Setting the Default USB to File Transfer

  1. Unplug the device from USB
  2. GO to Settings App -> Developer Options -> Select USB Configuration
  3. Set to MTP

Back Up Android Image

Nandroid and EFS Backups:

  1. From the bootloader screen, use the volume keys to select the "Recovery" option
  2. From the TWRP home screen, select the "Backup" option
  3. Select ONLY the data, system and boot checkboxes
  4. Rename the backup to Nandroid-Backup-[Append date/timestamp]
  5. Swipe to perform the backup
  6. Upon completion, go back to the "Backup" screen
  7. Select ONLY the EFS checkbox
  8. Rename the backup to EFS-Backup-[Append date/timestamp]
  9. Swipe to perform the backup
  10. Return to the bootloader screen by issuing the following command

Backup Current User Data:

adb backup -all -apk -shared

Use a backup from another Phone:

https://forum.xda-developers.com/motorola-one/how-to/twrp-similar-device-t3873875/page6

  1. Get the backup from another phone
  2. Make a Folder with the DeviceID
  3. Restore the Phone

Get the Device ID:

>>> adb shell
shell@bullhead:/ $ getprop ro.serialno
02593b6f4eacaca6
shell@bullhead:/ $ cd sdcard/TWRP/BACKUPS/                                     
shell@bullhead:/sdcard/TWRP/BACKUPS $ ls
02593b6f4eacaca6
shell@bullhead:/sdcard/TWRP/BACKUPS $ 

Currently Fails