mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
65 lines
1.3 KiB
Text
65 lines
1.3 KiB
Text
sd_fuse() {
|
|
if [ ! -b /dev/mmcblk0 ]; then
|
|
echo "No MMC device to flash, exiting."
|
|
exit 0
|
|
fi
|
|
|
|
# Flash U-Boot
|
|
dd if=/boot/u-boot-clearfog.$1.mmc of=/dev/mmcblk0 bs=512 seek=1
|
|
|
|
# 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
|
|
choose_uboot
|
|
else
|
|
echo "You can do this later by running:"
|
|
echo "# cd /boot; ./sd_fusing.sh /dev/mmcblk0"
|
|
fi
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
post_install() {
|
|
flash_uboot
|
|
}
|
|
|
|
post_upgrade() {
|
|
flash_uboot
|
|
}
|