mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-25 07:38:38 +00:00
Added SPI flashing to nand-sata-install's SPI -> SATA, USB, NVMe option
This commit is contained in:
parent
5d68d4a68e
commit
25b6709991
1 changed files with 25 additions and 5 deletions
|
@ -10,6 +10,7 @@
|
|||
# Import:
|
||||
# DIR: path to u-boot directory
|
||||
# write_uboot_platform: function to write u-boot to a block device
|
||||
# write_uboot_platform_mtd: function to write u-boot to a mtd (eg. SPI flash) device
|
||||
|
||||
[[ -f /usr/lib/u-boot/platform_install.sh ]] && source /usr/lib/u-boot/platform_install.sh
|
||||
|
||||
|
@ -587,6 +588,20 @@ stop_running_services()
|
|||
done
|
||||
}
|
||||
|
||||
# show warning and write u-boot to SPI flash $1 = spi device name, $2 = u-boot files directory
|
||||
write_uboot_to_spi_flash()
|
||||
{
|
||||
local MTD_BLK="/dev/$1"
|
||||
local DIR="$2"
|
||||
local MESSAGE="This script will update the bootloader on SPI Flash $MTD_BLK. Continue?\nIt will take up to a few minutes."
|
||||
dialog --title "$title" --backtitle "$backtitle" --cr-wrap --colors --yesno " \Z1$(toilet -W -f ascii9 WARNING)\Zn\n$MESSAGE" 16 53
|
||||
if [[ $? -eq 0 ]]; then
|
||||
write_uboot_platform_mtd "$DIR" $MTD_BLK
|
||||
update_bootscript
|
||||
echo 'Done'
|
||||
fi
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
@ -691,6 +706,15 @@ main()
|
|||
show_warning "This script will erase your device $DISK_ROOT_PART. Continue?"
|
||||
format_disk "$DISK_ROOT_PART"
|
||||
create_armbian 'spi' "$DISK_ROOT_PART"
|
||||
|
||||
if [[ $(type -t write_uboot_platform_mtd) == function ]]; then
|
||||
dialog --title "$title" --backtitle "$backtitle" --yesno \
|
||||
"Do you want to write the bootloader to SPI flash?\n\nIt is required if you have not done it before or if you have some non-Armbian bootloader in SPI." 8 60
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
write_uboot_to_spi_flash $spicheck "$DIR"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
5)
|
||||
show_warning 'This script will update the bootloader on SD/eMMC. Continue?'
|
||||
|
@ -711,11 +735,7 @@ main()
|
|||
return
|
||||
;;
|
||||
7)
|
||||
MTD_BLK="/dev/${spicheck}"
|
||||
show_warning "This script will update the bootloader on SPI Flash $MTD_BLK. Continue?"
|
||||
write_uboot_platform_mtd "$DIR" $MTD_BLK
|
||||
update_bootscript
|
||||
echo 'Done'
|
||||
write_uboot_to_spi_flash $spicheck "$DIR"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue