From: Łukasz Stelmach Date: Mon, 13 Sep 2021 16:46:39 +0000 (+0200) Subject: scripts: sd_fusing_rpi3: check file type before writing an image X-Git-Tag: submit/tizen/20220311.014813~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F272116%2F1;p=platform%2Fkernel%2Fu-boot.git scripts: sd_fusing_rpi3: check file type before writing an image Sometimes, when sfdisk failure is not handeled properly, sd_fusing_rpi3 may leave a regular file named like a device in the /dev directory. Such file will exist and prevent images from beeing properly flashed until the machine is rebooted. The message indicates there is somehting wrong with the device file so users may check and fix any problems. Change-Id: Ie7021129b858f0f4f2923ce88ee96f349e869029 Signed-off-by: Łukasz Stelmach --- diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index e7a7383bef..62efa1352e 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -88,6 +88,11 @@ function fusing_image () { return fi + if ! [ -b "$device" ]; then + print_message 1 "$device is not a block device." + exit 1 + fi + local -r input_size=`du -b $fusing_img | awk '{print $1}'` local -r input_size_mb=`expr $input_size / 1024 / 1024`