Skip to content

Commit

Permalink
Maintain 16KB footer for userdata encryption when shrinking (requires…
Browse files Browse the repository at this point in the history
… repartition back to stock then shrink userdata again)

Change-Id: I5ea6a4f68c49f6389f276823400f9708dc7988d2
  • Loading branch information
cosmicdan committed May 30, 2018
1 parent ad5f707 commit 864f5d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions recovery/root/tissot_manager/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ if [ "$choice" == "stock" ]; then
sleep 2
blockdev --rereadpt /dev/block/mmcblk0
sleep 1
make_ext4fs /dev/block/mmcblk0p$userdata_partnum
# Calculate the length of userdata for make_ext4fs minus 16KB (for the encryption footer reservation)
userdata_new_partlength_sectors=`echo $((userdata_partend_current-userdata_stock_partstart))`
userdata_new_partlength_bytes=`echo $((userdata_new_partlength_sectors*512))`
userdata_new_ext4size=`echo $((userdata_new_partlength_bytes-16384))`
make_ext4fs -a /data -l $userdata_new_ext4size /dev/block/mmcblk0p$userdata_partnum_current
else
ui_print "[!] Could not verify Userdata partition info. Resizing Userdata aborted."
fi;
Expand Down Expand Up @@ -113,7 +117,11 @@ elif [ "$choice" == "treble_userdata" ]; then
sleep 2
blockdev --rereadpt /dev/block/mmcblk0
sleep 1
make_ext4fs /dev/block/mmcblk0p$userdata_partnum_current
# Calculate the length of userdata for make_ext4fs minus 16KB (for the encryption footer reservation)
userdata_new_partlength_sectors=`echo $((userdata_partend_current-userdata_treble_partstart))`
userdata_new_partlength_bytes=`echo $((userdata_new_partlength_sectors*512))`
userdata_new_ext4size=`echo $((userdata_new_partlength_bytes-16384))`
make_ext4fs -a /data -l $userdata_new_ext4size /dev/block/mmcblk0p$userdata_partnum_current
ui_print "[#] Formatting vendor_a and vendor_b..."
sleep 2
make_ext4fs /dev/block/mmcblk0p$vendor_a_partnum
Expand Down
1 change: 1 addition & 0 deletions recovery/tissot_manager_resources/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<b>1.5</b>

<*>Fix device lock from new encryption service breaking repartition</*>
<*>Maintain 16KB footer for userdata encryption when shrinking (requires repartition back to stock then shrink userdata again)</*>



Expand Down

0 comments on commit 864f5d5

Please sign in to comment.