mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
47 lines
1.2 KiB
Text
47 lines
1.2 KiB
Text
|
flash_uboot() {
|
||
|
if [[ ! -e /dev/mtd0 ]]; then
|
||
|
echo '>> Error: /dev/mtd0 does not exist.'
|
||
|
return
|
||
|
fi
|
||
|
# set up config for fw_printenv/setenv
|
||
|
echo '/dev/mtd0 0xc0000 0x20000 0x20000' > /etc/fw_env.config
|
||
|
# save MAC address
|
||
|
mac=$(fw_printenv | grep ethaddr | cut -d= -f2)
|
||
|
if [[ $mac == '' ]]; then
|
||
|
mac=$(blparam | grep ethaddr | cut -d= -f2)
|
||
|
if [[ $mac == '' ]]; then
|
||
|
echo '>> Error: Could not find MAC address from current U-Boot.'
|
||
|
return
|
||
|
fi
|
||
|
fi
|
||
|
# flash U-Boot
|
||
|
flash_erase /dev/mtd0 0 4
|
||
|
flash_erase /dev/mtd0 0xc0000 1
|
||
|
nandwrite /dev/mtd0 /boot/uboot-pogoplugv4.kwb
|
||
|
nandwrite -s 0xc0000 /dev/mtd0 /boot/uboot-pogoplugv4.env
|
||
|
# set MAC address
|
||
|
fw_setenv ethaddr ${mac}
|
||
|
}
|
||
|
|
||
|
ask_uboot() {
|
||
|
echo "A new U-Boot version needs to be flashed to NAND."
|
||
|
echo "Do you want to do this now? [y|N]"
|
||
|
read -r shouldwe
|
||
|
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
||
|
flash_uboot
|
||
|
else
|
||
|
echo "You can do this later by re-installing uboot-pogoplugv4."
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
## arg 1: the new package version
|
||
|
post_install() {
|
||
|
ask_uboot
|
||
|
}
|
||
|
|
||
|
## arg 1: the new package version
|
||
|
## arg 2: the old package version
|
||
|
post_upgrade() {
|
||
|
ask_uboot
|
||
|
}
|