blob: dac3a3074d907f4d94ab2d4dd0481c7aee19164d [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át57035642018-08-22 17:44:13 +020018watchdog /dev/watchdog
19
Jan Kundrát4932c572018-01-15 19:05:14 +010020mkdir /tmp/sdcard.image
21mount /mnt/sdcard.img.squashfs /tmp/sdcard.image/
22blkdiscard /dev/mmcblk0
23ddrescue --force /tmp/sdcard.image/sdcard.img /dev/mmcblk0
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020024
25echo 0 > /sys/block/mmcblk0boot0/force_ro
26echo 0 > /sys/block/mmcblk0boot1/force_ro
27
28ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot0
29ddrescue --force /mnt/u-boot-spl.kwb /dev/mmcblk0boot1
30
Jan Kundrát5fae0e62018-08-22 17:05:08 +020031# solid yellow
32i2cset -y 1 0x60 0x16 0x05 || true
33
Jan Kundráta8050022018-01-15 19:52:09 +010034fsck -y /dev/mmcblk0p1 || true
35fsck -y /dev/mmcblk0p2 || true
36fsck -y /dev/mmcblk0p3 || true
37fsck -y /dev/mmcblk0p4 || true
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020038
Jan Kundrát4932c572018-01-15 19:05:14 +010039sync
Jan Kundrát54e2d8b2018-08-22 17:04:07 +020040echo 1 > /sys/block/mmcblk0boot1/force_ro
41echo 1 > /sys/block/mmcblk0boot0/force_ro
42
Jan Kundrát5fae0e62018-08-22 17:05:08 +020043# solid white
44i2cset -y 1 0x60 0x16 0x15 || true
45
Jan Kundrát4932c572018-01-15 19:05:14 +010046echo b > /proc/sysrq-trigger