clobber-state: Ensure active kernel still boots after wiping.

When an auto update is in progress, there is a period that system will start
with a kernel without GPT "successful" bit set. If we do wiping (ex, power-wash)
at that time, system may run out of trial counter and fall to recovery mode.

To prevent that, we should always set "successful" bit and set priority to
positive number before wiping inactive partitions.

TEST=manual: cgpt set /dev/sda2 -S 0 -T 3 -P 3; # simulate an AU
      cgpt set /dev/sda4 -S 1 -T 0 -P 2; # simulate an AU
      Reboot, power-wash
      cgpt show /dev/sda # see sda2.S=1, still boots.

Change-Id: I1e3dfd391db2e4aafdb7929b9f3d2b02d4bd14c8
Tested-by: Hung-Te Lin <>
Reviewed-by: Rong Chang <>
Commit-Queue: Hung-Te Lin <>
1 file changed