Welcome! Log In Create A New Profile

Advanced

WD MyCloud Gen2 (Glacier, Armada 375)

Posted by Miraculix666 
WD MyCloud Gen2 (Glacier, Armada 375)
January 19, 2020 08:02AM
Hi,

I want to use debian on my MyCloud. By now the only way I could manage to boot and log into the system via ssh is to use the Alpine kernel from Johs-Q.

https://github.com/Johns-Q/wdmc-gen2

WD My Cloud Gen2: Marvell Armada 375
Linux version 4.12.0 (root@wdmycloud2) (gcc version 6.3.0 (Alpine 6.3.0) ) #1 SMP Wed Jul 5 01:37:27 CEST 2017
Debian 10.2

Every other way descriebed by Fox-exe didn't succeed.

https://community.wd.com/t/clean-os-debian-openmediavault-and-other-firmwares/93714/1707

at now I can boot the debian Image downloaded from here, via johns kernel form USB (sdb2) or hdd (sda1 swap, sda2 data, sda3 rootfs)

How could I start to research how a debian kernel shold be build for the system? I think first I need UART acces?

THX for help

--------------
bodhi edited: correct the subject to "Armada 375"



Edited 1 time(s). Last edit at 01/21/2020 03:57AM by bodhi.
Re: WD MyCloud Gen2 (Glacier, Armada 875)
January 20, 2020 01:19AM
This rootfs should be ok to use for all MVEBU SoCs:

https://forum.doozan.com/read.php?2,32146

The working thread (not sure if it is the same device):

https://forum.doozan.com/read.php?2,28939

Take a look and let me know if that MyCloud Gen 2 is the same as your box.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: WD MyCloud Gen2 (Glacier, Armada 875)
January 20, 2020 04:45AM
No, it's not the same mine is a single drive with less RAM and Armada 875

maybe this could help us?

root@debian:~# cat /etc/fw_env.config
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors

/dev/mtd1               0x0000          0x80000         0x20000                 4

changed to mtd0


root@debian:~# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=run distro_bootcmd
bootdelay=2
baudrate=115200
stdin=serial,cros-ec-keyb,usbkbd
stdout=serial,vidconsole
stderr=serial,vidconsole
ethaddr=00:00:11:22:33:44
eth1addr=00:00:11:22:33:45
eth3addr=00:00:11:22:33:46
eth5addr=00:00:11:22:33:47
ipaddr=1.2.3.4
host_boot=if host dev ${devnum}; then setenv devtype host; run scan_dev_for_boot_part; fi
sata_boot=if sata dev ${devnum}; then setenv devtype sata; run scan_dev_for_boot_part; fi
scsi_init=if ${scsi_need_init}; then setenv scsi_need_init false; scsi scan; fi
scsi_boot=run scsi_init; if scsi dev ${devnum}; then setenv devtype scsi; run scan_dev_for_boot_part; fi
virtio_boot=if virtio dev ${devnum}; then setenv devtype virtio; run scan_dev_for_boot_part; fi
boot_prefixes=/ /boot/
boot_scripts=boot.scr.uimg boot.scr
boot_script_dhcp=boot.scr.uimg
boot_targets=host1 host0
boot_syslinux_conf=extlinux/extlinux.conf
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
bootcmd_host1=setenv devnum 1; run host_boot
bootcmd_host0=setenv devnum 0; run host_boot
distro_bootcmd=setenv scsi_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done
bootm_size=0x10000000
kernel_addr_r=0x1000000
fdt_addr_r=0xc00000
ramdisk_addr_r=0x2000000
scriptaddr=0x1000
pxefile_addr_r=0x2000

root@debian:~# env
Setting up linux-image-5.3.5-mvebu-tld-1 (1.0) ...
update-initramfs: Generating /boot/initrd.img-5.3.5-mvebu-tld-1
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=5cb40a04-5278-4546-9eeb-b6fc1ebfaf8f)
I: Set the RESUME variable to override this.
root@debian:/boot# mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.3.5-mvebu-tld-1 -d zImage.fdt uImage
Image Name:   Linux-5.3.5-mvebu-tld-1
Created:      Wed Aug 26 03:57:56 2020
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    5070468 Bytes = 4951.63 KiB = 4.84 MiB
Load Address: 00008000
Entry Point:  00008000
root@debian:/boot# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.3.5-mvebu-tld-1 -d initrd.img-5.3.5-mvebu-tld-1 uInitrd
Image Name:   initramfs-5.3.5-mvebu-tld-1
Created:      Wed Aug 26 03:58:40 2020
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    12600745 Bytes = 12305.42 KiB = 12.02 MiB
Load Address: 00000000
Entry Point:  00000000
root@debian:/boot#
root@debian:/boot#
root@debian:/boot# env
SHELL=/bin/bash
PWD=/boot
LOGNAME=root
XDG_SESSION_TYPE=tty
HOME=/root
LANG=C.UTF-8
SSH_CONNECTION=192.168.50.106 61962 192.168.50.100 22
XDG_SESSION_CLASS=user
TERM=xterm
USER=root
SHLVL=1
XDG_SESSION_ID=c3
XDG_RUNTIME_DIR=/run/user/0
SSH_CLIENT=192.168.50.106 61962 22
LC_ALL=C.UTF-8
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
MAIL=/var/mail/root
SSH_TTY=/dev/pts/1
_=/usr/bin/env
OLDPWD=/root


if I try to boot directly from hdd, it seems that no files are touched, no logs,...

I think the fw_env should be adjusted?

I also found out, that john uses a different comannd for mkimage

https://github.com/Johns-Q/wdmc-gen2/blob/master/build-initramfs.sh

the one from your instructions seems to bee similar to the instuctions from fox

https://fox-exe.ru/WDMyCloud/WDMyCloud-Gen2/Developing/_howto_build_kernel.txt

there are also three different dts, yours, fox's and johns and here is another:

https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/armada-375-db.dts



Edited 4 time(s). Last edit at 01/20/2020 04:42PM by Miraculix666.
Re: WD MyCloud Gen2 (Glacier, Armada 875)
January 20, 2020 12:28PM
Miraculix666,

Your MyCloud Gen 2 is practically the same as the one in the working thread. It is Armada 375 SoC (not 875).

The Glacier version has dual-core Armada 375, 512MB RAM, and one HDD. So the DTS is slightly different from the other MyCould Gen 2 versions. But it should boot OK.

I am not sure what the excerpt log above means. Was it booted with Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2, and then you tried to upgrade the kernel to linux-5.3.5-mvebu-tld-1 ?

Please post the entire steps that you used to install the kernel (i.e which commands and their output).

And post this log:
dmesg
cat /proc/mtd
cd /boot
ls -lart *


BTW, do you have serial console?

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 01/20/2020 12:55PM by bodhi.
Re: WD MyCloud Gen2 (Glacier, Armada 875)
January 20, 2020 05:04PM
Sorry typo, I meant in the thread I can only find the GrandTeton with Armada 385.

It was booted from USB with Alpine uImage, as far as I discoverd it makes a switch_root to the discoverd rootfs.
On the hdd is Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2 and I made the Kernel uImage as in the Instructions described. I also tried the other dts files from fox and john.

Today I tried
fw_setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial init=/bin/systemd"'

and since then I cannot boot, violet LED.

In the next days I try tftp boot and install a UART Cable
Re: WD MyCloud Gen2 (Glacier, Armada 875)
January 20, 2020 05:18PM
Miraculix666,

> Today I tried
>
> fw_setenv usb_set_bootargs 'setenv bootargs
> "console=ttyS0,115200 root=LABEL=rootfs
> rootdelay=10 $mtdparts earlyprintk=serial
> init=/bin/systemd"'
>
>
> and since then I cannot boot, violet LED.


That was because the envs were not accessible, and the default was used.
Warning: Bad CRC, using default environment

So by doing that fw_setenv, you wiped out the good settings in stock FW (I hope this is the case, since this type of error is recoverable using serial console).

> In the next days I try tftp boot and install a
> UART Cable

Yes, serial console is needed to unbrick now.

-bodhi
===========================
Forum Wiki
bodhi's corner
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 21, 2020 10:17AM
Hi
I'm testing WD My Cloud Gen2. So far i tried kernels and dts from fox-exe
- 4.15.0-rc6 from fox-exe - runs fine, but network crashed after 1 day (Edit: gigabit led not working, detects 1Gbps/Full detected when connecting cable, but not sending data)
- 4.19 from debian buster but network card is not working ( mvpp2 f10f0000.ethernet eth0: could not attach PHY (-22))
- 5.2.9 Bohdi's kernel with fox-exe dts ( mvpp2 f10f0000.ethernet eth0: could not attach PHY (-22))

According to this post https://bugzilla.kernel.org/show_bug.cgi?id=201563 network issue could be related to 4.19 network changes (RSS)



Edited 1 time(s). Last edit at 01/21/2020 10:21AM by osa.
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 21, 2020 04:03PM
osa,

It could be something else. I was running 4.20 on the Mirabox (Armada 370, which is the single-core CPU, while 375 is dual-core). So apparently the mvneta driver in 4.20 worked fine.

https://forum.doozan.com/read.php?2,92514

Usually when you see PHY attached error with a new kernel and you know the DTS was working with older kernel, then something has changed in mainline DTSI include chain. The PHY address should be the same, but some mdio or such nodes might have some updates.

Did you recompile the fox-exe DTS using the latest source? if not, can you post the DTS here and I'll recompile a new DTB for you to try.

When I have a chance, I'll build a new kernel (5.4.x) for this Mirabox to see if there is any regression.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 01/22/2020 04:10AM by bodhi.
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 05:22AM
I tried vanilla kernel 4.18 and network works but gigabit (led blinks, no transmission).
On 4.19.1 link is detected but no transmission at all (no matter if 100 or 1000 bit/s, but not throwing "could not attach PHY" error).
MyCloud has only one network port, so multiqueue can be misconfigured somehow

Are you sure your Mirabox is Armada 375 based, not 370?
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 05:29AM
osa,

> Are you sure your Mirabox is Armada 375 based, not
> 370?

It is 370, which is the single core version of 375.

However, now that I thought about it, I think the DTS for Mirabox is quite different (older style) from the mainline Armada 37x or 38x DTS. So the comparison is not quite appropriate.

The only thing I can think of is, like I've asked, did you recompile the DTS, or using fox-exe DTB?

-bodhi
===========================
Forum Wiki
bodhi's corner
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 05:41AM
DTS were compiled (4.18 and 4.19) and are binary identical as fox-exe

I will check "workaround" from bugzilla to confirm if this is related to mvpp2 driver change (RSS/multiqueue) and try other DTSes
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 02:45PM
osa,

Quote

> DTS were compiled (4.18 and 4.19) and are binary
> identical as fox-exe


Quote

- 5.2.9 Bohdi's kernel with fox-exe dts ( mvpp2 f10f0000.ethernet eth0: could not attach PHY (-22))

You need to compile it in kernel 5.2.9 source.

-bodhi
===========================
Forum Wiki
bodhi's corner
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 03:25PM
All DTBs are binary identical. 5.2 and 5.3 were not working for me either (i think they returned PHY error 22)

I tried 5.5.0-rc7 with no luck, but now ethernet port led is turned off and no status change on cable plug/unplug (maybe this patch? https://github.com/torvalds/linux/commit/f3f2364ea14d1cf6bf966542f31eadcf178f1577#diff-38b28d4e5f70b4f5e7ec9b5e787a0e13)

root@wdmc:~# ifdown eth0
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:90:a9:e9:64:60
Sending on   LPF/eth0/00:90:a9:e9:64:60
Sending on   Socket/fallback
DHCPRELEASE of 192.168.2.52 on eth0 to 192.168.2.1 port 67
send_packet: Network is unreachable
send_packet: please consult README file regarding broadcast address.
dhclient.c:2878: Failed to send 300 byte long packet over fallback interface.
root@wdmc:~#
root@wdmc:~# ifup eth0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

[  128.576145] mvpp2 f10f0000.ethernet eth0: could not attach PHY (-22)
RTNETLINK answers: Invalid argument
Listening on LPF/eth0/00:90:a9:e9:64:60
Sending on   LPF/eth0/00:90:a9:e9:64:60
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
send_packet: Network is down
dhclient.c:2445: Failed to send 300 byte long packet over eth0 interface.

So, i'll dig into 4.18/4.19 changes to find out if "single port" board is not properly configured or.. dts sets wrong port

Edit: Ha! 5.5.0-rc works now!
DTS from fox-exe has phy-mode set to "mii", but kernel default DTS for 375 has "rgmii-id"
Also i think in fox-exe files are at least 2 different version of the same filev



Edited 1 time(s). Last edit at 01/22/2020 03:44PM by osa.
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 04:54PM
osa,

Good works :)

> DTS from fox-exe has phy-mode set to "mii", but
> kernel default DTS for 375 has "rgmii-id"

That's a big difference!

Please post the DTS name for future reference.

-bodhi
===========================
Forum Wiki
bodhi's corner
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 22, 2020 06:38PM
5.3.5-mvebu-tld-1 works for me
The only issue i see is gigabit led (in the socket) but i can live with this ;-)

DTS is from here with phy-mode changed and led triggers set
There is another file but looks very similar (not tested)

/*
 * Device Tree file for WD MyCloud based on Marvell Armada 375
 * (DB-88F6720)
 *
 *  Copyright (C) 2014 Marvell
 *
 * Gregory CLEMENT <gregory.clement@free-electrons.com>
 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 * Allester Fox <fox.axon@gmail.com>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include "armada-375.dtsi"

/ {
	model = "WD MyCloud Gen2";
	compatible = "marvell,a375-db", "marvell,armada375";

	chosen {
		stdout-path = "serial0:115200n8";
	};

	memory@0 {
		device_type = "memory";
		reg = <0x00000000 0x20000000>; /* 512 MB */
	};

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
			  MBUS_ID(0x09, 0x09) 0 0xf1100000 0x10000
			  MBUS_ID(0x09, 0x05) 0 0xf1110000 0x10000>;

	};

	gpio-leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&sys_led_pins>;

		system-red {
			label = "system-red";
			gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;	// chip, pin, state (1=active-low)
			default-state = "keep";
		};
		system-green {
			label = "system-green";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; // 43 (mpp43) - 32 (gpio in chip) = 11 (pin in this chip)
			linux,default-trigger = "ide-disk1";
			//default-state = "on";
		};
		system-blue {
			label = "system-blue";
			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
			//linux,default-trigger = "default-off";
			default-state = "on";
		};
	};

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&btn_reset_pins>;
		#address-cells = <1>;
		#size-cells = <0>;

		btn-reset {
			label = "btn-reset";
			gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; // 44-32=12
			linux,code = <198>; // KEY_RESTART, from: include/uapi/linux/input-event-codes.h
			gpio-key,wakeup;
			//autorepeat;
		};
	};

	usb3_phy: usb3-phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&usb3_vbus>;
	};

	usb3_vbus: usb3-vbus {
		compatible = "regulator-fixed";
		pinctrl-names = "default";
		pinctrl-0 = <&usb3_vbus_pins>;
		regulator-name = "usb3-vbus";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 13 GPIO_ACTIVE_HIGH>;
	};
};

&spi0 {
	pinctrl-0 = <&spi0_pins>;
	pinctrl-names = "default";
	status = "okay";

	spi-flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "mxicy,mx25l8005", "jedec,spi-nor";
		reg = <0>; /* Chip select 0 */
		spi-max-frequency = <108000000>;
		partition@0 {
			label = "u-boot";
			reg = <0x0 0x100000>;
		};
	};
};

&i2c0 {
	status = "okay";
	clock-frequency = <100000>;
	pinctrl-0 = <&i2c0_pins>;
	pinctrl-names = "default";
};

&i2c1 {
	status = "okay";
	clock-frequency = <100000>;
	pinctrl-0 = <&i2c1_pins>;
	pinctrl-names = "default";
};

&uart0 {
	status = "okay";
};

&pinctrl {
	sys_led_pins: sys-led-pins {
		marvell,pins = "mpp20", "mpp43", "mpp22"; // R G B
		marvell,function = "gpio";
	};

	btn_reset_pins: btn-reset-pins {
		marvell,pins = "mpp44";
		marvell,function = "gpio";
	};

	usb3_vbus_pins: usb3-vbus-pins {
		marvell,pins = "mpp13";
		marvell,function = "gpio";
	};
};

&sata {
	status = "okay";
	nr-ports = <1>;
};

&usb1 {
	status = "okay";
};

&usb2 {
	status = "okay";
};

&mdio {
	phy0: ethernet-phy@0 {
		reg = <0>;
	};
};

&ethernet {
	status = "okay";
};

&eth0 {
	status = "okay";
	phy = <&phy0>;
	phy-mode = "rgmii-id";
};


Re: WD MyCloud Gen2 (Glacier, Armada 375)
January 23, 2020 04:46AM
Thanks osa!

-bodhi
===========================
Forum Wiki
bodhi's corner
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: