06-03-2020, 09:16 PM
(06-03-2020, 08:50 PM)lot378 Wrote: Were any error checks omitted in the excerpt above? The dd commands send stdout and stderr to null nothing to read.
Doing that without checking for errors or testing to verify may be a bad action.
The script I am looking at does a file check to make sure the image files exist. That is pretty much it...
Code:
echo "Updating U-Boot..."
SYSPART=$(findmnt -n -o SOURCE /)
if echo $SYSPART | grep -qE 'p[0-9]$' ; then
DEVID=$(echo $SYSPART | sed -e s+'p[0-9]$'+''+)
else
DEVID=$(echo $SYSPART | sed -e s+'[0-9]$'++)
fi
echo Identified $DEVID as device to flash uboot to...
if [ -f $DIR/idbloader.img ] ; then
echo "Upgrading idbloader.img..."
dd if=$DIR/idbloader.img of=$DEVID bs=32k seek=1 conv=fsync &>/dev/null
fi
if [ -f $DIR/uboot.img ] ; then
echo "Upgrading uboot.img..."
dd if=$DIR/uboot.img of=$DEVID bs=64k seek=128 conv=fsync &>/dev/null
fi
if [ -f $DIR/trust.img ] ; then
echo "Upgrading trust.img..."
dd if=$DIR/trust.img of=$DEVID bs=64k seek=192 conv=fsync &>/dev/null
fi
I wanted to sanity check before I ran it; so, echoed the dd commands instead.
The wiki identifies the eMMC as mmcblk1 (see: https://wiki.pine64.org/index.php/Pinebo...le_Storage). It enumerates as mmcblk2 on my PBP. All the partitions match up otherwise.