Welcome! Log In Create A New Profile

Advanced

Debian on WD MyCloud EX2 Ultra

Posted by vzhilov 
Debian on WD MyCloud EX2 Ultra
April 05, 2020 03:43AM
Hello!

I've got WD MyCloud EX2 Ultra, a device with 1Gb of RAM and 2 slots for HDDs. I do have access to the serial console. I attach screenshot of my boot log.

I have actually collected different pieces of data into my github with customized uImage and uInitrd. But I would like to update cryptsetup version for whole disk encryption which requires new glibc 2.25 which requires new kernel.

I have example of armada-385-wdmc-Ex2-Ultra.dts file from my friend. But I don't have kernel config to compile the .DTB file for your Linux Kernel 5.5.3.

I think I can compile right on the device for correct achitecture environment as I have Debian 10 already installed on the device.

Do I just compile last stable kernel with a default config:
DTS_FILE =  armada-385-wdmc-Ex2-Ultra
make -j 4 $DTS_FILE.dtb

and then add this to your Kernel compilation?



Edited 1 time(s). Last edit at 04/05/2020 12:05PM by vzhilov.
Attachments:
open | download - IMG_1195.jpg (906 KB)
Re: Debian on WD MyCloud EX2 Ultra
April 05, 2020 11:56AM
By now I have found your config file for the kernel in you .deb arhive and compiled .dtb and new uImage file.

The uImage was still slightly bigger than 5Mb and was not fitting to /dev/mtdblock1. So I took all TV/Radio/Video modules off from your kernel config (put "=m"). Then the kernel got less and did fit.

But I can't boot. I get

Quote
Kernel panic VFS: Unable to mount root fs on unknown-block(1,0)



Edited 1 time(s). Last edit at 04/05/2020 12:06PM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 05, 2020 05:40PM
vzhilov,

> But I can't boot. I get
>
>
Quote
Kernel panic VFS: Unable to mount root fs
> on unknown-block(1,0)

>
>

You need to load the uInitrd, too. This is Debian kernel. If you dont want to load uInitrd then you could ,but you still want to run the correct rootfs (Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2).

And then your bootargs for the root device must point to the USB or HDD partition that contains the rootfs.

If you need my help to get it booting, do this:

Power up, interrupt serial console and

printenv
boot

And post the entire serial console log here.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 05:21AM
Thank you very much for paying attention to my question.

Your Initrd is too big for my /dev/mtdblock2 (5Mb). My flow is that I boot from custom Initrd just to decrypt the HDD raid and switch futher booting to HDD where I have the full Debian 10. So I use Busybox for Initrd with a very minimal amount of scripts + TFTP support to download encryption key file + cryptsetup to decrypt HDD raid.

Just for your info here is my Initrd init file:

#!/bin/busybox ash
# init-script for WD Mycloud Mirror gen2 & Ex2 ultra
# Boots from partition labeled "rootfs"
# (c) Carl Schiller; schreibcarl@gmail.com

#-----------functions--------------
# Start decryption filesystem
decrypt_shell() {
  # Check which device encrypted
  export cryptdev=$(blkid -l -o device -t TYPE=crypto_LUKS)
  echo device=$(blkid -l -o device -t TYPE=crypto_LUKS) >>/etc/profile      # add location of crytodevice to environment
  echo export device >>/etc/profile
  # Look for key on usb / hdd
  #mount -o rw $(findfs LABEL=key) /mnt/key
  #wait
  # fttpServerIp=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}')
  tftp -r license.key -l /mnt/key/license.key -g tftp.local
  wait
  if [  -e /mnt/key/license.key  ]; then
    cryptsetup luksOpen $cryptdev cryptroot --key-file /mnt/key/license.key
    dd if=/dev/urandom of=/mnt/key/license.key bs=1024 count=$RANDOM
    tftp -r license.key -l /mnt/key/license.key -p tftp.local
    rm /mnt/key/license.key
    check_unlock
  else
    dropbear -B -p 2222 -b /etc/dropbear/banner.crypto -P /run/dropbear.pid 2>&1 >/dev/null
  fi
}

# Check if key-decrypt was sucessfull
check_unlock(){
wait    
if ! [ -e /dev/mapper/cryptroot ]; then
    echo -e "Unlock check failed,..."
    rescue_shell
fi
}

# rescue_shell
rescue_shell() {
  # start ssh
  dropbear -B -p 2222 -b /etc/dropbear/banner.rescue -P /run/dropbear.pid 2>&1 >/dev/null
  echo -e "\n Something went wrong. Dropping to a shell.\n"
 
  ## Wait for manual decryption
  # while ! [ -e /dev/mapper/cryptroot ]; do
  #    sleep 2
  #  done
  #  boot
  ## Or
    
  # Run UART shell
  exec 0</dev/console
  exec 1>/dev/console
  exec 2>/dev/console
  exec setsid cttyhack /bin/ash
  
}

#LVM init sequence
initlvm() {
  lvm vgscan --mknodes # creates /dev/mapper/control
  lvm vgchange -a ly
  lvm vgscan --mknodes # creates /dev/mapper/VG-root and /dev/VG/root
  wait
}

#Switchroot seqence
boot() {
  echo -e "\n Unmounting and Switch to OS\n"
  wait
  # kill running daemons
  [ -r "/run/dropbear.pid" ] && kill -9 $(cat /run/dropbear.pid)
  [ -r "/run/udhcpc.pid" ]   && kill -9 $(cat /run/udhcpc.pid)
  umount /mnt/config 2> /dev/null
  umount /sys 2> /dev/null
  umount /proc 2> /dev/null
  umount /dev/pts 2> /dev/null
  umount /dev 2> /dev/null
  exec switch_root -c /dev/console /mnt/root /sbin/init
}

#Reset button
resetbutton_init() {
echo 50 > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio50/active_low
}

#-----------init script--------------
# Creat folders and install Busybox
/bin/busybox mkdir -p /dev /mnt/root /mnt/key /mnt/config /mnt/config/initrd /proc /root /usr/sbin /usr/bin /sbin /bin /sys /run
/bin/busybox --install -s

export PATH=/bin:/sbin:/usr/bin:/usr/sbin

# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

# Adding mdev support
echo /sbin/mdev >/proc/sys/kernel/hotplug
mdev -s

# Adding reset button beheavor
resetbutton_init

# Initial Raid
echo 'DEVICE /dev/sd?*' >/etc/mdadm.conf
mdadm -Eb /dev/sd?* >>/etc/mdadm.conf
mdadm -As --force
wait # disk not ready?
mdadm --assemble --scan
# If case a disk was replaced (TODO: make an IF here)
mdadm --manage /dev/md0 --add /dev/sdb

# Mount the config files
#ubiattach /dev/ubi_ctrl -m 5
#wait
#mount -t ubifs ubi0:config /mnt/config - todo, we can't mount ubifs device as a module is missing

# setting up network
#/sbin/getmac
ifconfig eth0 hw ether c2:0d:88:00:80:08
#ifconfig eth0 up
udhcpc -t 5 -q -s /bin/simple.script -p /run/udhcpc.pid

#check for LUKS-devices
decrypt_shell

initlvm
mount -o rw /dev/MyVolGroup/root /mnt/root 2>&1 >/dev/null
if [ -h /mnt/root/sbin/init -o -e /mnt/root/sbin/init ]; then
  ifconfig eth0 down
  boot
else
  rescue_shell
fi


But the kernel on my device is 4.14 and it is not enough to run last version of cryptsetup.


Here is printenv before boot:

Device UUID: 34375840-037F—B8C1-2285-24A3009F87FF
Service UUID: FFEO
RX UUID: FFE1 
TX UUID: FFE1

Connecting 
Successfully connected to BLE device.

printenv
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=d ovefb:lcd0:$lcdO_params cicd.lcd0_enable=$lcd0_enable cicd.lcd_panel=$lcd_panel
ovefb:lcd0:$lcdO_params cicd.lcd0_enable=$lcd0_enable cicd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:ethO:none
bootargs_root=root=/dev/nfs rw
bootcmd=nand read.e Oxa00000 0x500000 0x500000;nand read.e Oxf00000 Oxa00000 0x500000;bootm Oxa00000 Oxf00000
bootcmd_auto=stage_boot $boot_order
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$s erverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$1cdO_params cicd.lcd0_enable=$lcd0_enable cicd.lcd_pane l=$lcd_panel; bootz 0x2000000 — $fdtaddr;
erverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$1cdO_params cicd.lcd0_enable=$lcd0_enable cicd.lcd_pane l=$lcd_panel; bootz 0x2000000 — $fdtaddr;
l=$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:$lcdO_params cicd.lcd0_enable=$1cd0_enable cicd.lcd_panel=$lcd_panel; bootz 0 x2000000 — $fdtaddr;
$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcdO_params cicd.lcd0_enable=$1cd0_enable cicd.lcd_panel=$lcd_panel; bootz 0 x2000000 — $fdtaddr;
x2000000 — $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
disaMvPnp=no 
eeeEnable=no 
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no 
enaWrAllo=no 
eth1addr=00:50:43:24:0a:29
ethlmtu=1500 
eth2addr=00:50:43:24:8c:29
eth2mtu=1500 
eth3addr=00:50:43:0a:8c:24
eth3mtu=1500 
ethact=egiga2 
ethaddr=00:50:43:8c:0a:29
ethmtu=1500 
ethprime=egiga2
fdt_addr=2040000
fdt_skip_update=no
fdtaddr=0x1000000
fdtfile=armada-38x—modular.dtb
filesize=12 
ide_path=/
image_name=uImage
initrd_name=uInitrd
ipaddr=192.168.11.110
resc,0_addr_r=2080000
erverip=192.168.11.114
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_en d; bootm 0x2000000;
d; bootm 0x2000000;
stderr=serial 
stdin=serial 
stdout=serial 
usbOMode=host 
usbActive=0 
usbType=3
vxworks_en=no 
yuk_ethaddr=00:00:00:EE:51:81

