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 (buy bodhi a beer)
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 (buy bodhi a beer)



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 (buy bodhi a beer)
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 (buy bodhi a beer)



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 (buy bodhi a beer)
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 (buy bodhi a beer)
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 (buy bodhi a beer)
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 (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 27, 2020 06:33PM
Hi
I found latest kernels (5.5+ ???) are over 5MB and they do not fit into hardcoded adresses in u-boot
Kernel is loaded at 0xa00000 and initrd is loaded at 0xf00000 so maximum kernel size is 5 242 880 bytes (with mkimage headers)

Is it possible to fit into that limit by moving some modules to initrd in next releases?

When kernel and initrd is loaded by hand into non overlaping adresses, kernel runs fine.
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 27, 2020 08:21PM
osa,

IMO, that's not a good solution.

- The problem loading the later kernel images only applicable with this box u-boot load addresses. Other boxes work fine with different addresses, since all these stock u-boots are slightly different custom versions of the Marvell u-boot.

- Only the necessary modules are built-in. Very few modules should be moved to loadable modules in initrd.

- The kernel size will grow larger as time goes on. We started with about 4MB uImage long ago and its size getting larger gradually in mainline code. This trend is not going to change. So try trimming down the size is not a good approach. In fact, people who run mainline Debian Kirkwood and MVEBU kernel have been struggling a bit with the size issue, because they use whatever stock load addresses are defined.

So the solution is to change the load address for each box when that box has problem booting due to the kernel image size. Otherwise, we will keep chasing and fixing this problem in the next kernel versions, ad infinitum.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 04:09AM
Thanks for reply

Making non-default load adresses persistent will require ugly hacks on this box
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 03:51PM
osa,

Quote

Making non-default load adresses persistent will require ugly hacks on this box

Not sure I understood? I thought you did change the address and it was OK?

Quote

When kernel and initrd is loaded by hand into non overlaping adresses, kernel runs fine.

If it is too muck ugly hacking to just set the envs, we can find some way to make it more elegant.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 04:33PM
Hi, i managed to compile 5.10 xz compressed kernel and it fits to 5MB limit and boots nicely.
What are downsides of switching to xz compression?

Some envs are hardcoded and overwrites envs like bootcmd (even if CRC is correct)

Luckily setting bootargs root=/dev/sda2 console=ttyS0,115200 is persistent and it is enough to boot debian kernel from boot partition (sda3) and use sda2 as root

I didn't manage to upload uboot with kwboot and couldn't test "modified by hand" adresses in flash image. I don't have flash programmer to do more risky stuff
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 05:11PM
> What are downsides of switching to xz compression?

No downside that I known of with this Marvell u-boot versions on the Armada boxes. OTOH, lzma compression is the most backward compatible compression with much older u-boots.

>
> Some envs are hardcoded and overwrites envs like
> bootcmd (even if CRC is correct)

Ah. So this u-boot is similar to the WD Ext200/400 series in that the bootcmd is harded code. This could be solved by a rebuilt stock u-boot.

Now I understand why you said "ugly hack" is needed :)

>
> Luckily setting bootargs root=/dev/sda2
> console=ttyS0,115200
is persistent and it is
> enough to boot debian kernel from boot partition
> (sda3) and use sda2 as root

Cool!

> I didn't manage to upload uboot with kwboot and
> couldn't test "modified by hand" adresses in flash
> image. I don't have flash programmer to do more
> risky stuff

Most of the time, it is not risky if you don't save envs in u-boot console. You can just enter some envs and execute them during testing. However, I understand there is some minimal risk if it boots back to stock and mess up the envs.

Could you print out the envs at serial console prompt?

printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 05:31PM
Marvell>> printenv
CASset=max
MALLOC_len=5
MPmode=SMP
autoload=no
baudrate=115200
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=host1 host0
bootargs=root=/dev/sda2 console=ttyS0,115200
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada375:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=usb reset; fatload usb 0:1 0xa00000 /boot/uImage; fatload usb 0:1 0xf00000 /boot/uRamdisk; bootm 0xa00000 0xf00000
bootcmd_auto=stage_boot $boot_order
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_host0=setenv devnum 0; run host_boot
bootcmd_host1=setenv devnum 1; run host_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000;
bootdelay=2
bootm_size=0x10000000
cacheShare=no
console=console=ttyS0,115200
device_partition=0:1
disL2Cache=yes
disL2Prefetch=yes
disaMvPnp=no
distro_bootcmd=setenv scsi_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaDCPref=yes
enaFPU=yes
enaICPref=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:00:11:22:33:45
eth1mtu=1500
eth2addr=00:50:43:cc:22:19
eth2mtu=1500
eth3addr=00:00:11:22:33:46
eth3mtu=1500
eth5addr=00:00:11:22:33:47
ethact=egiga0
ethaddr=00:90:A9:E9:64:60
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_addr_r=0xc00000
fdt_skip_update=no
fdtaddr=0x1000000
fdtfile=armada-375-db.dtb
host_boot=if host dev ${devnum}; then setenv devtype host; run scan_dev_for_boot_part; fi
ide_path=/
image_name=uImage
initrd_name=uInitrd
ipaddr=1.2.3.4
kernel_addr_r=0x1000000
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
loadaddr=0x02000000
mtdids=spi0=spi_flash
mtdparts=mtdparts=spi_flash:4m(boot),-(spi-rootfs)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:19:22:cc
netbsd_en=no
netretry=no
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=0x2000
ramdisk_addr_r=0x2000000
sata_boot=if sata dev ${devnum}; then setenv devtype sata; run scan_dev_for_boot_part; fi
sata_delay_reset=0
sata_dma_mode=yes
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
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
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
script_addr_r=3000000
script_name=boot.scr
scriptaddr=0x1000
scsi_boot=run scsi_init; if scsi dev ${devnum}; then setenv devtype scsi; run scan_dev_for_boot_part; fi
scsi_init=if ${scsi_need_init}; then setenv scsi_need_init false; scsi scan; fi
setL2CacheWT=no
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
usb0Mode=host
usbActive=0
usbType=3
virtio_boot=if virtio dev ${devnum}; then setenv devtype virtio; run scan_dev_for_boot_part; fi
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81

Environment size: 5038/65532 bytes

fw_printenv
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
bootargs=root=/dev/sda2 console=ttyS0,115200
bootcmd=usb reset; fatload usb 0:1 0xa00000 /boot/uImage; fatload usb 0:1 0x1000000 /boot/uRamdisk; bootm 0xa00000 0x1000000
Last to rows were entered by me and stored in flash properly with fw_setenv (the last one is ignored, always loads uRamdisk to 0xf00000)



Edited 1 time(s). Last edit at 12/28/2020 05:32PM by osa.
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 28, 2020 06:30PM
osa,

> bootcmd=usb reset; fatload usb 0:1 0xa00000
> /boot/uImage; fatload usb 0:1 0x1000000
> /boot/uRamdisk; bootm 0xa00000 0x1000000
> [/code]
> Last to rows were entered by me and stored in
> flash properly with fw_setenv (the last one is
> ignored, always loads uRamdisk to 0xf00000)

OK it seems there is no problem with setting the bootcmd, this bootcmd is not the original stock bootcmd,
bootcmd=usb reset; fatload usb 0:1 0xa00000 /boot/uImage; fatload usb 0:1 0xf00000 /boot/uRamdisk; bootm 0xa00000 0xf00000
Is that correct? How was it saved before?

So you can test the new load addreses for uImage and uInitrd in serial console to confirm that it works with the larger uImage. And then save it after a few tests. Is saveenv not available or no tworking in serial console?

======

And also to see if this u-boot handle the relocation better, try to tell it to load initrd higher.

Power up, at serial console prompt:
setenv initrd_high 0xffffffff
boot

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 29, 2020 04:08AM
Hi

I reset/restore nand to factory state. Last 64kB of flash contains only MAC and Serial number at the end

uboot has no saveenv so it's not possible to make permanent changes in env.
so original printenv is
CASset=max
MALLOC_len=5
MPmode=SMP
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
bootargs=root=/dev/ram console=ttyS0,115200
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada375:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd=usb reset; fatload usb 0:1 0xa00000 /boot/uImage; fatload usb 0:1 0xf00000 /boot/uRamdisk; bootm 0xa00000 0xf00000
bootcmd_auto=stage_boot $boot_order
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000;
bootdelay=1
cacheShare=no
console=console=ttyS0,115200
device_partition=0:1
disL2Cache=yes
disL2Prefetch=yes
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaDCPref=yes
enaFPU=yes
enaICPref=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:50:43:b2:30:1b
eth1mtu=1500
eth2addr=00:50:43:b2:1a:1b
eth2mtu=1500
eth3addr=00:50:43:30:1a:b2
eth3mtu=1500
ethact=egiga0
ethaddr=00:90:A9:E9:64:60
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=no
fdtaddr=0x1000000
fdtfile=armada-375-db.dtb
ide_path=/
image_name=uImage
initrd_name=uInitrd
ipaddr=2.76.78.201
kernel_addr_r=2080000
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
loadaddr=0x02000000
loads_echo=0
mtdids=spi0=spi_flash
mtdparts=mtdparts=spi_flash:4m(boot),-(spi-rootfs)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:1b:1a:b2
netbsd_en=no
netmask=255.0.0.0
netretry=no
pcieTune=no
pexMode=RC
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
rootpath=/srv/nfs/
sata_delay_reset=0
sata_dma_mode=yes
script_addr_r=3000000
script_name=boot.scr
serverip=192.168.1.1
setL2CacheWT=no
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
usb0Mode=host
usbActive=0
usbType=3
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81
Environment size: 3077/65532 bytes


I can easlily load kernel and initrd by hand from usb to non-overlaping adresses and boot to debian
setenv bootargs root=/dev/sda2 console=ttyS0,115200
setenv usbActive 1
setenv usbType 2
usb start
fatload usb 0:1 0xa00000 boot/uImage
fatload usb 0:1 0x2000000 boot/uRamdisk
bootm 0xa00000 0x2000000


I don't understand how it works - my fw_env.config looks like this
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors

/dev/mtd0               0xf0000         0x10000         0x10000                 1
flash is almost empty and fw_printenv shows
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

Now i can set bootargs with fw_saveenv
fw_setenv bootargs 'root=/dev/sda2 console=ttyS0,115200'
Warning: Bad CRC, using default environment
and it fixes CRC and adds bootargs
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
bootargs=root=/dev/sda2 console=ttyS0,115200
and writes to flash

if i set bootcmd this way it is ignored by uboot.

Quote
setenv initrd_high 0xffffffff boot
no effect
Marvell>> setenv initrd_high 0xffffffff
Marvell>> boot
(Re)start USB...
USB0:   Port (usbActive) : 0    Interface (usbType = 3) : USB XHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
** Bad device usb 0 **
** Bad device usb 0 **
## Booting image at 00a00000 ...
### Loading Firmware from USB 2.0 Disk ###
(Re)start USB...
USB0:   Port (usbActive) : 1    Interface (usbType = 2) : USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
reading /boot/uImage
5181396 bytes read in 501 ms (9.9 MiB/s)
reading /boot/uRamdisk
9659113 bytes read in 912 ms (10.1 MiB/s)
## Booting image at 00a00000 ...
## Booting kernel from Legacy Image at 00a00000 ...
   Image Name:   Linux-5.10.3-mvebu-tld-1
   Created:      2020-12-28  22:09:37 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5181332 Bytes = 4.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00f00000 ...
   Image Name:   initramfs-5.10.3-mvebu-tld-1
   Created:      2020-12-28  22:10:01 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    9659049 Bytes = 9.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 29, 2020 04:30PM
osa,

Looks like you might try setting the distro_bootcmd the same way you set bootargs. Try do a test by adding an echo:

fw_setenv distro_bootcmd 'echo running distro boot command; setenv scsi_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done'

If that works, then you can short circuit the whole thing and run your own boot command.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 29, 2020 04:32PM
Quote

I don't understand how it works - my fw_env.config looks like this
# MTD device name Device offset Env. size Flash sector size Number of sectors

/dev/mtd0 0xf0000 0x10000 0x10000 1


Let me take a close look at this.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 29, 2020 04:44PM
Here you also need to pass mtdparts in the bootargs. Also add early printk so that you can see more. Earlyprintk also print out more kernel messages in the previous booting when it stopped output at
Starting kernel ...

So that manual boot attempt should be:
setenv bootargs root=/dev/sda2 console=ttyS0,115200 mtdparts=spi1.0:4m(boot),-(spi-rootfs) earlyprintk=serial' 
setenv usbActive 1
setenv usbType 2
usb start
fatload usb 0:1 0xa00000 boot/uImage
fatload usb 0:1 0x2000000 boot/uRamdisk
bootm 0xa00000 0x2000000

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
osa
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 29, 2020 07:11PM
Hi

Still no luck.
I splitted flash to u-boot and env parts and nothing really changed. fw_printent shows some values even if env partition is empty.. maybe it reads whole mtd to find some headers?
AFAIR mtd partitioning can be made in fdt. But this is not the case now

I think in autoboot mode nearly all envs are ignored and only bootargs are properly passed.

In manual mode envs are passed to uboot but even then some boot commands looks like hardcoded.
Typing commands to boot is not an option.

So.. I will stick to 5.4 (LTS?) kernel and have some fun with this box

I attached uboot and env (factory) partition, i don't know what You can do with this, look for some variables, strings? Or maybe someone will download them for flash recovery

Thanks for help
Osa
Attachments:
open | download - mtd0.uboot (960 KB)
open | download - env.txt (64 KB)
Re: WD MyCloud Gen2 (Glacier, Armada 375)
December 30, 2020 04:37PM
osa,

> I splitted flash to u-boot and env parts and
> nothing really changed. fw_printent shows some
> values even if env partition is empty..

It means the envs you are seeing with fw_printenv are not at the location that u-boot is actually using.

> I think in autoboot mode nearly all envs are
> ignored and only bootargs are properly passed.

Probably. The only way to tell how to hack around that restriction is to look at the GPL source code. Sometime we don't need to build and flash new stock u-boot if we can figure out a flaw in the stock boot sequence, like I did for the NAS326. I could not kwboot the NAS326 (too time consuming to get to the potential solution), so I can't risk flashing a rebuilt u-boot to it. But tweaking the envs allowed us to boot Debian the way we want to.

> In manual mode envs are passed to uboot but even
> then some boot commands looks like hardcoded.
> Typing commands to boot is not an option.
>

Right. If it always reverse to internal bootcmd in the code, then running "boot" will use that internal value.


> So.. I will stick to 5.4 (LTS?) kernel and have
> some fun with this box

Sooner or later, you will have to figure out this boot loader problem. Because it is restricting you to kernel 5.4, and need to revisit the kernel size issue again and again to move on to the new kernel version.

It is good to liberate these boxes from the "shackles" of the NAS manufacturers :) if we could. If you can find the GPL for this specific box u-boot, I'll be happy to look at it when I have time.

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



Edited 1 time(s). Last edit at 12/30/2020 04:39PM by bodhi.
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: