blob: f91904d55bcb985d8aa338a1f63b5f26427f3e2b [file] [log] [blame]
Jan Kundrát09ec9fa2021-01-30 16:19:54 +01001#!/bin/bash
2
3set -ex
4
5if [[ "$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
8fi
9
10echo 0 > /sys/block/mmcblk0boot0/force_ro
11echo 0 > /sys/block/mmcblk0boot1/force_ro
12ddrescue --force /usr/libexec/u-boot-spl.kwb /dev/mmcblk0boot0
13ddrescue --force /usr/libexec/u-boot-spl.kwb /dev/mmcblk0boot1
14dd if=/usr/libexec/u-boot-spl.kwb of=/dev/mmcblk0 bs=512 seek=1
15sync
16echo 1 > /sys/block/mmcblk0boot1/force_ro
17echo 1 > /sys/block/mmcblk0boot0/force_ro