Environment size: 3209/524284 bytes 
Marvell»

If I leave my own Initrd but upload your kernel to /dev/mtdblock1 I have the following boot log:

Marvell» boot


AND read: device 0 offset 0x500000, size 0x500000 
5242880 bytes read: OK


AND read: device 0 offset Oxa00000, size 0x500000 
5242880 bytes read: OK
•# Booting image at 00a00000
•# Booting kernel from Legacy Image at 00a00000 
   Image Name:   Kernel-5.5.3
   Created:      2020-04-05 18:18:50 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5098687 Bytes = 4.9 MiB
   Load Address: 00008000 
   Entry Point: 00008000 
   Verifying Checksum OK
•# Loading init Ramdisk from Legacy Image at 00f00000
   Image Name:   Initrd
   Created:      2020-04-04 18:10:00 UTC
   Image Type:   ARM Linux RAMDisk Image (lzma compressed)
   Data Size:    4916280 Bytes = 4.7 MiB
   Load Address: 00000000 
   Entry Point: 00000000 
   Verifying Checksum      OK 
   Loading Kernel Image ... OK
OK


Starting kernel ...


Uncompressing Linux... done, booting the kernel.
[    0.000000][     TO] Booting Linux on physical CPU Ox0
[    0.000000][     TO] Linux version 5.6.0-mvebu-tld-1-g5364abc57 (root@wdmc) (gcc version 8.3.0 (Debian 8.3.0-6)) #3 SMP PREEMPT Sun Apr 5
21:09:30 MSK 2020
[    0.000000][     TO] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000][     TO] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000][     TO] OF: fdt: Machine model: WD MyCloud Ex2 Ultra: Marvell Armada 385
[    0.000000][     TO] Memory policy: Data cache writealloc
[    0.000000][     TO] INITRD: 0x00f00000+0x004b1000 overlaps in-use memory region - disabling initrd
[    0.000000][     TO] percpu: Embedded 20 pages/cpu s52172 r8192 d21556 u81920
[    0.000000][     TO] Built 1 zonelists, mobility grouping on. Total pages: 260608
[    0.000000][     TO] Kernel command line: root=/dev/ram console=ttyS0,115200
[    0.000000][     TO] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000][     TO] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000][     TO] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.000000][     TO] Memory: 1022700K/1048576K available (10240K kernel code, 947K rwdata, 2864K rodata, 1024K init, 327K bss, 25876K res
erved, OK cma- reserved, 262144K highmem)
[    0.000000] [    TO] random: get_random_u32 called from       cache_alloc+0x438/0x7a4 with crng_init=0
[    0.000000] [    TO] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] [    TO] rcu:     RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] [    TO] Tasks RCU enabled.
[    0.000000] [    TO] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] [    TO] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] [    TO] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] [    TO] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] [    TO] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] [    TO] L2C-310 D prefetch enabled, offset 1 lines
[    0.000000] [    TO] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] [    TO] L2C-310 Coherent cache controller enabled, 16 ways, 1024 kB
[    0.000000] [    TO] L2C-310 Coherent: CACHE_ID 0x410054c9, AUX_CTRL Ox56070001
[    0.000008] [    TO] sched_clock: 64 bits at 666MHz, resolution 1ns, wraps every 4398046511103ns
[    0.000022] [    TO] clocksource: arm_global_timer: mask: Oxffffffffffffffff max_cycles: 0x999999d70a, max_idle_ns: 440795225152 ns
[    0.000040] [    TO] Switching to timer-based delay loop, resolution 1ns
[    0.000273] [    TO] Ignoring duplicate/late registration of read_current_timer delay
[    0.000284] [    TO] clocksource: armada_370_xp_clocksource: mask: Oxffffffff max_cycles: Oxffffffff, max_idle_ns: 76450417870 ns
[    0.000842] [    TO] Console: colour dummy device 80x30
[    0.000864] [    TO]timer frequency.. 1332.00 BogoMIPS (lpj=6660000)
[    0.000874][     TO] pid_max: default: 32768 minimum: 301
[    0.001036][     TO] LSM: Security Framework initializing
[    00.001704][    TO] CPUO: Spectre v2: using BPIALL workaround
[    0.001840][     T1] CPUO: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002198][     T1] Setting up static identity map for 0x100000 - 0x100060
[    0.002300][     T1] mvebu-soc-id: MVEBU SoC ID=0x6820, Rev=0x4
[    0.002407][     T1] mvebu-pmsu: Initializing Power Management Service Unit
[    0.002511][     T1] rcu: Hierarchical SRCU implementation.
[    0.004322][     T1] smp: Bringing up secondary CPUs ...
[    0.004709][     T1] Booting CPU 1
[    0.004901][     TO] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.004906][     TO] CPU1: Spectre v2: using BPIALL workaround
[    0.005000][     T1] smp: Brought up 1 node, 2 CPUs
[    0.005007][     T1] SMP: Total of 2 processors activatecksource: jiffies: mask: Oxffffffff max_cycles: Oxffffffff, max_idle_ns: 19112604
462750000 ns
[    0.008364][     T1] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.008497][     T1] xor: measuring software checksum speed
[   0.100106][ om: seed boundary self test passed
[   0.301685][  T1] prandom: 100 self tests passed
[   0.301690][  T1] pinctrl core: initialized pinctrl subsystem
[   0.302441][  T1] thermal_sys: Registered thermal governor 'stepwise'
[   0.302836][  T1] Ne=initialized audit_enabled=0 res=1
[   0.305128][  T1] cpuidte: using governor ladder
[   0.305155][  T1] cpuidte: using governor menu
[   0.305259][  T1] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[   0.305266][  T1] hw-breakpoint: maximum watchpoint size is 4 bytes.
[   0.305412][  T1] mvebu-pmsu: CPU hotplug support is currently broken on Armada 38x: disabling
[   0.305422][  T1] mvebu-pmsu: CPU idle is currently broken on Armada 38x: disabling
[   0.500153][  T1] raid6: int32x8 gen() 243 MB/s
[   0.670119][  T1] raid6: int32x8 xor() 168 MB/s
[   0.840210][  T1] raid6: int32x4 gen() 280 MB/s
[   1.010171][  T1] raid6: int32x4 xor() 180 MB/s
[   1.180180][  T1] raid6: int32x2 gen() 447 MB/s
[   1.350121][  T1] raid6: int32x2 xor() 257 MB/s
[   1.520145][  T1] raid6: int32x1 gen() 513 MB/s
[   1.690151][  T1] raid6: int32x1 xor() 208 MB/s
[   1.690158][  T1] raid6: using algorithm int32x1 gen() 5ore:6][ FS: , 61uredfamiv4.1nters available
[   2.391439][  T1] Initialise system trusted keyrings
[   2.391473][  T1] Key type blacklist registered
[   2.391769][  T1] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[   2.391860][  T1] zbud: loaded
[   2.392722][  T1] NFS: Registering the id_resolver key type
[   2.392740][  T1] Key type id_resolver registered
[   2.392746][  T1] Key type id_legacy registered
[   2.392758][  T1] nfs4filetayout_init: NFSv4 File Layout Driver Registering...
[   2.393   T1] bounce: pool size: 64 pages
[   2.415822][  T1] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[   2.417295][  T1] armada-38x-pinctrl f1018000.pinctrl: registered pinctrl driver
[   2.419364][  T1] mv_xor f1060800.xor: Marvell shared XOR driver
[   2.473770][  T1] mv_xor f1060800.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[   2.475256][  T1] mv_xor f1060900.xor: Marvell shared XOR driver
[   2.533765][  T1] mv_xor f1060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[   2.572380][  T1] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[   2.574201][  T1] printk: console [ttyS0] disabled
[   2.574251][  T1] f1012000.serial: ttySO at MMIO Oxf1012000 (irq = 23, base_baud = 12500000) is a 16550A
[   3.486234][  T1] printk: console [ttyS0] enabled
not [  3.547841][   T1] scsi host®: ahci-mvebu
[   3.599089][  T1] mvneta f1034000.ethernet eth0: Using random mac address 26:c4:ed:b9:33:99
[   3.608013][  T1] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   3.615320][  T1] ehci-pci: EHCI PCI platform driver
[   3.620529][  T1] ehci-orion: EHCI orion driver
[   3.625429][  T1] orion-ehci f1058000.usb: EHCI Host Controller
[   3.631576][  T1] orion-ehci f1058000.usb: new USB bus registered, assigned bus number 1
[   3.639983][  T1] orion-ehci f1058000.usb: irq 40, io mem Oxf1058000
[   3.673234][  T1] orion-ehci f1058000.usb: USB 2.0 started, EHCI 1.00
[   3.680054][  T1] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.06
[   3.689100][  T1] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   3.697073][  T1] usb usb1: Product: EHCI Host Controller
[   3.702675][  T1] usb usb1: Manufacturer: Linux 5.6.0-mvebu-tld-1-g5364abc57 ehci_hcd
[   3.710745][  T1] usb usb1: SerialNumber: f1058000.usb
[   3.716481][  T1] hub 1-0:1.0: USB hub found
[   3.720974][  T1] hub 1-0:1.0: 1 port detected
[   3.726525][  T1] usbcore: registered new interface driver usblp
[   3.732790][  T1] usbcore: registered new interface driver usb-storage
[   3.739762][  T1] mousedev: PS/2 mouse device common for alt mice
[   3.747029][  T1] armada38x-rtc f10a3800.rtc: registered as rtc0
[   3.753485][  T1] i2c /dev entries driver
[   3.760306][  T1] watchdog: f1020300.watchdog: driver supplied timeout (4294967295) out of range
[   3.769347][  T1] watchdog: f1020300.watchdog: falling back to default timeout (171)
[   3.777567][  T1] orion_wdt: Initial timeout 171 sec
[   3.783047][  T1] device-mapper: uevent: version 1.0.3
[   3.788548][  T1] device-mapper: ioctt: 4.42.0-ioctl (2020-02-27) initialised: dm-devet@redhat.com
[   3.797967][  T1] device-mapper: muttipath round-robin: version 1.2.0 loaded
[   3.805267][  T1] device-mapper: muttipath queue-length: version 0.2.0 loaded
[   3.812615][  T1] device-mapper: muttipath service-time: version 0.3.0 loaded
[   3.820004][  T1] device-mapper: dm-log-userspace: version 1.3.0 loaded
[   3.826857][ usbh[  3.875797][  T1] Segment Routing with IPv6
[   3.880227][  T1] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[   3.887723][  T1] NET: Registered protocol family 17
[   3.892991][  T1] 8021q: 802.1Q VLAN Support v1.8
[   3.897987][  T1] Key type dns_resotver registered
[   3.903034][  T1] ThumbEE CPU extension supported.
[   3.908044][  T1] Registering SWP/SWPB emulation handler
[   3.911500][ T1194] ata2: SATA link down (SStatus 0 SControt 300)
[   3.913756][  T1] registered taskstats version 1
[   3.924555][  T1] Loading compiled-in X.509 certificates
[   3.930136][  T1] zswap: loaded using pool lzo/zbud
[   3.935437][  T1] Key type ._fscrypt registered
[   3.940168][  T1] Key type .fscrypt registered
[    3.911500][ 11194] ata2: SATA link down (SStatus 0 SControl 300)
[    3.913756][     T1] registered taskstats version 1
[    3.924555][     T1] Loading compiled-in X.509 certificates
[    3.930136][     T1] zswap: loaded using pool lzo/zbud
[    3.935437][     T1] Key type ._fscrypt registered
[    3.940168][     T1] Key type .fscrypt registered
[    3.944845][     T1] Key type fscrypt-provisioning registered
[    3.952584][     T1] Key type big_key registered
[    3.957639][     T1] Key type encrypted registered
[    3.965053][   T52] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    3.971118][   T52] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
[    3.979466][   T52] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    3.989509][   T52] xhci-hcd f10f0000.usb3: irq 45, io mem 0xf10f0000
[    3.996271][   T52] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.06
[    4.005294][   T52] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.013281][   T52] usb usb2: Product: xHCI Host Controller bus number 3
[    4.056465][   T52] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
[    4.063607][   T52] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    4.072522][   T52] usb usb3: New USB device found, idVendorus 133 SControl 300)
[    4.095134][   T52] usb usb3: Manufacturer: Linux 5.6.0-mvebu-tld-1-g5364abc57 xhci-hcd
[    4.110100][   T52] usb usb3: SerialNumber: f10f0000.usb3
[    4.115552][ T1190] ata1.00: ATA-9: WDC WD80EFAX-68KNBN0, 81.00A81, max UDMA/133
[    4.115881][   T52] hub 3-0:1.0: USB hub found
[    4.123076][ T1190] ata1.00: 15628053168 sectors, multi 0: LBA48 NCQ (depth 32)
[    4.127559][   T52] hub 3-0:1.0: 1 port detected
[    4.139968][   T52] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    4.146061][   T52] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 4
[    4.154382][   T52] xhci-hcd f10f8000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    4.164385][ T1190] ata1.00: configured for UDMA/133
[    4.164406][   T52] xhci-hcd f10f8000.usb3: irq 46, io mem 0xf10f8000
[    4.176087][   T52] usb usb4: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.06
[    4.179723][   T36] scsi 0:0:0:0: Direct-Access       ATA       WDC WD80EFAX-68K 0A81 PQ: 0 ANSI: 5
[    4.185115][   T52] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.185120][   T52] usb usb4: Product: xHCI Host Controller
[    4.194685][   T20] sd 0:0:0:0: [sda] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
[    4.201916][   T52] usb usb4: Manufacturer: Linux 5.6.0-mvebu-tld-1-g5364abc57 xhci-hcd
[    4.207816][   T20] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    4.216248][   T52] usb usb4: SerialNumber: f10f8000.usb3
[    4.224314][   T20] sd 0:0:0:0: [sda] Write Protect is off
[    4.230501][   T52] hub 4-0:1.0: USB hub found
[    4.241131][   T52] hub 4-0:1.0: 1 port detected
[    4.245670][   T20] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    4.250434][   T52] xhci-hcd f10f8000.usb3: xHCI Host Controller
[    4.266099][   T52] xhci-hcd f10f8000.usb3: new USB bus registered, assigned bus number 5
[    4.[    4.333173][    T52] hub 5-0:1.0: USB hub found
[    4.337698][   T52] hub 5-0:1.0: 1 port detected
[    4.343133][     T1] input: gpio-keys as /devices/platform/gpio-keys/input/inputO
[    4.351149][     T1] armada38x-rtc f10a3800.rtc: setting system clock to 2020-04-06T09:44:38 UTC (1586166278)
[    4.376051][     T1] md: Autodetecting RAID arrays.
[    4.380869][     T1] md: autorun
[    4.384396][     T1] md:     autorun DONE.
[    4.388666][     T1] VFS: Cannot open root device "ram" or unknown-block(1,0): error -6
[    4.396705][     T1] Please append a correct "root," boot option; here are the available partitions:
[    4.405822][     T1] 0800      7814026584 sda
[    4.405824]      T1]  driver: sd
[    4.413370][     Ti] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[    4.422380][     T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.6.0-mvebu-tld-1-g5364abc57 #3
[    4.430948][     T1] Hardware name: Marvell Armada 380/385 (Device Tree)
[    4.437617][     T1] [<c01159d8>] (unwind_backtrace) from [<c01103arom [<c0f0150c>] (mount_block_root+Ox1b4/0x238)
[    4.469999][     T1] [<c0f0150c>] (mount_block_root) from [<c0f01680>] (mount_root+0xf0/0x12c)
[    4.478572][     T1] [<c0f01680>] (mount_root) from [<c0f01800>] (prepare_namespace+0x144/0x180)
[    4.487320][     T1] [<c0f01800>] (prepare_namespace) from [<c0f01064>] (kernel_init_freeable+Ox1f8/0x264)
[    4.496942][     T1] [<c0f01064>] (kernel_init_freeable) from [<c0a17a9c>] (kernel_init+0x8/0x10c)
[    4.505865][     T1] [<c0a17a9c>] (kernel_init) from [<c0100148>] (ret_from_fork+0x14/0x2c)
[    4.514172][     T1] Exception stack(Oxef0b3fb0 to OxefOb3ff8)
[    4.519949][     T1] 3fa0:                                       00000000 00000000 00000000 00000000
[    4.528870][     T1] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.537790][     T1] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    4.545142][     C1] CPU1: stopping
[    4.548566][     C1] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-mvebu-tld-1-g5364abc57 #3
[    4.557135][     C1] Hardware name: Marvell Armada 380/385 (Device Tree)
[    4.563792][     C1] [<c01159d8>] (unwind_backtrace) from [<c01103ac>] (show_stack+0x10/0x14)
[    4.572279][     C1] kc01103ac>1 (show_stack) from [<c0a0204c>]c_handle_irq) from kc010124c>1 ( irq_svc+0x6c/Oxa8)
[    4.604913][     C1] Exception stack(Oxef0d1f58 to Oxef0d1fa0)
[    4.610690][     C1] 1f40:                                                          00000000 ef7e2870
[    4.619612][     C1] 1f60: 00000000 c011e660 00000000 00000000 c1004fc8 c1004fe8 ffffe000 c1005030
[    4.628534][     C1] 1f80: c0d296c4 00000000 c1003d00 ef0d1fa8 c010dOec c010d0dc 60000113 ffffffff
[    4.637458][     C1] kc010124c>1 ( irq_svc) from kc010d0dc>1 (arch_cpu_idle+Ox1c/0x38)
[    4.645596][     C1] kc010d0dc>1 (arch_cpu_idle) from [<c0151444>] (do_idle+0x134/0x2bc)
[    4.653733][     C1] [<c0151444>] (do_idle) from [<c0151884>] (cpu_startup_entry+Ox18/0x1c)
[    4.662044][     C1] [<c0151884>] (cpu_startup_entry) from [<00101dcc>] (0x101dcc)
[    4.669573][     T1]    [ end Kernel panic    not syncing: VFS: Unable to mount root fs on unknown block(1,0) ]



Edited 1 time(s). Last edit at 04/06/2020 05:22AM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 06:01AM
vzhilov,

> Your Initrd is too big for my /dev/mtdblock2
> (5Mb). My flow is that I boot from custom Initrd
> just to decrypt the HDD raid and switch futher
> booting to HDD where I have the full Debian 10.

That's fine. I understand and agreed, you are doing the right thing if you want to keep the kernel in flash. uInitrd is something you can trim down to smaller size later. The important thing is using one that fits your purpose.


> If I leave my own Initrd but upload your kernel to
> /dev/mtdblock1 I have the following boot log:
>
> Marvell» boot
>
>
> AND read: device 0 offset 0x500000, size 0x500000
>
> 5242880 bytes read: OK
>
>
> AND read: device 0 offset Oxa00000, size 0x500000
>
> 5242880 bytes read: OK
> •# Booting image at 00a00000
> •# Booting kernel from Legacy Image at 00a00000
>
> Image Name: Kernel-5.5.3
> Created: 2020-04-05 18:18:50 UTC
> Image Type: ARM Linux Kernel Image
> (uncompressed)
> Data Size: 5098687 Bytes = 4.9 MiB
> Load Address: 00008000
> Entry Point: 00008000
> Verifying Checksum OK
> •# Loading init Ramdisk from Legacy Image at
> 00f00000
> Image Name: Initrd
> Created: 2020-04-04 18:10:00 UTC
> Image Type: ARM Linux RAMDisk Image (lzma
> compressed)
> Data Size: 4916280 Bytes = 4.7 MiB
> Load Address: 00000000
> Entry Point: 00000000
> Verifying Checksum OK
> Loading Kernel Image ... OK
> OK
>
>
> Starting kernel ...
>

