AK3: use lptools resize for vendor_dlkm (#73)
- default to replace and fallback to resize when not enough space in super
This commit is contained in:
1 parent
330de65c77
commit
97794de0a2
3 files changed
+22
-9
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=20220727
|
# AK_BASE_VERSION=20220802
|
||||||
+21
-8
@@ -415,7 +415,7 @@ flash_boot() {
|
|||||||
|
|
||||||
# flash_generic <name>
|
# flash_generic <name>
|
||||||
flash_generic() {
|
flash_generic() {
|
||||||
local avb avbblock file flags img imgblock isro path;
|
local avb avbblock avbpath file flags img imgblock isro isunmounted path;
|
||||||
|
|
||||||
cd $home;
|
cd $home;
|
||||||
for file in $1 $1.img; do
|
for file in $1 $1.img; do
|
||||||
@@ -444,27 +444,37 @@ flash_generic() {
|
|||||||
flags=$($bin/httools_static disable-flags);
|
flags=$($bin/httools_static disable-flags);
|
||||||
[ $? == 0 ] || abort "Failed to parse top-level vbmeta. Aborting...";
|
[ $? == 0 ] || abort "Failed to parse top-level vbmeta. Aborting...";
|
||||||
if [ "$flags" == "enabled" ]; then
|
if [ "$flags" == "enabled" ]; then
|
||||||
[ "$1" == "vendor_dlkm" -a "$avb" == "vbmeta" ] || abort "Unable to patch $1 on $avb. Aborting ...";
|
ui_print " " "dm-verity detected! Patching $avb...";
|
||||||
ui_print " " "dm-verity detected! Patching vbmeta...";
|
for avbpath in /dev/block/bootdevice/by-name /dev/block/mapper; do
|
||||||
for path in /dev/block/bootdevice/by-name /dev/block/mapper; do
|
|
||||||
for file in $avb $avb$slot; do
|
for file in $avb $avb$slot; do
|
||||||
if [ -e $path/$file ]; then
|
if [ -e $avbpath/$file ]; then
|
||||||
avbblock=$path/$file;
|
avbblock=$avbpath/$file;
|
||||||
break 2;
|
break 2;
|
||||||
fi;
|
fi;
|
||||||
done;
|
done;
|
||||||
done;
|
done;
|
||||||
cd $bin;
|
cd $bin;
|
||||||
$bin/httools_static patch $home/$img $avbblock || abort "Failed to patch $1 on $avb. Aborting...";
|
$bin/httools_static patch $1 $home/$img $avbblock || abort "Failed to patch $1 on $avb. Aborting...";
|
||||||
cd $home;
|
cd $home;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
$bin/lptools_static remove $1_ak3;
|
$bin/lptools_static remove $1_ak3;
|
||||||
$bin/lptools_static create $1_ak3 $(wc -c < $img) || abort "Creating $1_ak3 failed. Aborting...";
|
if $bin/lptools_static create $1_ak3 $(wc -c < $img); then
|
||||||
$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;
|
||||||
|
else
|
||||||
|
ui_print "Creating $1_ak3 failed. Attempting to resize $1$slot...";
|
||||||
|
$bin/httools_static umount $1 || abort "Unmounting $1 failed. Aborting...";
|
||||||
|
if [ -e $path/$1-verity ]; then
|
||||||
|
$bin/lptools_static unmap $1-verity || abort "Unmapping $1-verity failed. Aborting...";
|
||||||
|
fi
|
||||||
|
$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 map $1$slot || abort "Mapping $1$slot failed. Aborting...";
|
||||||
|
isunmounted=1;
|
||||||
|
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;
|
||||||
@@ -488,6 +498,9 @@ flash_generic() {
|
|||||||
if [ "$isro" != 0 ]; then
|
if [ "$isro" != 0 ]; then
|
||||||
blockdev --setro $imgblock 2>/dev/null;
|
blockdev --setro $imgblock 2>/dev/null;
|
||||||
fi;
|
fi;
|
||||||
|
if [ "$isunmounted" -a "$path" == "/dev/block/mapper" ]; then
|
||||||
|
$bin/httools_static mount $1 || abort "Mounting $1 failed. Aborting...";
|
||||||
|
fi
|
||||||
touch ${1}_flashed;
|
touch ${1}_flashed;
|
||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user