common: mke2img.sh: Retry with increased size when genext2fs failed
Change-Id: Ifb3574dece52289ff90f552409bd325bacfbfd61 Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
@ -6,9 +6,19 @@ SIZE=`du -sk --apparent-size $SRC | cut --fields=1`
|
||||
inode_counti=`find $SRC | wc -l`
|
||||
inode_counti=$[inode_counti+512]
|
||||
EXTRA_SIZE=$[inode_counti*4]
|
||||
SIZE=$[SIZE+EXTRA_SIZE]
|
||||
echo "genext2fs -b $SIZE -N $inode_counti -d $SRC $DST"
|
||||
genext2fs -b $SIZE -N $inode_counti -d $SRC $DST
|
||||
tune2fs -C 1 $DST
|
||||
|
||||
MAX_RETRY=10
|
||||
RETRY=0
|
||||
while true;do
|
||||
SIZE=$[SIZE+EXTRA_SIZE]
|
||||
echo "genext2fs -b $SIZE -N $inode_counti -d $SRC $DST"
|
||||
genext2fs -b $SIZE -N $inode_counti -d $SRC $DST && break
|
||||
|
||||
RETRY=$[RETRY+1]
|
||||
[ ! $RETRY -lt $MAX_RETRY ] && { echo "Failed to make e2fs image! "; exit; }
|
||||
echo "Retring with increased size....($RETRY/$MAX_RETRY)"
|
||||
done
|
||||
|
||||
tune2fs -c 1 -i 0 $DST
|
||||
resize2fs -M $DST
|
||||
e2fsck -fy $DST
|
||||
e2fsck -fyD $DST
|
||||
|
||||
Reference in New Issue
Block a user