forked from u-boot/u-boot
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ayufan: dev.mk: add
rock64_bootloader.sh
script
- Loading branch information
Showing
7 changed files
with
139 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ write_sd() { | |
} | ||
|
||
write_sd "$MNT_DEV" "$SD_LOADER" | ||
|
||
sync | ||
|
||
echo Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
source /usr/local/lib/u-boot-rockchip/loader-common | ||
|
||
cnt=1 | ||
methods=() | ||
|
||
version2 "Latest version" "$SD_LOADER" | ||
echo "0) Do not do any changes." | ||
echo | ||
methods[0]="# no-op" | ||
|
||
while read MNT_DEV; do | ||
version2 "$MNT_DEV" "$MNT_DEV" | ||
|
||
echo "$cnt) Install u-boot on $MNT_DEV" | ||
methods[$cnt]="dd if=\"$SD_LOADER\" of=\"$MNT_DEV\" iflag=fullblock oflag=direct" | ||
cnt=$((cnt+1)) | ||
echo "$cnt) Remove bootloader on $MNT_DEV" | ||
methods[$cnt]="dd if=/dev/zero of=\"$MNT_DEV\" iflag=fullblock oflag=direct" | ||
cnt=$((cnt+1)) | ||
echo | ||
done < <(blkid /dev/disk/by-id/{ata,usb,mmc}-* -o device -t PARTLABEL="loader1") | ||
|
||
if find_mtd; then | ||
version2 "SPI Flash" "$MTD_DEV" | ||
|
||
echo "$cnt) Install u-boot on $MTD_DEV" | ||
methods[$cnt]="flash_erase \"$MTD_DEV\" \"$MTD_OFFSET\" 0 && nandwrite -s \"$MTD_OFFSET\" \"$MTD_DEV\" \"$SPI_LOADER\"" | ||
cnt=$((cnt+1)) | ||
echo "$cnt) Remove bootloader on $MTD_DEV" | ||
methods[$cnt]="flash_erase \"$MTD_DEV\" \"$MTD_OFFSET\" 0" | ||
cnt=$((cnt+1)) | ||
echo | ||
fi | ||
|
||
while true; do | ||
echo "Select one of the options or Ctrl-C to abort:" | ||
read OPTION | ||
echo | ||
|
||
if [[ "$OPTION" == "0" ]]; then | ||
exit | ||
elif [[ -z "${methods[$OPTION]}" ]]; then | ||
echo "The '$OPTION' is invalid option" | ||
continue | ||
fi | ||
|
||
echo "Executing '${methods[$OPTION]}'..." | ||
confirm | ||
eval "${methods[$OPTION]}" | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters