Skip to content

Commit ba1f943

Browse files
committed
dev.mk: allow to erase bootloader.sh
Change-Id: I103be0655bff0c7950bb2a20aa9c9e6443518b7f
1 parent 43ca192 commit ba1f943

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
5+
source /usr/local/lib/u-boot-rockchip/loader-common
6+
7+
echo "Doing this will erase bootloader stored on your boot device"
8+
echo " and it might break your system."
9+
echo "Use this only if you prefer to boot from SPI ('rock64_write_spi_flash.sh')."
10+
echo "To bring back bootloader run 'rock64_upgrade_bootloader.sh'."
11+
echo ""
12+
13+
confirm
14+
15+
MNT_DEV=$(findmnt /boot/efi -n -o SOURCE)
16+
17+
write_sd() {
18+
case "$1" in
19+
/dev/mmcblk*p6|/dev/sd*p6|/dev/mapper/loop*p6|/dev/mapper/nvme*p6)
20+
dd if="$2" of="${1/p6/p1}"
21+
;;
22+
23+
*)
24+
echo "Cannot detect boot device ($MNT_DEV)."
25+
exit 1
26+
;;
27+
esac
28+
}
29+
30+
write_sd "$MNT_DEV" "/dev/zero"
31+
32+
sync
33+
34+
echo Done.

0 commit comments

Comments
 (0)