PKGBUILDs/alarm/uboot-clearfog/uboot-clearfog.install

66 lines
1.3 KiB
Text
Raw Normal View History

2015-12-08 10:45:37 +00:00
sd_fuse() {
if [ ! -b /dev/mmcblk0 ]; then
echo "No MMC device to flash, exiting."
exit 0
fi
# Flash U-Boot
2016-06-06 00:42:15 +00:00
dd if=/boot/u-boot-clearfog.$1.mmc of=/dev/mmcblk0 bs=512 seek=1
2015-12-08 10:45:37 +00:00
# Zero out old U-Boot environment
dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=1920 count=128
#Flash new U-Boot environemnt
dd if=/boot/clearfog.env of=/dev/mmcblk0 bs=512 seek=1920
}
flash_uboot() {
echo "A new U-Boot version needs to be flashed onto /dev/mmcblk0."
echo "Do you want to do this now? [y|N]"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
2016-06-06 00:42:15 +00:00
choose_uboot
2015-12-08 10:45:37 +00:00
else
echo "You can do this later by running:"
echo "# cd /boot; ./sd_fusing.sh /dev/mmcblk0"
fi
}
2016-06-06 00:42:15 +00:00
choose_uboot() {
while :
do
cat<<EOF
Please choose uboot to flash:
<1st slot, 2nd slot>
1) PCIe, PCIe (default)
2) PCIe, mSata
3) mSata, PCIe
4) mSata, mSata
EOF
read -n1 -s
case "$REPLY" in
"1") sd_fuse pp
break
;;
"2") sd_fuse ps
break
;;
"3") sd_fuse sp
break
;;
"4") sd_fuse ss
break
;;
* ) echo "invalid option" ;;
esac
done
}
2015-12-08 10:45:37 +00:00
post_install() {
flash_uboot
}
post_upgrade() {
flash_uboot
}