declare FORMAT=""
declare DEVICE=""
+declare -i OLD_DD=0
# Binaires array for fusing
declare -a FUSING_BINARY_ARRAY
tput sgr 0
}
+function check_ddversion () {
+ # NOTE
+ # before coreutils dd 8.24, dd doesn't support "status=progress"
+ # and the option causes fusing failure. For backward compatibility,
+ # do not use the option for old dd
+ local version=`dd --version | head -1 | awk '{print $3}'`
+ local major=${version%%.*}
+ local version=${version:`expr index $version .`}
+ local minor=${version%%.*}
+
+ if [ $major -lt 8 ]; then
+ OLD_DD=1
+ elif [ $major -eq 8 -a $minor -lt 24 ]; then
+ OLD_DD=1
+ fi
+}
+
function add_fusing_entry () {
local name=$1
local offset=$2
fi
local -r input_size=`du -b $fusing_img | awk '{print $1}'`
+ local -r input_size_mb=`expr $input_size / 1024 / 1024`
- print_message 2 "[Fusing $1]"
-
- dd if=$fusing_img | pv -s $input_size | dd of=$device seek=$seek bs=$bs
+ print_message 2 "[Fusing $1 ($input_size_mb MiB)]"
+ umount $device
+ if [ $OLD_DD == 1 ]; then
+ dd if=$fusing_img | pv -s $input_size | dd of=$device seek=$seek bs=$bs
+ else
+ dd if=$fusing_img of=$device seek=$seek bs=$bs status=progress oflag=direct
+ fi
if [ $(basename $fusing_img) == "u-boot-mmc.bin" ];then
add_fusing_entry "u-boot" $seek 2048
function print_logo () {
echo ""
- echo "[Odroid-XU3/4 downloader version 1.2]"
+ echo "[Odroid-XU3/4 downloader version 1.3]"
echo "This version also supports Tizen 4.0."
echo ""
}
check_args
check_device
check_partition_format
+check_ddversion
fuse_image