Skip to content

Commit 39e6bf5

Browse files
Use resize2fs to shrink system.img
This replaces the whole make_ext4fs and mount stuff with resize2fs for shrinking the system.img like it is already done in the replace-android-image script.
1 parent e1e625c commit 39e6bf5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

halium-install

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ SYSIMG=$2
2727

2828
check_prereq()
2929
{
30-
if [ ! $(which make_ext4fs) ] || [ ! -x $(which simg2img) ] || \
31-
[ ! -x $(which adb) ]; then
30+
if [ ! -x $(which simg2img) ] || [ ! -x $(which adb) ]; then
3231
echo "please install the android-tools-fsutils and android-tools-adb packages" && exit 1
3332
fi
3433
}
@@ -41,10 +40,8 @@ do_shell()
4140
convert_android_img()
4241
{
4342
if file $SYSIMG | grep -v ": Linux rev 1.0 ext4" >/dev/null; then
44-
simg2img $SYSIMG $WORKDIR/system.img.raw
45-
mkdir $TMPMOUNT
46-
mount -t ext4 -o loop $WORKDIR/system.img.raw $TMPMOUNT
47-
make_ext4fs -l 160M $WORKDIR/system.img $TMPMOUNT
43+
simg2img $SYSIMG $WORKDIR/system.img
44+
resize2fs -M $WORKDIR/system.img
4845
SYSIMAGE=$WORKDIR/system.img
4946
else
5047
SYSIMAGE=$SYSIMG
@@ -75,7 +72,6 @@ cleanup()
7572
{
7673
echo
7774
echo "cleaning up"
78-
mount | grep -q $TMPMOUNT 2>/dev/null && umount $TMPMOUNT
7975
cleanup_device
8076
rm -rf $WORKDIR
8177
echo
@@ -168,7 +164,6 @@ fi
168164
check_mounts
169165

170166
WORKDIR=$(mktemp -d /tmp/halium-install.XXXXX)
171-
TMPMOUNT="$WORKDIR/tmpmount"
172167

173168
echo "transfering rootfs tarball ... "
174169
adb push $TARPATH /recovery/

0 commit comments

Comments
 (0)