Cool. So far so good.

You'are very close to get it booted. This problem "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)" is easy to solve.

Instead of spending some time to reading your Initrd init file above, I only need to know: please describe your system partition configuration.

Where is your rootfs now? is it in HDD RAID partition or USB? and how did you create it? did you use Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2 or using your own existing rootfs? What disks are plugged in the system and what are the partitions in them look like?

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 07:39AM
My kerlen is /dev/mtdblock1 (5Mb), my initrd is /dev/mtdblock2 (5Mb). Then I have two HDD 5Tb plugged. It is raid /dev/md0. Initrd decrypts /dev/md0:

cryptsetup luksOpen /dev/md0 cryptroot --key-file luks.key
lvm vgscan --mknodes
lvm vgchange -a ly
lvm vgscan


Cryptroot is LVM and it has /dev/MyVolGroup/root (4Gb), /dev/MyVolGroup/swap (512Mb) and /dev/MyVolGroup/data (4.5Tb). Rootfs is on the /dev/MyVolGroup/root logical volume, so it gets mounted:

mount -o rw /dev/MyVolGroup/root /mnt/root


and then Initrd switches to that volume for futher boot:

exec switch_root -c /dev/console /mnt/root /sbin/init

This is how it works with the old kernel. I used a different Rootfs from a friend, it was Debian 9. When I ran apt upgrade it got upgraded to Debian 10 though internet.



Edited 1 time(s). Last edit at 04/06/2020 07:53AM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 09:51AM
Thank you, I'm interested too in your results.

I point you that our devices have an hw crypto engine (CESA) that can be used to improve disk encryption, as pointed at https://wiki.kobol.io/helios4/cesa/

Quote

In order to offload disk encryption on the CESA unit, you will need to specify to cryptsetup the following cipher: aes-cbc-essiv:sha256. Therefore the command to create your encrypted disk should looked as follow:
sudo cryptsetup -v -y -c aes-cbc-essiv:sha256 luksFormat /dev/sda1

You can verify running
cryptsetup benchmark


Also, note that this device has the same hardware of WD My Cloud Mirror Gen 2 (https://forum.doozan.com/read.php?2,28939), but with 1GB of Ram (WDMCMG2 has only 512). So you can find useful the results and the updated DTS i'm providing :)

Like me, you can build an usb drive to contain debian rootfs, kernel and initrd to bypass the size limits of the nand partitions, and keep the device compatibile with the original software as fallback.

Disk encryption like you is my final scope, and I think to modify mi usb drive in order to have a small partition unencrypted /boot partition and the debian rootfs and the data encrypted! This way, the hard drive can shutdown without spinning all the time.

Also, I'm exploring btrfs instead of lvm+ext4

What do you think about?



Edited 2 time(s). Last edit at 04/06/2020 10:05AM by CyberPK.
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 11:49AM
Quote
I point you that our devices have an hw crypto engine (CESA) that can be used to improve disk encryption

Interesting, I probably should re-encrypt by HDD raid then. Thank you for this.

Quote
Also, note that this device has the same hardware of WD My Cloud Mirror Gen 2


I have tried the .dts file from that device but I still have no luck to boot. But I think I do have correct .dts file from a friend. But for some reason the kernel couldb't find Ininrd to boot. @bodhi says it is easy to handle, so there is hope.

Quote
Like me, you can build an usb drive to contain debian rootfs, kernel and initrd to bypass the size limits of the nand partitions

That could be a solution. But how do you boot then? With a reset button pressed during the boot? And then do you have to keep that USB drive inserted into the device all the time? Or you can remove it after the deviced has booted?

Quote
Also, I'm exploring btrfs instead of lvm+ext4

Yes, I have also looked at that, but that seemed to me more complicated at that time.
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 01:28PM
Look to my post: https://forum.doozan.com/read.php?2,28939,98649#msg-98649
Also this for latest DTS: https://forum.doozan.com/read.php?2,28939,99099#msg-99099

In days I'll release a more refined version.

About using BTRFS:
It should be BTRFS over LUKS directly, managing both volumes and raid instead of EXT4 over LUKS over RAID.
Also take a moment to understand what is better between LUKS over RAID or RAID over LUKS.



Edited 3 time(s). Last edit at 04/06/2020 02:48PM by CyberPK.
Re: Debian on WD MyCloud EX2 Ultra
April 06, 2020 06:38PM
vzhilov,


USB booting:

> That could be a solution. But how do you boot
> then? With a reset button pressed during the boot?

With changes in u-boot envs, you should be able to boot with USB rootfs (unless it has some restriction like a few other Armada boxes).

> And then do you have to keep that USB drive
> inserted into the device all the time? Or you can
> remove it after the deviced has booted?

It is your system rootfs, so must be attached at all time.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 07, 2020 03:43AM
Quote
You'are very close to get it booted. This problem "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)" is easy to solve.

Is there anything I could do?



Edited 2 time(s). Last edit at 04/07/2020 05:38AM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 07, 2020 05:23AM
vzhilov,

Create a USB rootfs using Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2.

And boot with that. Some envs need to be adjusted to boot USB. I can help you with this.

And then after it booted into Debian, setup your RAID.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 07, 2020 05:38AM
I'm not bricked. I can boot with my old parameters without having rootfs on USB.

I'm going to boot BusyBox from nand partition. I'm looking to avoid using USB drive for booting. I do have my own Initrd and rootfs. But I really suffer from having old kernel as I can't update cryptsetup in Initrd. And the one you have (5.5.3) doesn't boot with my setup giving the above error. The old kernel 4.14 that I have boots up fine.

My only partitions are /dev/mtdblock1 for uImage and /dev/mtdblock2 for uInitrd. I don't use anything else for initial booting.



Edited 1 time(s). Last edit at 04/07/2020 05:50AM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 07, 2020 05:43PM
Hi vzhilov,

if you want to avoid using USB drive for booting you can repartition your mtd table so that your uImage space will be fitted with kernel 5.5 (usually bigger than 5MB). Don't forget to change the partitions in your dts file.

 #: name                 size		         offset		    mask_flags
 0: u-boot              0x000000500000		0x000000000000		1
 1: uImage              0x000000600000		0x000000500000		0
 2: uRamdisk            0x000000500000		0x000000b00000		0
 3: image.cfs           0x00000b900000		0x000001000000		0
 4: rescue_fw           0x000000f00000		0x00000c900000		0
 5: config              0x000001400000		0x00000d800000		0
 6: reserve1            0x000000a00000		0x00000ec00000		0
 7: reserve2            0x000000900000		0x00000f600000		0
setenv mtdparts mtdparts=armada-nand:5m(u-boot)ro,6m@5m(uImage),5m@11m(uRamdisk),185m@16m(image.cfs),15m@201m(rescue_fw),20m@216m(config),10m@236m(reserve1),9m@246m(reserve2)
saveenv

For your problem, i think it was somehow not enough memory for your uRamdisk, take a look at here
[    0.000000][     TO] INITRD: 0x00f00000+0x004b1000 overlaps in-use memory region - disabling initrd
You can try to assign another memory location for the uRamdisk, please try at 0x2000000
usb start
fatload usb 0:1 0xa00000 uImage
fatload usb 0:1 0x2000000 uRamdisk
bootm 0xa00000 0x2000000
If it works, you need to overwrite your bootcmd to make it persistent.
setenv bootargs root=/dev/ram console=ttyS0,115200
setenv bootcmd 'nand read.e 0x0a00000 0x0500000 0x0500000;nand read.e 0x2000000 0x0a00000 0x0500000;bootm 0x0a00000 0x2000000'
saveenv

In any case you need to patch and build a custom u-boot.bin, which allow you to enable "setenv" function (see CyberPK post)
Quote
CyberPK
> Look to my post:
> https://forum.doozan.com/read.php?2,28939,98649#msg-98649

I'm currently using kernel 5.5.3 from bodhi for my EX2 Ultra, everything works fine.

PS: I'm so glad if you can share your 5.5.3 kernel config to build a uImage which size less than 5MB.
Re: Debian on WD MyCloud EX2 Ultra
April 07, 2020 06:49PM
dtd.2512,

> I'm currently using kernel 5.5.3 from bodhi for my
> EX2 Ultra, everything works fine.

Thanks for the feed back and helps above!

Could you post your DTS here, or the link to the DTS (is that from fox?). Is it the same one vzhilov is using? I'd like to include that in the next kernel build.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 08:40AM
I'm attaching my config file, slightly changed from bodhi to make the size of kernel a bit less.

Here is the .dts file from Fox I'm using:

/*
 * Device Tree file for Marvell Armada 375 evaluation board
 * (DB-88F6720)
 *
 *  Copyright (C) 2014 Marvell
 *
 * Gregory CLEMENT <gregory.clement@free-electrons.com>
 * Thomas Petazzoni <thomas.petazzoni@free-electrons.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-385.dtsi"

/ {
	model = "WD MyCloud Ex2 Ultra: Marvell Armada 385";
	compatible = "marvell,a385-db-ap", "marvell,armada385", "marvell,armada380";

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

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

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;

		internal-regs {
			i2c@11000 {
				status = "okay";
				clock-frequency = <100000>;
				
				/*
				eeprom@54 {
					compatible = "atmel,24c64";
					reg = <0x54>;
				};
				*/
			};

			i2c@11100 {
				status = "okay";
				clock-frequency = <100000>;
			};
			
			sdhci@d8000 {
				broken-cd;
				wp-inverted;
				bus-width = <8>;
				status = "disabled";
				no-1-8-v;
			};

			serial@12000 {
				status = "okay";
			};

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

			pinctrl@18000 {
			/*
				sata_sd_pins: sata-sd-pins {
					marvell,pins = "mpp63", "mpp66";
					marvell,function = "gpio";
				};
			*/
				/* use only one pin for UART1, as mpp20 is used by sata0 */
				uart1_pins: uart-pins-1 {
					marvell,pins = "mpp19";
					marvell,function = "ua1";
				};

				xhci0_vbus_pins: xhci0-vbus-pins {
					marvell,pins = "mpp26";
					marvell,function = "gpio";
				};

				xhci1_vbus_pins: xhci1-vbus-pins {
					marvell,pins = "mpp27";
					marvell,function = "gpio";
				};

				sata0_pins: sata-pins-0 {
					marvell,pins = "mpp55";
					marvell,function = "sata0";
				};

				sata1_pins: sata-pins-1 {
					marvell,pins = "mpp56";
					marvell,function = "sata1";
				};

				led_pins: led-pins {
					marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54", "mpp48", "mpp58";
					marvell,function = "gpio";
				};

				btn_pins: btn-pins {
					marvell,pins = "mpp50";
					marvell,function = "gpio";
				};
			};

			mdio@72004 {
				phy0: ethernet-phy@0 {
					marvell,reg-init = <3 16 0 0x101e>;	// Init eth leds
					reg = <0>;
				};
			};

			ethernet@34000 {
				phy = <&phy0>;
				phy-mode = "sgmii";
				buffer-manager = <&bm>;
				bm,pool-long = <0>;
				bm,pool-short = <1>;
				status = "okay";
			};

			rtc@a3800 {
				status = "okay";
			};

			usb0: usb@58000 {
				status = "okay";
			};
			
			sata@a8000 {
				pinctrl-names = "default";
				//pinctrl-0 = <&sata0_pins &sata1_pins>;
				#address-cells = <1>;
				#size-cells = <0>;
				status = "okay";
				/*
				sata0: sata-port@0 {
					reg = <0>;
					target-supply = <&reg_5v_sata0>;
				};
				
				sata1: sata-port@1 {
					reg = <0>;
					target-supply = <&reg_5v_sata1>;
				};
				*/
			};
			
			nfc: flash@d0000 {
				status = "okay";
				num-cs = <1>;
				nand-ecc-strength = <4>;
				nand-ecc-step-size = <512>;
				marvell,nand-keep-config;
				marvell,nand-enable-arbiter;
				nand-on-flash-bbt;

				partitions {
					compatible = "fixed-partitions";
					#address-cells = <1>;
					#size-cells = <1>;

					partition@0 {
						label = "u-boot";
						reg = <0x0000000 0x00500000>;
						read-only;
					};

					partition@500000 {
						label = "uImage";
						reg = <0x00500000 0x00500000>;
					};

					partition@a00000 {
						label = "uRamdisk";
						reg = <0x00a00000 0x00500000>;
					};

					partition@f00000 {
						label = "image.cfs";
						reg = <0x00f00000 0x0b900000>;
					};

					partition@c800000 {
						label = "Recovery";
						reg = <0x0c800000 0x00f00000>;
					};

					partition@d70000 {
						label = "config";
						reg = <0x0d700000 0x01400000>;
					};

					partition@eb00000 {
						label = "reserve1";
						reg = <0x0eb00000 0x00a00000>;
					};

					partition@f500000 {
						label = "reserve2";
						reg = <0x0f500000 0x00a00000>;
					};
				};
			};
			
			crypto@9D000 {
				status = "okay";
			};

			usb3@f0000 {
				usb-phy = <&usb3_0_phy>;
				status = "okay";
			};

			usb3@f8000 {
				usb-phy = <&usb3_1_phy>;
				status = "okay";
			};
		};
		
		/*pcie {
			status = "okay";
			pcie@1,0 {
				status = "okay";
			};

			pcie@2,0 {
				status = "okay";
			};

			pcie@3,0 {
				status = "okay";
			};
		};
		*/
	};
	
	gpio-leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&led_pins>;

		// Triggers for kernel v4.14:
		// [none] timer oneshot disk-activity ide-disk mtd nand-disk heartbeat backlight gpio cpu cpu0 cpu1 default-on panic
		hdd1-red {
			label = "Disk1:red";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "disk-activity";
		};
		hdd2-red {
			label = "Disk2:red";
			gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "panic";
		};
		hdd1-blue {
			label = "Disk1:blue";
			gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
			default-state = "keep";
			//linux,default-trigger = "gpio";
		};
		hdd2-blue {
			label = "Disk2:blue";
			gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
			default-state = "keep";
			//linux,default-trigger = "gpio";
		};
	};

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

		btn-reset {
			label = "Reset";
			linux,code = <0x198>; // Restart=0x198, Power=0x116
			gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
			gpio-key,wakeup;
		};
	};

	usb3_0_phy: usb3_0_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_0_vbus>;
	};
	
	usb3_1_phy: usb3_1_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_1_vbus>;
	};

	reg_usb3_0_vbus: usb3-vbus0 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus0";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci0_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>;
	};

	reg_usb3_1_vbus: usb3-vbus1 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus1";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci1_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
	};
