I was worried that the u-boot was not stored on the sd-card, so flashing a non-working bootloader could brick the device. It doesn't seem to be the case:
Code:
UBOOT=$1
WAVEFORM=$2
KERNEL=$3
DEVICE=$4
if [ -e $UBOOT ]; then
echo Upgrading U-Boot $UBOOT
dd if=$UBOOT of=/dev/$DEVICE bs=1K seek=1 skip=1
if [ $? != 0 ] ; then
exit 1
fi
sync
sync
echo Done upgrading U-Boot
fi
if [ -e $WAVEFORM ]; then
echo Upgrading Waveform $WAVEFORM
dd if=$WAVEFORM.header of=/dev/$DEVICE bs=512 seek=14335
dd if=$WAVEFORM of=/dev/$DEVICE bs=512 seek=14336
if [ $? != 0 ] ; then
exit 1
fi
sync
sync
echo Done upgrading Waveform
fi
if [ -e $KERNEL ]; then
echo Upgrading kernel... $KERNEL
dd if=$KERNEL of=/dev/$DEVICE bs=512 seek=2048
if [ $? != 0 ]; then
exit 1
fi
sync
sync
echo Done upgrading kernel...
fi
this is the code that flashes it. As you can see the location to where it is flashed is the 4th argument. And this is the only place where the function is called:
/etc/init.d/upgrade-generic.sh $UBOOT $WAVEFORM $KERNEL mmcblk0
in upgrade-wifi.sh.
So everything seems safe... I just have to gather enough courage now