PKGBUILDs/alarm/uboot-odroid-xu3/uboot-odroid-xu3.install

65 lines
1.8 KiB
Text
Raw Normal View History

2014-08-29 21:54:53 +00:00
sd_fuse() {
2016-08-20 20:32:53 +00:00
device=$1
if [ ! -b /dev/${device} ]; then
2014-08-29 21:54:53 +00:00
echo "No MMC device to flash, exiting."
exit 0
fi
2016-08-20 20:32:53 +00:00
if [ -d /sys/block/${device}boot0 ]; then
echo "/dev/${device} is an eMMC card, disabling read-only.."
if ! echo 0 > /sys/block/${device}boot0/force_ro; then
echo "Disabling read-only for /dev/${device}boot0 failed."
2014-08-29 21:54:53 +00:00
exit 1
fi
signed_bl1_position=0
bl2_position=30
uboot_position=62
2016-08-20 20:32:53 +00:00
tzsw_position=2110
device=/dev/${device}boot0
2014-08-29 21:54:53 +00:00
else
signed_bl1_position=1
bl2_position=31
uboot_position=63
2016-08-20 20:32:53 +00:00
tzsw_position=2111
device=/dev/${device}
2014-08-29 21:54:53 +00:00
fi
echo "BL1 fusing"
dd iflag=dsync oflag=dsync if=/boot/bl1.bin of=$device seek=$signed_bl1_position
echo "BL2 fusing"
dd iflag=dsync oflag=dsync if=/boot/bl2.bin of=$device seek=$bl2_position
echo "u-boot fusing"
dd iflag=dsync oflag=dsync if=/boot/u-boot.bin of=$device seek=$uboot_position
echo "TrustZone S/W fusing"
dd iflag=dsync oflag=dsync if=/boot/tzsw.bin of=$device seek=$tzsw_position
}
flash_uboot() {
2016-08-20 20:32:53 +00:00
major=$(mountpoint -d / | cut -f 1 -d ':')
minor=$(expr $(mountpoint -d / | cut -f 2 -d ':') - 1)
device=$(cat /proc/partitions | awk {'if ($1 == "'${major}'" && $2 == "'${minor}'") print $4 '})
echo "A new U-Boot version needs to be flashed onto /dev/${device}."
2014-08-29 21:54:53 +00:00
echo "Do you want to do this now? [y|N]"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
2016-08-20 20:32:53 +00:00
sd_fuse $device
2014-08-29 21:54:53 +00:00
else
echo "You can do this later by running:"
2016-08-20 20:32:53 +00:00
echo "# cd /boot; ./sd_fusing.sh /dev/${device}"
2014-08-29 21:54:53 +00:00
fi
}
post_install() {
flash_uboot
}
post_upgrade() {
2016-08-20 20:32:53 +00:00
if (( $(vercmp $2 2016.07-1) < 0 )); then
echo ' >>> Note: boot.ini is no longer used. Make any customizations within /boot/boot.txt'
echo ' and run ./mkscr within /boot to convert it to the boot.scr file.'
fi
2014-08-29 21:54:53 +00:00
flash_uboot
}