/*
	reg_sata0: pwr-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
	};

	reg_5v_sata0: v5-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "v5.0-sata0";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&reg_sata0>;
	};

	reg_12v_sata0: v12-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "v12.0-sata0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		vin-supply = <&reg_sata0>;
	};
	
	reg_sata1: pwr-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>;
	};

	reg_5v_sata1: v5-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "v5.0-sata1";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&reg_sata1>;
	};

	reg_12v_sata1: v12-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "v12.0-sata1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		vin-supply = <&reg_sata1>;
	};
	*/
};
/*
&ahci0 {
	status = "okay";
};

&ahci1 {
	status = "okay";
};
*/

&cesa {
	status = "okay";
};

&bm {
	status = "okay";
};

&bm_bppi {
	status = "okay";
};
Attachments:
open | download - config-less-5Mb (188.2 KB)
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 08:42AM
Hi bodhi,

I used the patch from Evgeny Kolesnikov with some minor modifications to make the DTS file for my Ex2 Ultra
https://lkml.org/lkml/2019/7/22/1053

Just build it with your 5.5.3 kernel and boot the new uImage from USB. Many thanks to your work.
Attachments:
open | download - armada-385-wdmc-Ex2-Ultra.dts (8.1 KB)
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 09:01AM
Quote
You can try to assign another memory location for the uRamdisk, please try at 0x2000000

Yes, that worked!

I will try now your instructions to make it persistent. But what is the reason for
Quote
overlaps in-use memory region - disabling initrd

Does it mean that Kernel is still too big? Or I need to make uRamdisk smaller? Or the only solution is to patch the U-Boot?
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 10:02AM
Hi vzhilov,

Quote
Does it mean that Kernel is still too big? Or I need to make uRamdisk smaller? Or the only solution is to patch the U-Boot?

I currently don't have enough time to find out what exactly it is, but there is another discussion about the same problem in the forum. Take a look at here, maybe you can fix it, I would be glad to hear back from you.
https://forum.doozan.com/read.php?2,85284,85534#msg-85534

To save your time for building custom u-boot, you can use the u-boot patch in attachment.

Btw: thanks for your kernel config file, I just tested it and have the same problem when uRamdisk locales at 0xf00000, otherwise seems like everything works fine.
Attachments:
open | download - GrandTeton-20170708.patch (3.2 KB)
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 01:43PM
Ok, I gave up trying to squize evertying into nand and decided to boot from flash drive as all you guys do.

When I boot from USB with reset button pressed I get kernel panic with

VFS: Cannot open root device "ram" on unknown-block(1,0)

But I still can boot with

usb start
fatload usb 0:1 0xa00000 boot\uImage
fatload usb 0:1 0x2000000 boot\uRamdisk
bootm 0xa00000 0x2000000

So it seems like it is not problem of lack of free space in nand.

Is that what the patch needed for to fix that?

Do we loose any performance speed choosing USB vs NAND partitions?



Edited 1 time(s). Last edit at 04/08/2020 02:42PM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 03:25PM
Quote
vzhilov
Does it mean that Kernel is still too big? Or I need to make uRamdisk smaller? Or the only solution is to patch the U-Boot?

Yes, it is the only solution.
In short, the stock uboot is missing the saveenv command. Also, if it was available would store the settings over the kernel.
read my post for details: https://forum.doozan.com/read.php?2,28939,98649#msg-98649

please note that I use 0x2000020 in my env because at 0x2000000 is loaded the device mac.

also, take a look to my latest dts, it contains some fixes

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Device Tree file for Western Digital My Cloud Expert Series EX2 Ultra
 * (BVBZ/Ranger Peak)
 *
 * Copyright (C) 2020
 *
 * Based on the code from:
 *
 * Copyright (C) 2019 Evgeny Kolesnikov <evgenyz@gmail.com>
 * Copyright (C) 2016 Martin Mueller <mm@sig21.net>
 * Copyright (C) 2013 Gregory CLEMENT <gregory.clement@free-electrons.com>
 * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 *
 */

/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"

