@echo off
set num_sizes=
set delta=
echo start to estimate num of blocks
cd ..\temp
for /f  %%a IN ('..\bin\du -sb oem') DO set num_sizes=%%a
cd ..\bin

set /a "num_sizes>>=20"
echo num_sizes = %num_sizes%M
if %num_sizes% LSS 20 set delta=20
if %num_sizes% gtr 20 set delta=108
if %num_sizes% gtr 500 set delta=440
echo delta = %delta%M

set /A num_sizes= %num_sizes%+%delta%

echo num_sizes = %num_sizes%M

make_ext4fs -l %num_sizes%M ..\Temp\oem.img ..\temp\oem

echo Info:Pack oem.img success.
goto exit

@echo on