blob: 388ff685d075d74a3bc3689b82b0f9454297416a [file] [log] [blame]
Jan Kundrát4932c572018-01-15 19:05:14 +01001#!/bin/sh
2
3set -ex
4
5mkdir /tmp/sdcard.image
6mount /mnt/sdcard.img.squashfs /tmp/sdcard.image/
7blkdiscard /dev/mmcblk0
8ddrescue --force /tmp/sdcard.image/sdcard.img /dev/mmcblk0
Jan Kundráta8050022018-01-15 19:52:09 +01009fsck -y /dev/mmcblk0p1 || true
10fsck -y /dev/mmcblk0p2 || true
11fsck -y /dev/mmcblk0p3 || true
12fsck -y /dev/mmcblk0p4 || true
Jan Kundrát4932c572018-01-15 19:05:14 +010013echo 0 > /sys/block/mmcblk0boot0/force_ro
14ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0
15echo 1 > /sys/block/mmcblk0boot0/force_ro
16echo 0 > /sys/block/mmcblk0boot1/force_ro
17ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1
18echo 1 > /sys/block/mmcblk0boot1/force_ro
19sync
20echo b > /proc/sysrq-trigger