/ {
	model = "My Cloud Expert Series EX2 Ultra (BVBZ/Ranger Peak)";
	compatible = "wd,mcex2u", "marvell,armada385", "marvell,armada380";

	chosen {
		stdout-path = "console=ttyS0,115200 root=LABEL=rootfs earlyprintk";
	};

	memory {
		device_type = "memory";
		reg = <0x00000000 0x40000000>; /* 1024 MB */
	};

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000        /* CESA0: PHYS=0xf1100000 size 64K */
			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000        /* CESA1: PHYS=0xf1110000 */
			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000       /*    BM: PHYS=0xf1200000 size 1M */
			  MBUS_ID(0x0b, 0x04) 0 0xf1300000 0x100000>;     /*   PNC: PHYS=0xf1300000 size 1M */

		internal-regs {
			timer@c200 {
				status = "okay";
			};

			i2c@11000 {
				status = "disabled";
			};

			i2c@11100 {
				status = "disabled";
			};

			uart0: serial@12000 {
				status = "okay";
			};

			/* Connected to Welltrend 6703F-OG240WT MCU
			 * which controls power, fan and other things
			 */
			uart1: serial@12100 {
				status = "okay";
			};

			poweroff@12100 {
				compatible = "uart-poweroff";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 01 00 00 fb];
				status = "okay";
			};

			restart@12100 {
				compatible = "uart-restart";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 02 00 00 fb];
				override;
				status = "okay";
			};
			
			pinctrl: pinctrl@18000 {
				xhci0_vbus_pins: xhci0-vbus-pins {
					marvell,pins = "mpp26";
					marvell,function = "gpio";
				};

				xhci1_vbus_pins: xhci1-vbus-pins {
					marvell,pins = "mpp27";
					marvell,function = "gpio";
				};

				sata0_pins: sata-pins-0 {
					marvell,pins = "mpp55";
					marvell,function = "gpio";
				};

				sata1_pins: sata-pins-1 {
					marvell,pins = "mpp56";
					marvell,function = "gpio";
				};

				sata_leds: sata-leds {
					marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54", "mpp48", "mpp58";
					marvell,function = "gpio";
				};

				btn_pins: btn-pins {
					marvell,pins = "mpp50";
					marvell,function = "gpio";
				};
			};

			usb0: usb@58000 {
				status = "okay";
			};

			eth2: ethernet@34000 {
				status = "okay";
				phy = <&phy0>;
				phy-mode = "sgmii";
				buffer-manager = <&bm>;
				bm,pool-long = <0>;
				bm,pool-short = <1>;
			};

			mdio: mdio@72004 {
				phy0: ethernet-phy@0 {
					/* Init ETH LEDs */
					marvell,reg-init = <3 16 0 0x101e>;
					reg = <0>;
				};
			};

			cesa: crypto@90000 {
				status = "okay";
			};

			rtc: rtc@a3800 {
				status = "okay";
			};

			ahci0: sata@a8000 {
				pinctrl-names = "default";
				pinctrl-0 = <&sata0_pins>, <&sata1_pins>;
				status = "okay";
				#address-cells = <1>;
				#size-cells = <0>;

				sata0: sata-port@0 {
					reg = <0>;
					target-supply = <&reg_sata0>;
				};

				sata1: sata-port@1 {
					reg = <1>;
					target-supply = <&reg_sata1>;
				};

			};

			bm: bm@c8000 {
				status = "okay";
			};

			nand_controller: nand-controller@d0000 {
				status = "okay";

				nand: nand@0 {
					reg = <0>;
					label = "pxa3xx_nand-0";
					nand-rb = <0>;
					marvell,nand-keep-config;
					#marvell,nand-enable-arbiter; //optional
					nand-on-flash-bbt;
					nand-ecc-strength = <4>;
					nand-ecc-step-size = <512>;

					partitions {
						compatible = "fixed-partitions";
						#address-cells = <1>;
						#size-cells = <1>;

						partition@00000000 {
							label = "U-Boot";
							reg = <0x00000000 0x00500000>;    /*   5 MB */
							read-only;
						};

						partition@00500000 {
							label = "uImage";
							reg = <0x00500000 0x00500000>;    /*   5 MB */
						};

						partition@00a00000 {
							label = "uRamdisk";
							reg = <0x00a00000 0x00500000>;    /*   5 MB */
						};
							
						partition@00f00000 {
							label = "image.cfs";
							reg = <0x00f00000 0x0b900000>;    /* 185 MB */
						};

						partition@c800000 {
							label = "rescue fw";
							reg = <0x0c800000 0x00f00000>;    /*  15 MB */
						};
							
						partition@d70000 {
							label = "config";
							reg = <0x0d700000 0x01400000>;    /*  20 MB */
						};
							
						partition@eb00000 {
							label = "reserve1";
							reg = <0x0eb00000 0x00a00000>;    /*  10 MB */
						};
							
						partition@f500000 {
							label = "reserve2";
							reg = <0x0f500000 0x00a00000>;    /*  10 MB */
						};
					};
				};
			};

			usb3_0: usb3@f0000 {
				usb-phy = <&usb3_0_phy>;
				status = "okay";
			};

			usb3_1: usb3@f8000 {
				usb-phy = <&usb3_1_phy>;
				status = "okay";
			};
		};

		bm_bppi: bm-bppi {
			status = "okay";
		};
	};

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

		sata1-red-led {
			label = "wdmcex2u:red:hdd1";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata2-red-led {
			label = "wdmcex2u:red:hdd2";
			gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata1-blue-led {
			label = "wdmcex2u:blue:hdd1";
			gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
		sata2-blue-led {
			label = "wdmcex2u:blue:hdd2";
			gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
	};

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

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;  // Restart=0x198, Power=0x116
			gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
			debounce-interval = <60>;
			wakeup-source;
		};
	};

	usb3_0_phy: usb3_0_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_0_vbus>;
	};

	usb3_1_phy: usb3_1_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_1_vbus>;
	};

	reg_usb3_0_vbus: usb3-vbus0 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus0";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci0_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>;
	};

	reg_usb3_1_vbus: usb3-vbus1 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus1";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci1_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
	};

	reg_sata0: pwr-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
	};
	
	reg_sata1: pwr-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>;
	};
};

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Device Tree file for Western Digital My Cloud Mirror Gen 2
 * (BWVZ/Grand Teton)
 *
 * Copyright (C) 2020
 *
 * Based on the code from:
 *
 * Copyright (C) 2019 Evgeny Kolesnikov <evgenyz@gmail.com>
 * Copyright (C) 2016 Martin Mueller <mm@sig21.net>
 * Copyright (C) 2013 Gregory CLEMENT <gregory.clement@free-electrons.com>
 * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 *
 */

/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"

/ {
	model = "WD MyCloud Mirror Gen 2 (BWVZ/Grand Teton)";
	compatible = "wd,mcmg2", "marvell,armada385", "marvell,armada380";

	chosen {
		stdout-path = "console=ttyS0,115200";
	};

	memory {
		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, 0x19) 0 0xf1100000 0x10000        /* CESA0: PHYS=0xf1100000 size 64K */
			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000        /* CESA1: PHYS=0xf1110000 */
			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000       /*    BM: PHYS=0xf1200000 size 1M */
			  MBUS_ID(0x0b, 0x04) 0 0xf1300000 0x100000>;     /*   PNC: PHYS=0xf1300000 size 1M */

		internal-regs {
			timer@c200 {
				status = "okay";
			};

			i2c@11000 {
				status = "disabled";
			};

			i2c@11100 {
				status = "disabled";
			};

			uart0: serial@12000 {
				status = "okay";
			};

			/* Connected to Welltrend 6703F-OG240WT MCU
			 * which controls power, fan and other things
			 */
			uart1: serial@12100 {
				status = "okay";
			};

			poweroff@12100 {
				compatible = "uart-poweroff";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 01 00 00 fb];
				status = "okay";
			};

			restart@12100 {
				compatible = "uart-restart";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 02 00 00 fb];
				override;
				status = "okay";
			};
			
			pinctrl: pinctrl@18000 {
				xhci0_vbus_pins: xhci0-vbus-pins {
					marvell,pins = "mpp26";
					marvell,function = "gpio";
				};

				xhci1_vbus_pins: xhci1-vbus-pins {
					marvell,pins = "mpp27";
					marvell,function = "gpio";
				};

				sata0_pins: sata-pins-0 {
					marvell,pins = "mpp55";
					marvell,function = "gpio";
				};

				sata1_pins: sata-pins-1 {
					marvell,pins = "mpp56";
					marvell,function = "gpio";
				};

				sata_leds: sata-leds {
					marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54", "mpp48", "mpp58";
					marvell,function = "gpio";
				};

				btn_pins: btn-pins {
					marvell,pins = "mpp50";
					marvell,function = "gpio";
				};
			};

			usb0: usb@58000 {
				status = "okay";
			};

			eth2: ethernet@34000 {
				status = "okay";
				phy = <&phy0>;
				phy-mode = "sgmii";
				buffer-manager = <&bm>;
				bm,pool-long = <0>;
				bm,pool-short = <1>;
			};

			mdio: mdio@72004 {
				phy0: ethernet-phy@0 {
					/* Init ETH LEDs */
					marvell,reg-init = <3 16 0 0x101e>;
					reg = <0>;
				};
			};

			cesa: crypto@90000 {
				status = "okay";
			};

			rtc: rtc@a3800 {
				status = "okay";
			};

			ahci0: sata@a8000 {
				pinctrl-names = "default";
				pinctrl-0 = <&sata0_pins>, <&sata1_pins>;
				status = "okay";
				#address-cells = <1>;
				#size-cells = <0>;

				sata0: sata-port@0 {
					reg = <0>;
					target-supply = <&reg_sata0>;
				};

				sata1: sata-port@1 {
					reg = <1>;
					target-supply = <&reg_sata1>;
				};

			};

			bm: bm@c8000 {
				status = "okay";
			};

			nand_controller: nand-controller@d0000 {
				status = "okay";

				nand: nand@0 {
					reg = <0>;
					label = "pxa3xx_nand-0";
					nand-rb = <0>;
					marvell,nand-keep-config;
					#marvell,nand-enable-arbiter; //optional
					nand-on-flash-bbt;
					nand-ecc-strength = <4>;
					nand-ecc-step-size = <512>;

					partitions {
						compatible = "fixed-partitions";
						#address-cells = <1>;
						#size-cells = <1>;

						partition@00000000 {
							label = "U-Boot";
							reg = <0x00000000 0x00500000>;    /*   5 MB */
							read-only;
						};

						partition@00500000 {
							label = "uImage";
							reg = <0x00500000 0x00500000>;    /*   5 MB */
						};

						partition@00a00000 {
							label = "uRamdisk";
							reg = <0x00a00000 0x00500000>;    /*   5 MB */
						};
							
						partition@00f00000 {
							label = "image.cfs";
							reg = <0x00f00000 0x0b900000>;    /* 185 MB */
						};

						partition@c800000 {
							label = "rescue fw";
							reg = <0x0c800000 0x00f00000>;    /*  15 MB */
						};
							
						partition@d70000 {
							label = "config";
							reg = <0x0d700000 0x01400000>;    /*  20 MB */
						};
							
						partition@eb00000 {
							label = "reserve1";
							reg = <0x0eb00000 0x00a00000>;    /*  10 MB */
						};
							
						partition@f500000 {
							label = "reserve2";
							reg = <0x0f500000 0x00a00000>;    /*  10 MB */
						};
					};
				};
			};

			usb3_0: usb3@f0000 {
				usb-phy = <&usb3_0_phy>;
				status = "okay";
			};

			usb3_1: usb3@f8000 {
				usb-phy = <&usb3_1_phy>;
				status = "okay";
			};
		};

		bm_bppi: bm-bppi {
			status = "okay";
		};
	};

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

		sata1-red-led {
			label = "wdmcmg2:red:hdd1";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata2-red-led {
			label = "wdmcmg2:red:hdd2";
			gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata1-blue-led {
			label = "wdmcmg2:blue:hdd1";
			gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
		sata2-blue-led {
			label = "wdmcmg2:blue:hdd2";
			gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
	};

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

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;  // Restart=0x198, Power=0x116
			gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
			debounce-interval = <60>;
			wakeup-source;
		};
	};

	usb3_0_phy: usb3_0_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_0_vbus>;
	};

	usb3_1_phy: usb3_1_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_1_vbus>;
	};

	reg_usb3_0_vbus: usb3-vbus0 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus0";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci0_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>;
	};

	reg_usb3_1_vbus: usb3-vbus1 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus1";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci1_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
	};

	reg_sata0: pwr-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
	};
	
	reg_sata1: pwr-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>;
	};
};
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 04:05PM
Thank you.

Ok, I will take your last version of .dts file for Ex2-Ultra, config from @bodhi and will recompile the kernel again.

Do I have to do below before I compile:

patch -p1 -d linux-stable < GrandTeton-20170708.patch

to patch U-Boot and unblock `setev`?

For the uRamdisk I still would like to have Busybox with minimal setup which only decrypts the HDDs and switches the boot process over there. So it goes Kernel (USB or NAND) -> Ramdisk (USB or NAND) -> Encrypted Rootfs (HDD). I would like to leave uncencrypted as less as possible. This is how it was working with the old 4.14 kernel for me.



Edited 7 time(s). Last edit at 04/08/2020 04:20PM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 05:10PM
With your kernel config, I just built an uImage less than 5MB and successfully boot it without USB or repartition mtdparts. The only thing I changed was "bootcmd" variable as following, also stock "bootcmd" at 0xa00000 0xf00000 does not work.
setenv bootcmd 'nand read.e 0x02000020 0x0500000 0x0500000; nand read.e 0x2900000 0x0a00000 0x0500000; bootm 0x02000020 0x2900000'
saveenv

Quote
When I boot from USB with reset button pressed I get kernel panic with ...
If you plan to boot from USB, you also need to change the boot environment. An example is from the post of CyberPK as following:
setenv set_bootargs_stock 'setenv bootargs root=/dev/ram console=ttyS0,115200'
setenv bootcmd_stock 'echo Booting from stock ... ; run set_bootargs_stock; printenv bootargs; nand read.e 0xa00000 0x500000 0x500000;nand read.e 0xf00000 0xa00000 0x500000;bootm 0xa00000 0xf00000'
setenv bootdev 'usb'
setenv device '0:1'
setenv load_image_addr '0x02000020'
setenv load_initrd_addr '0x2900000'
setenv load_image 'echo loading Image ...; ext2load $bootdev $device $load_image_addr /boot/uImage'
setenv load_initrd 'echo loading uInitrd ...; ext2load $bootdev $device $load_initrd_addr /boot/uInitrd'

setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial init=/bin/systemd"'
setenv bootcmd_usb 'echo Booting from USB ...; usb start; run usb_set_bootargs; if run load_image; then if run load_initrd; then bootm $load_image_addr $load_initrd_addr; else bootm $load_image_addr; fi; fi; usb stop'
setenv bootcmd 'setenv fdt_skip_update yes; setenv usbActive 0; run bootcmd_usb; setenv usbActive 1; run bootcmd_usb; setenv fdt_skip_update no; run bootcmd_stock; reset'

saveenv
reset
This will first try to boot from the USB if there is one, otherwise from NAND.
Have a look at the new DTS from me or from CyberPK, the DTS from Fox seems too old.

To build your uboot, download the GPL Software from WD Website, e.g. here
https://downloads.wdc.com/gpl/WDMyCloud_Ex2Ultra_GPL_v2.31.204_20191206.tar.gz

Extract WDMyCloud_Ex2Ultra_GPL_v2.31.204_20191206.tar.gz
You need 2 folders "u-boot" and "toolchain"
Go to "u-boot" and extract "u-boot-2013.01-2014_T3.0p2.tar.gz"
Go to "toolchain" and extract "armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002.tar.gz"
Change variable PATH in u-boot/u-boot-2013.01-2014_T3.0p2/xbuid.sh to correct path of "armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin"
For x64: sudo apt install gcc-multilib
cp GrandTeton-20170708.patch u-boot/u-boot-2013.01-2014_T3.0p2
cd u-boot/u-boot-2013.01-2014_T3.0p2
patch -p1 < GrandTeton-20170708.patch
sudo ./xbuid.sh build
Or use my patched u-boot for my EX2 Ultra at the attachment.


For full details see the post of CyberPK at
https://forum.doozan.com/read.php?2,28939,98649#msg-98649. All credits goes to him.



Edited 4 time(s). Last edit at 04/08/2020 05:26PM by dtd.2512.
Attachments:
open | download - u-boot-a38x-RangerPeak_2014T3_PQ-nand_1G.bin (935.7 KB)
Re: Debian on WD MyCloud EX2 Ultra
April 08, 2020 05:31PM
All,

Quote

overlaps in-use memory region - disabling initrd

This means the load address for uInitrd needs adjustment to another location.

We are running this box with stock u-boot. So the memory relocation does not work right. Often time the load addresses of uImage and uInitrd need to be figured out to load them sucessfully. uImage is easy, since stock has a good load address for that. For uInitrd, because we are running newer kernel, the stock location is no longer appropriate.

It sounds like CyberPK and dtd have figured out a good location for uInitrd.

Quote

VFS: Cannot open root device "ram" on unknown-block(1,0)

The above is because the root device in bootargs. When you boot with USB or HDD rootfs, use
root=LABEL=rootfs
And then label your rootfs partition rootfs. This way the kernel always knows where the system rootfs is and mount it successfully. I believe CyberPK and dtd already using that.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 07:16AM
Quote
Have a look at the new DTS from me or from CyberPK, the DTS from Fox seems too old.

I jave tried to make your new .dts file, but I get an error. As I understood here is the new .dts file:


// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Device Tree file for Western Digital My Cloud Expert Series EX2 Ultra
 * (BVBZ/Ranger Peak)
 *
 * Copyright (C) 2020
 *
 * Based on the code from:
 *
 * Copyright (C) 2019 Evgeny Kolesnikov <evgenyz@gmail.com>
 * Copyright (C) 2016 Martin Mueller <mm@sig21.net>
 * Copyright (C) 2013 Gregory CLEMENT <gregory.clement@free-electrons.com>
 * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 *
 */

/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "armada-385.dtsi"

/ {
	model = "My Cloud Expert Series EX2 Ultra (BVBZ/Ranger Peak)";
	compatible = "wd,mcex2u", "marvell,armada385", "marvell,armada380";

	chosen {
		stdout-path = "console=ttyS0,115200 root=LABEL=rootfs earlyprintk";
	};

	memory {
		device_type = "memory";
		reg = <0x00000000 0x40000000>; /* 1024 MB */
	};

	soc {
		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
			  MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000        /* CESA0: PHYS=0xf1100000 size 64K */
			  MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000        /* CESA1: PHYS=0xf1110000 */
			  MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000       /*    BM: PHYS=0xf1200000 size 1M */
			  MBUS_ID(0x0b, 0x04) 0 0xf1300000 0x100000>;     /*   PNC: PHYS=0xf1300000 size 1M */

		internal-regs {
			timer@c200 {
				status = "okay";
			};

			i2c@11000 {
				status = "disabled";
			};

			i2c@11100 {
				status = "disabled";
			};

			uart0: serial@12000 {
				status = "okay";
			};

			/* Connected to Welltrend 6703F-OG240WT MCU
			 * which controls power, fan and other things
			 */
			uart1: serial@12100 {
				status = "okay";
			};

			poweroff@12100 {
				compatible = "uart-poweroff";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 01 00 00 fb];
				status = "okay";
			};

			restart@12100 {
				compatible = "uart-restart";
				reg = <0x12100 0x100>;
				clocks = <&coreclk 0>;
				baud = <19200>;
				cmd = [fa 03 03 02 00 00 fb];
				override;
				status = "okay";
			};
			
			pinctrl: pinctrl@18000 {
				xhci0_vbus_pins: xhci0-vbus-pins {
					marvell,pins = "mpp26";
					marvell,function = "gpio";
				};

				xhci1_vbus_pins: xhci1-vbus-pins {
					marvell,pins = "mpp27";
					marvell,function = "gpio";
				};

				sata0_pins: sata-pins-0 {
					marvell,pins = "mpp55";
					marvell,function = "gpio";
				};

				sata1_pins: sata-pins-1 {
					marvell,pins = "mpp56";
					marvell,function = "gpio";
				};

				sata_leds: sata-leds {
					marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54", "mpp48", "mpp58";
					marvell,function = "gpio";
				};

				btn_pins: btn-pins {
					marvell,pins = "mpp50";
					marvell,function = "gpio";
				};
			};

			usb0: usb@58000 {
				status = "okay";
			};

			eth2: ethernet@34000 {
				status = "okay";
				phy = <&phy0>;
				phy-mode = "sgmii";
				buffer-manager = <&bm>;
				bm,pool-long = <0>;
				bm,pool-short = <1>;
			};

			mdio: mdio@72004 {
				phy0: ethernet-phy@0 {
					/* Init ETH LEDs */
					marvell,reg-init = <3 16 0 0x101e>;
					reg = <0>;
				};
			};

			cesa: crypto@90000 {
				status = "okay";
			};

			rtc: rtc@a3800 {
				status = "okay";
			};

			ahci0: sata@a8000 {
				pinctrl-names = "default";
				pinctrl-0 = <&sata0_pins>, <&sata1_pins>;
				status = "okay";
				#address-cells = <1>;
				#size-cells = <0>;

				sata0: sata-port@0 {
					reg = <0>;
					target-supply = <&reg_sata0>;
				};

				sata1: sata-port@1 {
					reg = <1>;
					target-supply = <&reg_sata1>;
				};

			};

			bm: bm@c8000 {
				status = "okay";
			};

			nand_controller: nand-controller@d0000 {
				status = "okay";

				nand: nand@0 {
					reg = <0>;
					label = "pxa3xx_nand-0";
					nand-rb = <0>;
					marvell,nand-keep-config;
					#marvell,nand-enable-arbiter; //optional
					nand-on-flash-bbt;
					nand-ecc-strength = <4>;
					nand-ecc-step-size = <512>;

					partitions {
						compatible = "fixed-partitions";
						#address-cells = <1>;
						#size-cells = <1>;

						partition@00000000 {
							label = "U-Boot";
							reg = <0x00000000 0x00500000>;    /*   5 MB */
							read-only;
						};

						partition@00500000 {
							label = "uImage";
							reg = <0x00500000 0x00500000>;    /*   5 MB */
						};

						partition@00a00000 {
							label = "uRamdisk";
							reg = <0x00a00000 0x00500000>;    /*   5 MB */
						};
							
						partition@00f00000 {
							label = "image.cfs";
							reg = <0x00f00000 0x0b900000>;    /* 185 MB */
						};

						partition@c800000 {
							label = "rescue fw";
							reg = <0x0c800000 0x00f00000>;    /*  15 MB */
						};
							
						partition@d70000 {
							label = "config";
							reg = <0x0d700000 0x01400000>;    /*  20 MB */
						};
							
						partition@eb00000 {
							label = "reserve1";
							reg = <0x0eb00000 0x00a00000>;    /*  10 MB */
						};
							
						partition@f500000 {
							label = "reserve2";
							reg = <0x0f500000 0x00a00000>;    /*  10 MB */
						};
					};
				};
			};

			usb3_0: usb3@f0000 {
				usb-phy = <&usb3_0_phy>;
				status = "okay";
			};

			usb3_1: usb3@f8000 {
				usb-phy = <&usb3_1_phy>;
				status = "okay";
			};
		};

		bm_bppi: bm-bppi {
			status = "okay";
		};
	};

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

		sata1-red-led {
			label = "wdmcex2u:red:hdd1";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata2-red-led {
			label = "wdmcex2u:red:hdd2";
			gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
			default-state = keep;
			panic-indicator;
		};
		sata1-blue-led {
			label = "wdmcex2u:blue:hdd1";
			gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
		sata2-blue-led {
			label = "wdmcex2u:blue:hdd2";
			gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
			default-state = keep;
		};
	};

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

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;  // Restart=0x198, Power=0x116
			gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
			debounce-interval = <60>;
			wakeup-source;
		};
	};

	usb3_0_phy: usb3_0_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_0_vbus>;
	};

	usb3_1_phy: usb3_1_phy {
		compatible = "usb-nop-xceiv";
		vcc-supply = <&reg_usb3_1_vbus>;
	};

	reg_usb3_0_vbus: usb3-vbus0 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus0";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci0_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>;
	};

	reg_usb3_1_vbus: usb3-vbus1 {
		compatible = "regulator-fixed";
		regulator-name = "usb3-vbus1";
		pinctrl-names = "default";
		pinctrl-0 = <&xhci1_vbus_pins>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		regulator-always-on;
		gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
	};

	reg_sata0: pwr-sata0 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
	};
	
	reg_sata1: pwr-sata1 {
		compatible = "regulator-fixed";
		regulator-name = "pwr_en_sata1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		enable-active-high;
		regulator-boot-on;
		gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>;
	};
};


And here is what I get:

user@rdshost:~/linux-stable$ make armada-385-wdmc-Ex2-Ultra.dtb
  DTC     arch/arm/boot/dts/armada-385-wdmc-Ex2-Ultra.dtb
Error: arch/arm/boot/dts/armada-385-wdmc-Ex2-Ultra.dts:257.20-21 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:285: recipe for target 'arch/arm/boot/dts/armada-385-wdmc-Ex2-Ultra.dtb' failed
make[1]: *** [arch/arm/boot/dts/armada-385-wdmc-Ex2-Ultra.dtb] Error 1
Makefile:1240: recipe for target 'armada-385-wdmc-Ex2-Ultra.dtb' failed
make: *** [armada-385-wdmc-Ex2-Ultra.dtb] Error 2

While I don't see anything wrong in those lines:

		sata1-red-led {
			label = "wdmcex2u:red:hdd1";
			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
257			default-state = keep;
			panic-indicator;
		};



Edited 3 time(s). Last edit at 04/09/2020 07:49AM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 09:03AM
Ah, Ok. I got it. It should be in quotes.

257			default-state = "keep";
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 10:02AM
Ok, we have updated .dts file and kernel.config and with all that we can build uImage lesser then 5Mb. So it fits to NAND and can be booted from there.

In this case it would be really good to have uInitrd in NAND too, avoiding booting from USB drive.

Do I have to flash u-boot anyway?

Just to test it, if I do:

setenv bootcmd 'nand read.e 0x02000020 0x0500000 0x0500000; nand read.e 0x2900000 0x0a00000 0x0500000; bootm 0x02000020 0x2900000'
boot

I get:

NAND read: device 0 offset 0x500000, size 0xfb00000
Attempt to read outside the flash area
 0 bytes read: ERROR

NAND read: device 0 offset 0xa00000, size 0x500000
 5242880 bytes read: OK

And then it boots a recovery image
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 12:19PM
Quote
vzhilov
Ah, Ok. I got it. It should be in quotes.

257			default-state = "keep";


Yes, sorry. My mistake. I've copied an old version containing only this stupid error



Edited 1 time(s). Last edit at 04/09/2020 12:24PM by CyberPK.
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 01:15PM
Before flashing the custom u-boot I would like to understand all the steps.

If I do:

usb start
fatload usb 0:1 0xa00000 uImage
fatload usb 0:1 0x2000020 uInitrd
bootm 0xa00000 0x2000020

I can boot with Kernel 5.5.3 (4.9Mb) and my uInitrd. So those are the locatations which were choosed by @CyberPK and @dtd and approved by @bodhi.

But if I reboot and put just:

bootm 0xa00000 0x2000020

assuming the images are already in memory, I get nothing.

How do I flash uImage and uInitrd to those addresses permanatly so the below bootcmd var work?

setenv bootcmd 'nand read.e 0x02000020 0x0500000 0x0500000; nand read.e 0x2900000 0x0a00000 0x0500000; bootm 0x02000020 0x2900000'

I usually do

dd if=/dev/zero of=/dev/mtdblock1
dd if=uImage of=/dev/mtdblock1
dd if=/dev/zero of=/dev/mtdblock2
dd if=uInitrd of=/dev/mtdblock2

If we need to put it to different place now in order to boot, how do I do that?



Edited 5 time(s). Last edit at 04/09/2020 04:06PM by vzhilov.
Re: Debian on WD MyCloud EX2 Ultra
April 09, 2020 07:35PM
I think you got confused between NAND and memory.

usb start
fatload usb 0:1 0xa00000 uImage
fatload usb 0:1 0x2000020 uInitrd
bootm 0xa00000 0x2000020
This will load uImage from USB into memory at address 0xa00000 and uInitrd at address 0x2000020. Then it will start to boot (bootm = boot from memory)

Quote
vzhilov
But if I reboot and put just:
bootm 0xa00000 0x2000020
assuming the images are already in memory, I get nothing.
Did you mean: the image and ramdisk are already in NAND? If yes then they must be first loaded into memory, because after reboot, memory is clear.

setenv bootcmd 'nand read.e 0x02000020 0x0500000 0x0500000; nand read.e 0x2900000 0x0a00000 0x0500000; bootm 0x02000020 0x2900000'
nand read.e 0x2900000 0x0a00000 0x0500000
means: read from NAND at address 0x0a00000 into memory at address 0x2900000 (size=0x0500000=5MB)
Address 0x0a00000 is where the uRamdisk located in NAND.
nand read.e 0x02000020 0x0500000 0x0500000;
Analogously, load uImage from NAND into memory.
bootm 0x02000020 0x2900000
Start booting after loaded.


In short, what you need to do are:
1. Flash custom uboot to enable "saveenv"
2. Flash your new uImage and uRamdisk
3. Set and save your "bootcmd" like this
setenv bootcmd 'nand read.e 0x02000020 0x0500000 0x0500000; nand read.e 0x2900000 0x0a00000 0x0500000; bootm 0x02000020 0x2900000'
saveenv
reset

Flashing by using "dd" in linux or "nand write" in u-boot doesn't matter. The key is you need to overwrite "bootcmd", because with stock uboot it always boots at 0xa00000 0xf00000 <<< and kernel 5.5.3 doesn't work with these 2 addresses.

That is all.
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: