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