blob: 7e5feef7b2e29329bfc2e7e684f31b11e5b50e81 [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át54e2d8b2018-08-22 17:04:07 +02009
10echo 0 > /sys/block/mmcblk0boot0/force_ro
11echo 0 > /sys/block/mmcblk0boot1/force_ro
12
13ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0
14ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1
15
Jan Kundráta8050022018-01-15 19:52:09 +010016fsck -y /dev/mmcblk0p1 || true
17fsck -y /dev/mmcblk0p2 || true
18fsck -y /dev/mmcblk0p3 || true
19fsck -y /dev/mmcblk0p4 || true
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020020
Jan Kundrát4932c572018-01-15 19:05:14 +010021sync
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020022echo 1 > /sys/block/mmcblk0boot1/force_ro
23echo 1 > /sys/block/mmcblk0boot0/force_ro
24
Jan Kundrát4932c572018-01-15 19:05:14 +010025echo b > /proc/sysrq-trigger