diff --git a/board/aarch64/r2s/README.md b/board/aarch64/r2s/README.md index 9e495350..55dd6290 100644 --- a/board/aarch64/r2s/README.md +++ b/board/aarch64/r2s/README.md @@ -8,6 +8,46 @@ The R2S does not have any onboard eMMC, so the only way to boot Infix on it is using and SD card. +LEDs +---- + +The front system LEDs work as follows in Infix: + +| **Stage** | **SYS** | **LAN** | **WAN** | +|----------------|---------|---------|---------| +| Power-on | dimmed | off | off | +| Linux loading | on | off | off | +| System loading | 1 Hz | off | off | +| System up | off | on | off | +| WAN address | off | on | on | +| Locate | 1 Hz | 1 Hz | 1 Hz | +| Fail safe | 5 Hz | off | off | +| Panic | 5 Hz | 5 Hz | 5 Hz | + +Powering on the device the SYS LED is turned on faintly (dimmed). It +remains dimmed while U-Boot loads the kernel, and turns bright red when +the kernel starts. It remains steady on until the system has started +the LED daemon, `iitod`, which sets it blinking at 1 Hz while the rest +of the system starts up. When the system has come up successfully, the +SYS LED is turned off and the green LAN LED turns on. The WAN LED will +turn on (green) when the WAN interface is up and has an IP address. + +> Compared to the `x86_64` Qemu target, it takes a while to parse all +> YANG models and load `startup-config`, but the whole process should +> not take more than 60 seconds, and usually a lot less. + +If a "find my device" function exists, it will blink all LEDs at 1 Hz. + +If `startup-config` fails to load Ínfix reverts to `failure-config`, +putting the device in fail safe (or fail secure) mode. Indicated by +the SYS LED blinking at 5 Hz instead of turning off. + +If Infix for some reason also fails to load `failure-config`, then all +LEDs will blink at 5 Hz to clearly indicate something is very wrong. + +In all error cases the console shows the problem. + + How to Build ------------ diff --git a/board/aarch64/r2s/rootfs/etc/iitod.json b/board/aarch64/r2s/rootfs/etc/iitod.json new file mode 100644 index 00000000..ef95038a --- /dev/null +++ b/board/aarch64/r2s/rootfs/etc/iitod.json @@ -0,0 +1,91 @@ +{ + "input": { + "path": { + "locate": { "path": "/run/led/locate" }, + + "status-prime": { "path": "/run/led/status-prime" }, + "status-ok": { "path": "/run/led/status-ok" }, + "status-err": { "path": "/run/led/status-err" }, + "status-crit": { "path": "/run/led/status-crit" }, + + "fault-prime": { "path": "/run/led/fault-prime" }, + "fault-ok": { "path": "/run/led/fault-ok" }, + "fault-err": { "path": "/run/led/fault-err" }, + "fault-crit": { "path": "/run/led/fault-crit" }, + + "wan-up": { "path": "/run/led/wan-up" }, + + "startup": { "path": "/run/finit/cond/run/startup/success" }, + "fail-safe": { "path": "/run/finit/cond/run/failure/success" }, + "panic": { "path": "/run/finit/cond/run/failure/failure" } + }, + "udev": { + "power-a": { "subsystem": "power_supply" }, + "power-b": { "subsystem": "power_supply" } + } + }, + + "output": { + "led-group": { + "port-link-act": { + "match": ["*:green:tp", "*:green:sfp", "*:green:port" ], + + "rules": [ + { "if": "true", "then": { "trigger": "netdev", "link": 1, "rx": 1, "tx": 1 } } + ] + }, + "port-alarm": { + "match": ["*:yellow:tp", "*:yellow:sfp", "*:yellow:port" ], + + "rules": [ + ] + } + }, + "led": { + "nanopi-r2s:red:sys": { + "rules": [ + { "if": "locate", "then": "@blink-1hz" }, + { "if": "panic", "then": "@blink-5hz" }, + { "if": "fail-safe", "then": "@blink-5hz" }, + { "if": "startup", "then": "@off" }, + { "if": "true", "then": "@blink-1hz" } + ] + }, + + "nanopi-r2s:green:lan": { + "rules": [ + { "if": "locate", "then": "@blink-1hz" }, + { "if": "panic", "then": "@blink-5hz" }, + { "if": "startup", "then": "@on" } + ] + }, + + "nanopi-r2s:green:wan": { + "rules": [ + { "if": "locate", "then": "@blink-1hz" }, + { "if": "panic", "then": "@blink-5hz" }, + { "if": "wan-up", "then": "@on" } + ] + } + } + }, + + "aliases": { + "on": { + "brightness": true + }, + "off": { + "brightness": false + }, + "blink-1hz": { + "trigger": "timer", + "delay_on": 500, + "delay_off": 500 + }, + "blink-5hz": { + "trigger": "timer", + "delay_on": 100, + "delay_off": 100 + } + } +}