Welcome! Log In Create A New Profile

Advanced

Debian on WD My Cloud EX4

Re: Debian on WD My Cloud EX4
April 11, 2025 08:09PM
Hello again,

I had a bit of a boost in energy this evening and thought I would do some digging into the firmware, I found two binaries of interest, /usr/sbin/fan_control and /usr/sbin/led, "fan_control" controls the fan as you would expect you can turn it on and off and set speed and get the fan RPM, "led" allows me to set the power led status (on, off, blinking, red or blue) as well as each of the four hard drive LED's (again, red, blue, blinking, etc), I'll attach each binary as well as the help text for each, I looked at them in Ghidra (I am by no means good as reverse engineering haha) and from what I can see for the led control anyway it seems to directly set a CPU register of some sort, I don't know if that seems probable or not but that's my best guess, as for the LED screen on the front, that seems like a much bigger feat and I don't know if that would be possible to get working under debian but I'll keep looking to see how it's controlled in the stock firmware,

Thanks!
Attachments:
open | download - fan_control (22.4 KB)
open | download - led (25.7 KB)
open | download - ledfanhelp.txt (887 bytes)
Re: Debian on WD My Cloud EX4
April 11, 2025 10:25PM
> I found two binaries of interest,
> /usr/sbin/fan_control and /usr/sbin/led,
> "fan_control" controls the fan as you would expect
> you can turn it on and off and set speed and get
> the fan RPM, "led" allows me to set the power led
> status (on, off, blinking, red or blue) as well as
> each of the four hard drive LED's (again, red,
> blue, blinking, etc), I'll attach each binary as
> well as the help text for each,

If these were scripts, it would be much more helpful. Binaries, not so much. So I would recommend searching the GPL source instead.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD My Cloud EX4
April 12, 2025 07:16PM
Sadly the fan control and led tools are supplied in their binary form even in the GPL, there are no other references to led's or fan control anywhere else in the GPL so that may be a no go unfortunately.
Re: Debian on WD My Cloud EX4
April 13, 2025 02:05PM
> Sadly the fan control and led tools are supplied
> in their binary form even in the GPL, there are no
> other references to led's or fan control anywhere
> else in the GPL so that may be a no go
> unfortunately.

Sometime this happens with a company that intentionally implemented a malicious compliance to GPL. Instead of disclosing how they control a piece of hardware like everybody else, they close source that piece of code because they can and not violating GPL.

Normally LEDS and fan are controlled by GPIOs. In some cases, by serial TTY (like in some Synology NAS). Most comapanies provide patches (GPIOs) or scripts (TTYs) in their GPL sources.

We can just copy these binaries to the rootfs and run it. If those were static binary then there would be no problem. If these were dynamic binary then some old shared library on stock OS also need to be repackaged so we can run them in modern Debian system.

Find out what are they:
file <fancontrol binary>
file <LED control binary>

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD My Cloud EX4
April 18, 2025 10:33AM
They are dynamically linked

fan_control: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.16, stripped
led:         ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.16, stripped
Re: Debian on WD My Cloud EX4
April 18, 2025 03:33PM
@ConcentratedCancer,

Go ahead copy the fan_control and led binaries to your rootfs /tmp.

And try running it
cd /tmp
./fan_control
./led

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: