Welcome! Log In Create A New Profile

Advanced

Debian on WD MyCloud EX 4100

Posted by saschadd 
Re: Debian on WD MyCloud EX 4100
July 26, 2017 03:57AM
saschadd,

> [info] Will now halt.
> [ 132.454942] reboot: System halted[/code]
>
> this should be the moment where i can turn off.

Yes. This is when the system shutdown was competely done.

>
> If i understand it right there is much more work t
> o do then expected because there are some implemen
> tations missing.
> Any chance that we get debian fully working on tha
> t box or will it be to much to do?

It's done! the mdt errors you have seems to be specific to your box. And it is benign, meaning you are not going to access the other mtds, except mtd0, then it is ok. mtd0 is all you need for booting Debian.


> Any news about the dts file?

The DTS file right now is OK to use. It is not completed, because we would need the GPIOs defined to control the LEDs. But other than that, You can start using the system. And as you are running it, you probably will find some minor stuff that we need to add.

I've found the GPIOs in the GPL. But the way WD engineers patched it, there is no way for me to tell which one is which :)) what a waste of braincells :) The only way for me to figure out this is to sit in front of the box and will take a lot of hours. But GPIOs really don't effect the normal operation, since the patched stock u-boot already initialized the hardware correctly.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
July 31, 2017 03:55AM
bodhi Wrote:
> The DTS file right now is OK to use. It is not completed, because we would need the GPIOs defined to
> control the LEDs. But other than that, You can start using the system. And as you are running it, you probably will find some minor stuff that we need to add.

Thanks for the info. Well one major issue is the fan speed. For productive use i way to control the fan is needed as it is running at full speed all the time wich is annoying.
Minor issues are the LEDs and the shutdown because the box should run all the time when ready. One thing i am not sure if standby is working. Standby for harddrives and hardware for power saving over night would be nice to have as there will be times when the services the box provides are not needed.

> I've found the GPIOs in the GPL. But the way WD engineers patched it, there is no way for me to tell
> which one is which :)) what a waste of braincells :)
> The only way for me to figure out this is to sit in front of the box and will take a lot of hours. But GPIOs really don't
> effect the normal operation, since the patched stock u-boot already initialized the hardware correctly.

So i need to buy you an EX4100 for finding the GPIOs? ; )
Isnt there a script which tries all GPIOs and gives back feedback of found stuff?
There is a script for everything in Linux i think. ; )

-
happy hacking,

saschadd
Re: Debian on WD MyCloud EX 4100
July 31, 2017 04:30AM
saschadd,

Reading your post, I've just realized that I've forgot to add the WD EX4100 DTS to the new kernel I've just released, duh :) and the Mirror Gen2 DTS also, damn! I guess I will need to keep a reminder for the next kernel release.

If you upgrade the kernel to 4.12.4, you will need to copy or keep your current DTB file.

> Thanks for the info. Well one major issue is the f
> an speed. For productive use i way to control the
> fan is needed as it is running at full speed all t
> he time wich is annoying.

I guess that one of the not-so-minor things we should look into.

> Minor issues are the LEDs and the shutdown because
> the box should run all the time when ready.

Yeah, it is anoying when the LED does not light up correctly.

> One thing i am not sure if standby is working.
> Standby f
> or harddrives and hardware for power saving over n
> ight would be nice to have as there will be times
> when the services the box provides are not needed.

This is what you can do, nothing related to the kernel or DTS. You just use hdparm command to put your hard drive to sleep:
http://forum.doozan.com/read.php?2,24943,24944#msg-24944

Other hardware gadgets don't need to sleep.

> So i need to buy you an EX4100 for finding the GPI
> Os? ; )

Haha :) no, not needed.

> Isnt there a script which tries all GPIOs and give
> s back feedback of found stuff?
> There is a script for everything in Linux i think.
> ; )

Yes. It is doable. But the problem is those GPIOs need to be defined in the DTS, before you can brute force it. What I meant was I need to play with u-boot to be able to poke each and every one of those GPIOs to see which one is which. WD engineers, either on purpose or just being incompetent, did not document them, or even name them.

Even though the sam SoC is used in other boxes, such as the NAS326, GPIOs are board dependent and they are likely allocated differently.

I cannot write instruction for you to try, it's a little bit dangerous and unpredictable if you happened to poke the wrong memory location. So I'd usually test and risk bricking my box before I post the correct instruction :))

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
July 31, 2017 08:11PM
saschadd,

http://forum.doozan.com/read.php?2,32146,35870#msg-35870

I've posted in the wrong thread, but please answer here.

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



Edited 1 time(s). Last edit at 07/31/2017 08:12PM by bodhi.
Re: Debian on WD MyCloud EX 4100
August 06, 2017 03:30AM
bodhi,

sorry for the delay, to much work to do. ;)

> What is the EX4100 fan behavior in u-boot? does it spin at nomal speed?

in u-boot it spins at full speed, at some point in booting the stock os it switches to slower speed.

> And how about inside stock OS? does it spin slower, and is there a fan control tool that you can run in the Web interface or at command line?

there is no fan control in the web interface.
at command line i cant find anything related to fan control or at least i dont really know what to search for.

EDIT: the command which causes the fan to slow down seems to be

chk_io v1.04.20141112

after that command in boot log the fan becomes quiet.

-
happy hacking,

saschadd



Edited 1 time(s). Last edit at 08/06/2017 06:04AM by saschadd.
Re: Debian on WD MyCloud EX 4100
August 06, 2017 06:14AM
saschadd,

There is a binary to run Fan Control in the GPL firmware section, similar to the Poweroff. We could potentially just take those binaries run them.

However, I think the best thing to do to make this kernel better is to use MM/Peacemaker works in the mcm-daemon.

I'll look into compiling this daemon and after that you can test it on your box.

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



Edited 2 time(s). Last edit at 08/06/2017 06:18AM by bodhi.
Re: Debian on WD MyCloud EX 4100
August 06, 2017 06:18AM
If you want to try in stock OS, here is how they run fan_control

WDMyCloud_EX4100_GPL_v2.30.165_20170321/firmware/module/crfs/script/system_init

if [ -e /usr/sbin/fan_control ]; then
#======================
#       Fan Control
#======================
  fan_control b c
  if [ -e /tmp/hw_mode ]; then
    hw_mode_test_temper=`cat /tmp/hw_mode | grep temperature`
    if [ -n "$hw_mode_test_temper" ]; then
      fan_control -w c&
    else
      fan_control 0 c&
    fi
  else
    fan_control 0 c&
  fi
fi

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100 - booting from USB not "stable"
September 17, 2017 07:06AM
first I have to say thank you to all who makes it possible to use Debian on this box.
I'm trying to use debian on this box and also on the EX2100 but I see some differences:
The EX2100 is booting fine from NAND but the EX4100 doesn't (for the first time end now).
It resulted in the recovery console and SSH on Port 2222.

It doesn't matter if I use the stock U-Boot or the uboot.2014T30p6-tld-6.
I've done it while the radisks recovery state and copying a suitable "flash_erase" and "flash_eraseall" to it. As there were no bad sactors and I could successfully dump mtd0 I decided to flash it.
This was successfull because I've seen U-Boot coming up while powering the box up again.
So it was possobie to boot debian from NAND. Because of the missing TX (after some time and I didn't manage it that it comes back) I coudln't edit the U-Boot environment on this way so it was done on Debian.

This was successful too so U-boot tries to boot from USB and when this is unsuccessful, it boots from NAND.
This seems to work because booting from any USB 3.0 sticks doesn't work so it boots from NAND but now unsuccessful so only the recuvery is available via SSH on port 2222.

So I decided the following to get it work:
- USB 2.0 Stick as boot (fat32 partition with "uImitrd" and "uRamdisk"
- USB 3.0 Stick as rootfs labeled (ext4)

this was working with kernel 4.9.50 so I decided use a newer kernel because I see some network issues.
I'm using the patch available on kernel 4.12.4 with some wol related stuff and this was also successful.

So let's reassemble the box ... and here comes the strange stuff...
the same that was working with serial console and unassembled .. doesn't work in assembled state...

I'm using different USB 2.0 Sticks for booting (Sandisk Cruizer Fit, JetFlash 510, Verbatim Store'n'Go) ..
Sometimes it boots the kernel and ramdisk from it.. sometimes not ..
in _all_ situations ... it ends up in the ramdisks recovery mode (SSH 2222)

The second strange thing .. first .. with stock U-Boot ... I could comprehend .. that it couldn't boot .. because no USB mass storage devices coming up ... and the kernel command line points to /dev/ram0 ...

Now .. it's different .. as I'm using the modified U-Boot ... all connected mass storage devices were up and running .. and the kernel comand line points to the "rootfs" labeled stick

What I'm also seeing compared to my experiences with kirkwood devices ..
based on the different rootfs .. systemd is now up and running and it behaves sometimes strange ..
Without it .. it's possible to have non existent fstab entries when the dump/pass entries were zero
When using systemd I have to uncomment theese lines .. otherehise this ends up in recovery

Now this isn't the case because I have it commented out or ther were none of these non existent devices.
I'm also several different "rootfs" sticks but none is coming up succesful now ...

any hints?
'



Edited 1 time(s). Last edit at 09/30/2017 05:45PM by pengu.
Re: Debian on WD MyCloud EX 4100 - booting from USB not "stable"
September 17, 2017 04:16PM
pengu,

Take it case by case. You described too many scenarios so it is hard to tell what the problem is.

Just pick a problem you encountered and post the serial boot log for that. If there are more than one then make separate posts, one for each.

Take it from here:

Quote

Now .. it's different .. as I'm using the modified U-Boot ... all connected mass storage devices were up and running .. and the kernel comand line points to the "rootfs" labeled stick


1. systemd is now up and running and it behaves sometimes strange ..

2. Now this isn't the case because I have it commented out or ther were none of these non existent devices.
I'm also several different "rootfs" sticks but none is coming up succesful now ...

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100 - booting from USB not "stable"
September 30, 2017 05:48PM
without serial I cannot say more about this but I'll do if I have the time for it.
First I need a working box (now, the two ex2u boxes were up and running) and I also got e raspberry pi 3 for serial connection.
So let's se whats happening on the EX4100 and EX2100 which also doesn't working at the moment.
The last flashed kernel doesn't boot.
Re: Debian on WD MyCloud EX 4100
October 01, 2017 09:53AM
Quote
bodhi
I'll look into compiling this daemon and after that you can test it on your box.

I compiled mcm-daemon, but it doesn't work on the EX2100 yet (I am still investigating uP communication problems).

Perhaps you can try it on the EX4100.

Recommend running with debug and foreground flags so you can see what's happening:
./mcm-daemon -d -f -c mcm-daemon.ini

Edit: debug, not default. D'oh!



Edited 1 time(s). Last edit at 10/02/2017 02:57AM by hmartin.
Attachments:
open | download - mcm-daemon.tar.gz (18.6 KB)
Re: Debian on WD MyCloud EX 4100
October 01, 2017 10:43PM
hmartin Wrote:
-------------------------------------------------------
>
Quote
bodhi
> I'll look into compiling this daemon and after
> that you can test it on your box.
>
>
> I compiled mcm-daemon, but it doesn't work on the
> EX2100 yet (I am still investigating uP
> communication problems).
>
> Perhaps you can try it on the EX4100.
>
> Recommend running with default and foreground
> flags so you can see what's happening:
>
> ./mcm-daemon -d -f -c mcm-daemon.ini
>

Cool! thanks hmartin.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
October 07, 2017 06:34AM
bodhi,

i just tried to install your new Debian-4.12.4-mvebu-tld-1-rootfs-bodhi.tar.bz2 rootfs on the ex4100

I followed your instructions until
cp -a zImage-4.12.4-mvebu-tld-1 zImage
and then added
copy armada-388-wd-ex4100.dtb and armada-388-wd-ex4100.dts to boot/dts (those files are not in the dts folder already)
cat dts/armada-388-wd-ex4100.dtb >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.4-mvebu-tld-1 -d zImage.fdt uImage

when i try to boot the ex4100 it gets stuck after
Starting kernel

any ideas? is that 4.12.4 rootfs not compatible?

EDIT: found my typo

cp -a zImage-4.12.4-mvebu-tld-1 zImage.fdt



Edited 1 time(s). Last edit at 10/07/2017 02:42PM by saschadd.
Re: Debian on WD MyCloud EX 4100
October 07, 2017 03:01PM
hmartin Wrote:
-------------------------------------------------------
>
Quote
bodhi
> I'll look into compiling this daemon and after
> that you can test it on your box.
>
>
> I compiled mcm-daemon, but it doesn't work on the
> EX2100 yet (I am still investigating uP
> communication problems).
>
> Perhaps you can try it on the EX4100.
>
> Recommend running with debug and foreground flags
> so you can see what's happening:
>
> ./mcm-daemon -d -f -c mcm-daemon.ini
>
>
> Edit: debug, not default. D'oh!


hmartin,

just tried your mcm version
following the output

./mcm-daemon -d -f -c mcm-daemon.ini
mcm-daemon[3181]: Bind name to ls.
mcm-daemon[3181]: Listen on ls for connections.
mcm-daemon[3181]: Server startup success on port 57367
mcm-daemon[3181]: error 5 from tcgetattr
mcm-daemon[3181]: error 5 from tggetattr
mcm-daemon[3181]: Error writing byte 0: 250, count: -1
mcm-daemon[3181]: Try number: 1
mcm-daemon[3181]: Error writing byte 0: 250, count: -1
mcm-daemon[3181]: Try number: 2
mcm-daemon[3181]: Error writing byte 0: 250, count: -1
mcm-daemon[3181]: Try number: 3
mcm-daemon[3181]: Error writing byte 0: 250, count: -1
mcm-daemon[3181]: Try number: 4
mcm-daemon[3181]: Error sending DeviceReady command, exit!
Re: Debian on WD MyCloud EX 4100
October 07, 2017 04:54PM
saschadd,

> EDIT: found my typo
>
> cp -a zImage-4.12.4-mvebu-tld-1 zImage.fdt

So did it boot OK now?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
October 08, 2017 02:54AM
bodhi,

yes debian stretch is up an running.

But still with fan running at full speed.
How or where could i add that WDMyCloud_EX4100_GPL_v2.30.165_20170321/firmware/module/crfs/script/system_init you posted?

or should we try to get this mcm daemon running?
i should have some spare time for testing things.
Re: Debian on WD MyCloud EX 4100
October 08, 2017 04:04AM
saschadd,

> But still with fan running at full speed.
> How or where could i add that
> WDMyCloud_EX4100_GPL_v2.30.165_20170321/firmware/module/crfs/script/system_init
> you posted?
>
> or should we try to get this mcm daemon running?
> i should have some spare time for testing things.

I was hoping that it would work for hmartin on EX2100. But it seems there is some problem in the EX2100.

We should try to run the stock script based on what's in WDMyCloud_EX4100_GPL_v2.30.165_20170321/firmware/module/crfs/script/system_init. It is doable using the optware approach. It is not as elegant as using the new mcm-daemon, but hopefully it will do the trick.

Let me see what shared libaries this script loads in stock GPL, and we'll do the same.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
October 11, 2017 08:01PM
saschadd,

Quote
bodhi
We should try to run the stock script based on what's in WDMyCloud_EX4100_GPL_v2.30.165_20170321/firmware/module/crfs/script/system_init. It is doable using the optware approach. It is not as elegant as using the new mcm-daemon, but hopefully it will do the trick.

Let me see what shared libaries this script loads in stock GPL, and we'll do the same.

This is a little bit more cumbersome than I've expected. So it will be slow coming!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
November 25, 2017 05:32AM
Quote
bodhi
I was hoping that it would work for hmartin on EX2100. But it seems there is some problem in the EX2100.

Sorry it took me so long. I finally figured out the many issues preventing mcm-daemon from working on the EX2100.

I wrote about it here.

Maybe you can try the modified mcm-daemon on EX4100 and see if it works?

I put the modified mcm-daemon on GitHub if anyone wants to fork for EX4100.
Re: Debian on WD MyCloud EX 4100
November 25, 2017 04:13PM
@hmartin,

Cool :) I was going to ask you to try the optware approach if the mcm-daemon is too much trouble.

Quote

Maybe you can try the modified mcm-daemon on EX4100 and see if it works?

I don't have this box, we need saschadd to test it.

@sashadd,

Please try hmartin's mcm-daemon build.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
esion
Re: Debian on WD MyCloud EX 4100
November 29, 2017 10:35AM
Hey there guys,
just tried the daemon on my EX4100, doesn't work.
mcm-daemon[2112]: Bind name to ls. 
mcm-daemon[2112]: Listen on ls for connections. 
mcm-daemon[2112]: Server startup success on port 57367
mcm-daemon[2112]: error 5 from tcgetattr
mcm-daemon[2112]: error 5 from tggetattr
mcm-daemon[2112]: Error writing byte 0: 250, count: -1
mcm-daemon[2112]: Try number: 1
mcm-daemon[2112]: Error writing byte 0: 250, count: -1
mcm-daemon[2112]: Try number: 2
mcm-daemon[2112]: Error writing byte 0: 250, count: -1
mcm-daemon[2112]: Try number: 3
mcm-daemon[2112]: Error writing byte 0: 250, count: -1
mcm-daemon[2112]: Try number: 4
mcm-daemon[2112]: Error sending DeviceReady command, exit!
Re: Debian on WD MyCloud EX 4100
November 29, 2017 01:27PM
Can you please post the mcm-daemon.ini? Unless you didn't modify it. In case you didn't already know, you cannot run the daemon alone, you need the mcm-daemon.ini configuration file too.

Is mcm-daemon.ini configured for /dev/ttyS1?

What does this show: dmesg | grep ttyS

The errors in your output show mcm-daemon wasn't able to connect to the serial port and set the communication parameters:
mcm-daemon[2112]: error 5 from tcgetattr
mcm-daemon[2112]: error 5 from tggetattr



Edited 4 time(s). Last edit at 11/29/2017 01:33PM by hmartin.
Re: Debian on WD MyCloud EX 4100
November 29, 2017 02:17PM
I installed as per description on Github and used the default .ini.

dmesg | grep tty doesn't show any output.
Re: Debian on WD MyCloud EX 4100
November 30, 2017 02:23AM
Quote
esion
dmesg | grep tty doesn't show any output.

@bodhi, the EX4100 dts is missing the uart port to the Welltrend.

Could someone with the EX4100 and a serial console please post the output of dmesg | grep ttyS from the WD firmware?
Re: Debian on WD MyCloud EX 4100
November 30, 2017 04:07AM
hmartin Wrote:
-------------------------------------------------------
>
Quote
esion
> dmesg | grep tty doesn't show any output.
>
>
> @bodhi, the EX4100 dts is missing the uart port to
> the Welltrend.
>
> Could someone with the EX4100 and a serial console
> please post the output of dmesg | grep ttyS
> from the WD firmware?

Thanks! I'll take a look.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
November 30, 2017 04:42AM
hmartin,

> @bodhi, the EX4100 dts is missing the uart port to
> the Welltrend.

Did you mean this?

+
+                       serial@12100 {
+                               status = "okay";
+                       };

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
November 30, 2017 08:43AM
Quote
bodhi
Did you mean this?

Yes. I guess I'm looking at at old dts here?

If esion is booting with the correct EX4100 DTB, any idea why the ttyS* device isn't being created? It's strange there is nothing about the ttyS device in dmesg.

Here is on my EX2100:
[    1.324990] console [ttyS0] disabled
[    1.348744] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 23, base_baud = 12500000) is a 16550A
[    1.357772] console [ttyS0] enabled
[    1.394291] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 24, base_baud = 12500000) is a 16550A

ttyS1 on the EX2100 is communicating to the Welltrend.
Re: Debian on WD MyCloud EX 4100
November 30, 2017 12:01PM
I sure took either an already combined kernel or a dts from one of bodhi's post in this thread. If it helps, i could boot up the original firmware later today.
Re: Debian on WD MyCloud EX 4100
November 30, 2017 05:12PM
@hmartin,

>
> If esion is booting with the correct EX4100 DTB,
> any idea why the ttyS* device isn't being created?
> It's strange there is nothing about the ttyS
> device in dmesg.

Indeed, what I post was from the EX2100 DTS. The EX4100 DTS does not have it, atm.

@esion,
Let me make the new EX4100 DTB and upload here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on WD MyCloud EX 4100
November 30, 2017 05:23PM
> @esion,
> Let me make the new EX4100 DTB and upload here.
@bodhi:
Would be cool if you could wrap up how to install. Has been a while since I read the whole thread. ;)
Author:

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: