blob: 6cde550c1fadc74f522472b61e2bd7922f967ce5 [file] [log] [blame]
Jan Kundrát4932c572018-01-15 19:05:14 +01001#!/bin/sh
2
3set -ex
4
Jan Kundrát5fae0e62018-08-22 17:05:08 +02005# reset the LEDs
6i2cset -y 1 0x6b 0xa5 0x5a || true
7# configure for fast blinking
8i2cset -y 1 0x60 0x00 0x01 || true
9i2cset -y 1 0x60 0x01 0x20 || true
10i2cset -y 1 0x60 0x12 0x40 || true
11i2cset -y 1 0x60 0x13 0x04 || true
12i2cset -y 1 0x60 0x0a 0xff || true
13i2cset -y 1 0x60 0x0b 0xff || true
14i2cset -y 1 0x60 0x0c 0xff || true
15# yellow blinking
16i2cset -y 1 0x60 0x16 0x0f || true
17
Jan Kundrát4932c572018-01-15 19:05:14 +010018mkdir /tmp/sdcard.image
19mount /mnt/sdcard.img.squashfs /tmp/sdcard.image/
20blkdiscard /dev/mmcblk0
21ddrescue --force /tmp/sdcard.image/sdcard.img /dev/mmcblk0
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020022
23echo 0 > /sys/block/mmcblk0boot0/force_ro
24echo 0 > /sys/block/mmcblk0boot1/force_ro
25
26ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0
27ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1
28
Jan Kundrát5fae0e62018-08-22 17:05:08 +020029# solid yellow
30i2cset -y 1 0x60 0x16 0x05 || true
31
Jan Kundráta8050022018-01-15 19:52:09 +010032fsck -y /dev/mmcblk0p1 || true
33fsck -y /dev/mmcblk0p2 || true
34fsck -y /dev/mmcblk0p3 || true
35fsck -y /dev/mmcblk0p4 || true
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020036
Jan Kundrát4932c572018-01-15 19:05:14 +010037sync
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020038echo 1 > /sys/block/mmcblk0boot1/force_ro
39echo 1 > /sys/block/mmcblk0boot0/force_ro
40
Jan Kundrát5fae0e62018-08-22 17:05:08 +020041# solid white
42i2cset -y 1 0x60 0x16 0x15 || true
43
Jan Kundrát4932c572018-01-15 19:05:14 +010044echo b > /proc/sysrq-trigger