AK3: detect flashing to inactive slot during OTA on VAB devices (#77)
This commit is contained in:
1 parent
9664985a0b
commit
ddbb40edc8
3 files changed
+13
-4
No files matched your search
@@ -3,4 +3,4 @@
|
|||||||
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
|
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# AK_BASE_VERSION=20230406
|
# AK_BASE_VERSION=20230416
|
||||||
+12
-3
@@ -415,7 +415,7 @@ flash_boot() {
|
|||||||
|
|
||||||
# flash_generic <name>
|
# flash_generic <name>
|
||||||
flash_generic() {
|
flash_generic() {
|
||||||
local avb avbblock avbpath file flags img imgblock isro isunmounted path;
|
local avb avbblock avbpath file flags img imgblock imgsz isro isunmounted path;
|
||||||
|
|
||||||
cd $home;
|
cd $home;
|
||||||
for file in $1 $1.img; do
|
for file in $1 $1.img; do
|
||||||
@@ -461,15 +461,22 @@ flash_generic() {
|
|||||||
cd $home;
|
cd $home;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
imgsz=$(wc -c < $img);
|
||||||
|
if [ "$imgsz" != "$(wc -c < $imgblock)" ]; then
|
||||||
|
if [ -d /postinstall/tmp -a "$slot_select" == "inactive" ]; then
|
||||||
|
echo "Resizing $1$slot snapshot..." >&2;
|
||||||
|
$bin/snapshotupdater_static update $1 $imgsz || abort "Resizing $1$slot snapshot failed. Aborting...";
|
||||||
|
else
|
||||||
echo "Removing any existing $1_ak3..." >&2;
|
echo "Removing any existing $1_ak3..." >&2;
|
||||||
$bin/lptools_static remove $1_ak3;
|
$bin/lptools_static remove $1_ak3;
|
||||||
echo "Attempting to create $1_ak3..." >&2;
|
echo "Attempting to create $1_ak3..." >&2;
|
||||||
if $bin/lptools_static create $1_ak3 $(wc -c < $img); then
|
if $bin/lptools_static create $1_ak3 $imgsz; then
|
||||||
echo "Replacing $1$slot with $1_ak3..." >&2;
|
echo "Replacing $1$slot with $1_ak3..." >&2;
|
||||||
$bin/lptools_static unmap $1_ak3 || abort "Unmapping $1_ak3 failed. Aborting...";
|
$bin/lptools_static unmap $1_ak3 || abort "Unmapping $1_ak3 failed. Aborting...";
|
||||||
$bin/lptools_static map $1_ak3 || abort "Mapping $1_ak3 failed. Aborting...";
|
$bin/lptools_static map $1_ak3 || abort "Mapping $1_ak3 failed. Aborting...";
|
||||||
$bin/lptools_static replace $1_ak3 $1$slot || abort "Replacing $1$slot failed. Aborting...";
|
$bin/lptools_static replace $1_ak3 $1$slot || abort "Replacing $1$slot failed. Aborting...";
|
||||||
imgblock=/dev/block/mapper/$1_ak3;
|
imgblock=/dev/block/mapper/$1_ak3;
|
||||||
|
ui_print " " "Warning: $1$slot replaced in super. Reboot before further logical partition operations.";
|
||||||
else
|
else
|
||||||
echo "Creating $1_ak3 failed. Attempting to resize $1$slot..." >&2;
|
echo "Creating $1_ak3 failed. Attempting to resize $1$slot..." >&2;
|
||||||
$bin/httools_static umount $1 || abort "Unmounting $1 failed. Aborting...";
|
$bin/httools_static umount $1 || abort "Unmounting $1 failed. Aborting...";
|
||||||
@@ -477,10 +484,12 @@ flash_generic() {
|
|||||||
$bin/lptools_static unmap $1-verity || abort "Unmapping $1-verity failed. Aborting...";
|
$bin/lptools_static unmap $1-verity || abort "Unmapping $1-verity failed. Aborting...";
|
||||||
fi
|
fi
|
||||||
$bin/lptools_static unmap $1$slot || abort "Unmapping $1$slot failed. Aborting...";
|
$bin/lptools_static unmap $1$slot || abort "Unmapping $1$slot failed. Aborting...";
|
||||||
$bin/lptools_static resize $1$slot $(wc -c < $img) || abort "Resizing $1$slot failed. Aborting...";
|
$bin/lptools_static resize $1$slot $imgsz || abort "Resizing $1$slot failed. Aborting...";
|
||||||
$bin/lptools_static map $1$slot || abort "Mapping $1$slot failed. Aborting...";
|
$bin/lptools_static map $1$slot || abort "Mapping $1$slot failed. Aborting...";
|
||||||
isunmounted=1;
|
isunmounted=1;
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
elif [ "$(wc -c < $img)" -gt "$(wc -c < $imgblock)" ]; then
|
elif [ "$(wc -c < $img)" -gt "$(wc -c < $imgblock)" ]; then
|
||||||
abort "New $1 image larger than $1 partition. Aborting...";
|
abort "New $1 image larger than $1 partition. Aborting...";
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
Reference in new issue
Block a user