Change the behavior of LEDs during bootup

Hi :slight_smile:

Is there a way to change the default behavior of LEDs during bootup, before the leds init script is started? Or is this determined by the hardware in a hard-coded manner?

Cheers, Tobias

Early LED behavior is governed by the pre-init process.

root@OpenWrt:~# find /lib/preinit/

The specific LED chosen, at least for DTS-based targets, is set in the DTS

        aliases {
                led-boot = &led_wps_amber;
                led-failsafe = &led_wps;
                led-running = &led_linksys;
                led-upgrade = &led_world;

(No doubt "The Powers That Be" will object to my naming, but this at least shows the aliases needed.)

Hmmm … I don't have an "aliases" definition in any of my /lib/preinit/* scripts … /etc/ is sourced, which contains definitions of a "status led", but the long list doesn't contain my board name (gl-ar150), so I think some default value is used.

Can you tell me where the first status led action is triggered? These scripts are a bit confusing :wink:

Yeah, they are. I walked through them some time ago and, as I recall, they register functions to be executed at various points in the boot process. I haven't looked at it in a while, but last I did, I edited with some hopefully useful information.

That "aliases" definition is in the DTS (Device Tree Source) and is loaded with the kernel in a compiled form. it isn't a "script" but more of a hardware definition; "If asking for the led-boot, twiddle GPIO 23, active low" or the like.

This is not as easy as I thought :wink: I'll see what I find. Thanks for the info!