Following Google's guide for flashing/restoring the stock Android ROM, and initially using the default flash-all.sh shell script to flash the stock Android ROM to my device, I noticed that I am not able to do this successfully on the second consecutive attempt.
When flashing the stock Android ROM the first time (usually when flashing the stock over a custom ROM or flashing the stock recovery over the existing TWRP recovery), the first attempt successfully flashes the stock Android ROM to the device and I am presented with the Android setup wizard.However, if I repeat the same flashing process once more, the device is stuck on the Android logo boot animation.
I read that this is caused by the cache partition not being erased before flashing.Several tutorials have claimed that the cache needs to be wiped from within the recovery, and although I have tested this to be successful, I would prefer a method that can erase the cache during the flashing process (or an adb
or fastboot
alternative) without having to re-enter recovery.
I have tried adding the fastboot
commands to the flash-all.sh shell script to erase cache
and erase userdata
, either before or after flashing all of the partitions with those of the stock image, but it does not solve the issue.
My device is the Huawei Nexus 6p and I am using the latest stock Android ROM for Angler (8.1.0 (OPM7.181205.001, Dec 2018)), which does not contain a cache.img file (removed since Android 8.0).I am aware that I could extract the cache.img file from an earlier stock image (e.g. Android 7.0) and flash
that with fastboot
, but I'd prefer not to have to rely on two different stock images, and one just for the archived cache.img.
My customised flash-all.sh shell script, inspired by examples here and here, is as follows:
fastboot flash bootloader bootloader-angler-angler-03.84.imgfastboot reboot-bootloadersleep 2fastboot flash radio radio-angler-angler-03.88.imgfastboot reboot-bootloadersleep 2fastboot flash recovery recovery.imgfastboot reboot-bootloadersleep 2# no cache image (cache.img) in Android 8.0+, instead:fastboot erase userdatafastboot erase cache# does not seem to flash images, even if extraced into the PWDfastboot -w update image-angler-opm7.181205.001.zip# ... which is the equivalent to (in the correct order) fastboot flash boot boot.imgsleep 2fastboot flash system system.imgsleep 2fastboot flash vendor vendor.imgsleep 2fastboot erase userdatafastboot erase cachesleep 2fastboot reboot
Q: What command(s) can I use during the flashing process (i.e within the bootloader) to successfully erase the cache partition so that I am not stuck on the boot animation logo upon startup?