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 | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame^] | 9 | |
| 10 | echo 0 > /sys/block/mmcblk0boot0/force_ro |
| 11 | echo 0 > /sys/block/mmcblk0boot1/force_ro |
| 12 | |
| 13 | ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0 |
| 14 | ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1 |
| 15 | |
Jan Kundrát | a805002 | 2018-01-15 19:52:09 +0100 | [diff] [blame] | 16 | fsck -y /dev/mmcblk0p1 || true |
| 17 | fsck -y /dev/mmcblk0p2 || true |
| 18 | fsck -y /dev/mmcblk0p3 || true |
| 19 | fsck -y /dev/mmcblk0p4 || true |
Jan Kundrát | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame^] | 20 | |
Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 21 | sync |
Jan Kundrát | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame^] | 22 | echo 1 > /sys/block/mmcblk0boot1/force_ro |
| 23 | echo 1 > /sys/block/mmcblk0boot0/force_ro |
| 24 | |
Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 25 | echo b > /proc/sysrq-trigger |