Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -ex |
| 4 | |
Jan Kundrát | 5fae0e6 | 2018-08-22 17:05:08 +0200 | [diff] [blame] | 5 | # reset the LEDs |
| 6 | i2cset -y 1 0x6b 0xa5 0x5a || true |
| 7 | # configure for fast blinking |
| 8 | i2cset -y 1 0x60 0x00 0x01 || true |
| 9 | i2cset -y 1 0x60 0x01 0x20 || true |
| 10 | i2cset -y 1 0x60 0x12 0x40 || true |
| 11 | i2cset -y 1 0x60 0x13 0x04 || true |
| 12 | i2cset -y 1 0x60 0x0a 0xff || true |
| 13 | i2cset -y 1 0x60 0x0b 0xff || true |
| 14 | i2cset -y 1 0x60 0x0c 0xff || true |
| 15 | # yellow blinking |
| 16 | i2cset -y 1 0x60 0x16 0x0f || true |
| 17 | |
Jan Kundrát | 5703564 | 2018-08-22 17:44:13 +0200 | [diff] [blame] | 18 | watchdog /dev/watchdog |
| 19 | |
Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 20 | mkdir /tmp/sdcard.image |
| 21 | mount /mnt/sdcard.img.squashfs /tmp/sdcard.image/ |
| 22 | blkdiscard /dev/mmcblk0 |
| 23 | ddrescue --force /tmp/sdcard.image/sdcard.img /dev/mmcblk0 |
Jan Kundrát | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame] | 24 | |
| 25 | echo 0 > /sys/block/mmcblk0boot0/force_ro |
| 26 | echo 0 > /sys/block/mmcblk0boot1/force_ro |
| 27 | |
| 28 | ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0 |
| 29 | ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1 |
| 30 | |
Jan Kundrát | 5fae0e6 | 2018-08-22 17:05:08 +0200 | [diff] [blame] | 31 | # solid yellow |
| 32 | i2cset -y 1 0x60 0x16 0x05 || true |
| 33 | |
Jan Kundrát | a805002 | 2018-01-15 19:52:09 +0100 | [diff] [blame] | 34 | fsck -y /dev/mmcblk0p1 || true |
| 35 | fsck -y /dev/mmcblk0p2 || true |
| 36 | fsck -y /dev/mmcblk0p3 || true |
| 37 | fsck -y /dev/mmcblk0p4 || true |
Jan Kundrát | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame] | 38 | |
Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 39 | sync |
Jan Kundrát | 54e2d8b | 2018-08-22 17:04:07 +0200 | [diff] [blame] | 40 | echo 1 > /sys/block/mmcblk0boot1/force_ro |
| 41 | echo 1 > /sys/block/mmcblk0boot0/force_ro |
| 42 | |
Jan Kundrát | 5fae0e6 | 2018-08-22 17:05:08 +0200 | [diff] [blame] | 43 | # solid white |
| 44 | i2cset -y 1 0x60 0x16 0x15 || true |
| 45 | |
Jan Kundrát | 4932c57 | 2018-01-15 19:05:14 +0100 | [diff] [blame] | 46 | echo b > /proc/sysrq-trigger |