Convert /system to ext4
parent
defd23c614
commit
1249a50e0e
|
@ -8,7 +8,7 @@
|
||||||
# Use this _JUST_ after installing TWRP to prime your device!
|
# Use this _JUST_ after installing TWRP to prime your device!
|
||||||
#
|
#
|
||||||
# What does it do:
|
# What does it do:
|
||||||
# - Makes /vendor and /system read-write
|
# - Makes /vendor and /system read-write and converts /system to ext4
|
||||||
# - Disables file-based encryption on /data
|
# - Disables file-based encryption on /data
|
||||||
# - Disables full-disk encryption on /data
|
# - Disables full-disk encryption on /data
|
||||||
# - Disables stock recovery restoration
|
# - Disables stock recovery restoration
|
||||||
|
@ -61,6 +61,7 @@ resize_fs() {
|
||||||
local label=$2
|
local label=$2
|
||||||
local partname=$3
|
local partname=$3
|
||||||
local percent=$4
|
local percent=$4
|
||||||
|
local convert_fs=$5
|
||||||
local dm_block_ext4=$(df -t ext4 | grep "$path"'$' | cut -DF1)
|
local dm_block_ext4=$(df -t ext4 | grep "$path"'$' | cut -DF1)
|
||||||
local dm_block_f2fs=$(df -t f2fs | grep "$path"'$' | cut -DF1)
|
local dm_block_f2fs=$(df -t f2fs | grep "$path"'$' | cut -DF1)
|
||||||
|
|
||||||
|
@ -85,7 +86,11 @@ resize_fs() {
|
||||||
uuid=`toybox blkid $dm_block_f2fs | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o`
|
uuid=`toybox blkid $dm_block_f2fs | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o`
|
||||||
echo " - Create R/W $partname image..."
|
echo " - Create R/W $partname image..."
|
||||||
truncate -s ${new_fs_size_mb}M /data/new-rw.img
|
truncate -s ${new_fs_size_mb}M /data/new-rw.img
|
||||||
|
if [ "$convert_fs" = "ext4" ]; then
|
||||||
|
mke2fs -t ext4 -U $uuid -L $label /data/new-rw.img
|
||||||
|
else
|
||||||
make_f2fs -g android -O project_quota,extra_attr,inode_checksum,sb_checksum,compression,flexible_inline_xattr,verity,inode_crtime -U $uuid -f -l $label /data/new-rw.img
|
make_f2fs -g android -O project_quota,extra_attr,inode_checksum,sb_checksum,compression,flexible_inline_xattr,verity,inode_crtime -U $uuid -f -l $label /data/new-rw.img
|
||||||
|
fi
|
||||||
mkdir -p /data/new-rw
|
mkdir -p /data/new-rw
|
||||||
mount /data/new-rw.img /data/new-rw
|
mount /data/new-rw.img /data/new-rw
|
||||||
echo " - Copy old R/O $partname files to our new created image..."
|
echo " - Copy old R/O $partname files to our new created image..."
|
||||||
|
@ -100,7 +105,11 @@ resize_fs() {
|
||||||
umount $path
|
umount $path
|
||||||
umount /data/new-rw
|
umount /data/new-rw
|
||||||
echo " - Checking $partname image before flashing..."
|
echo " - Checking $partname image before flashing..."
|
||||||
|
if [ "$convert_fs" = "ext4" ]; then
|
||||||
|
e2fsck -f /data/new-rw.img
|
||||||
|
else
|
||||||
fsck.f2fs -f /data/new-rw.img
|
fsck.f2fs -f /data/new-rw.img
|
||||||
|
fi
|
||||||
echo " - Resizing partition $partname inside 'super' to $new_fs_size_mb MB using lptools"
|
echo " - Resizing partition $partname inside 'super' to $new_fs_size_mb MB using lptools"
|
||||||
lptools resize $partname $(stat -c '%s' /data/new-rw.img)
|
lptools resize $partname $(stat -c '%s' /data/new-rw.img)
|
||||||
lptools unmap $partname
|
lptools unmap $partname
|
||||||
|
@ -110,8 +119,7 @@ resize_fs() {
|
||||||
rm -rf /data/new-rw*
|
rm -rf /data/new-rw*
|
||||||
fi
|
fi
|
||||||
echo " - Remounting $path..."
|
echo " - Remounting $path..."
|
||||||
mount $path
|
mount -o rw /dev/block/bootdevice/by-name/$partname $path
|
||||||
mount -o remount,rw $path
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_free_size_check() {
|
fs_free_size_check() {
|
||||||
|
@ -409,7 +417,7 @@ if ! mount | grep '/vendor ' >/dev/null; then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fs_free_size_check $ANDROID_ROOT "/" system 70
|
fs_free_size_check $ANDROID_ROOT "/" system 70 ext4
|
||||||
fs_free_size_check /vendor vendor vendor 50
|
fs_free_size_check /vendor vendor vendor 50
|
||||||
disable_fbe
|
disable_fbe
|
||||||
disable_fde
|
disable_fde
|
||||||
|
|
Loading…
Reference in New Issue