Jan Kundrát | 09ec9fa | 2021-01-30 16:19:54 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | if [[ "$1" != "--yes-this-is-dangerous" ]]; then |
| 6 | echo "Refusing to continue, re-run with the --yes-this-is-dangerous option to proceed" |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | echo 0 > /sys/block/mmcblk0boot0/force_ro |
| 11 | echo 0 > /sys/block/mmcblk0boot1/force_ro |
| 12 | ddrescue --force /usr/libexec/u-boot-spl.kwb /dev/mmcblk0boot0 |
| 13 | ddrescue --force /usr/libexec/u-boot-spl.kwb /dev/mmcblk0boot1 |
| 14 | dd if=/usr/libexec/u-boot-spl.kwb of=/dev/mmcblk0 bs=512 seek=1 |
| 15 | sync |
| 16 | echo 1 > /sys/block/mmcblk0boot1/force_ro |
| 17 | echo 1 > /sys/block/mmcblk0boot0/force_ro |