Search code examples
androidandroid-source

OTA update fails, can't mount /data/ partition


I am trying to implement OTA functionality for a msm8998 board running Android 8.1. I've generated the OTA file and followed the standard way of doing it,

I've run into two problems, solving either one would solve the issue:

  1. OTA size is bigger than /cache, therefore even though recovery can mount /cache, the image cannot fit there. How would I increase the /cache size, and is it a good idea to do so?
  2. If I put the OTA zip in /data/ or /sdcard/, I have an error during recovery, seemingly it can't mount it. How would I make /data/ mountable?

...

Finding update package...
I:Update location: /data/update.zip
Opening update package...
E:Failed to mount /data: Invalid argument
E:Unable to open '/data/update.zip': No such file or directory
E:failed to map file
W:failed to read uncrypt status: No such file or directory
W:Failed to read /sys/class/thermal/thermal_zone28/temp: Invalid argument
W:Failed to read /sys/class/thermal/thermal_zone27/temp: Invalid argument
I:current maximum temperature: 44756
I:/data/update.zip
I:0
I:time_total: 0
I:retry: 0
I:temperature_start: 44814
I:temperature_end: 44756
I:temperature_max: 44814
I:
Installation aborted.

Solution

  • Turns out you have to use RecoverySystem.installPackage(...) method AND have the OTA file be in /data/.

    Previously I had tried RecoverySystem.installPackage(...) method but with file in /sdcard/, and separately by setting /cache/recovery/command myself and using /data/

    When using RecoverySystem.installPackage(...) and the file in /data/, seems uncrypt is run on it before reboot, and that makes the update accessible to the recovery.