Could I possibly install openwrt to a NAS, and use it as a NAS?

I got this Asustor AS-1002T. It uses marvel armada 385. There are a few images for openwrt, although for other models but, can I possibly boot them from ram to test them, without damaging the nand inside right? I just want to experiment some. I got serial access to this device. I said why not try this? It could be fun.

It's original firmware is not flashable from the u-boot inside, so I wanna try this. I picked a marvel armada 385 one, an initramfs image, it kinda worked but can't reach to it. Networking didn't work. I tried this image, it almost worked but networking didn't work: openwrt-23.05.3-mvebu-cortexa9-marvell_a385-db-ap-initramfs-kernel.bin
I tried also this but it didn't even load the kernel: openwrt-23.05.3-mvebu-cortexa9-marvell_a385-db-ap-initramfs-kernel.bin

Bootlog is here:

dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.15.150 (builder@buildhost) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 12.3.0 r23809-234f1a2efa) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Fri Mar 22 22:09:42 2024
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Marvell Armada 385 Reference Design
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] percpu: Embedded 12 pages/cpu s17420 r8192 d23540 u49152
[    0.000000] pcpu-alloc: s17420 r8192 d23540 u49152 alloc=12*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: 
[    0.000000] Bootloader command line not present
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 240120K/262144K available (8192K kernel code, 644K rwdata, 1164K rodata, 8192K init, 245K bss, 22024K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] L2C: DT/platform modifies aux control register: 0x06070000 -> 0x16070000
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 D prefetch enabled, offset 1 lines
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 Coherent cache controller enabled, 16 ways, 1024 kB
[    0.000000] L2C-310 Coherent: CACHE_ID 0x410054c9, AUX_CTRL 0x56070001
[    0.000001] sched_clock: 64 bits at 533MHz, resolution 1ns, wraps every 2199023255551ns
[    0.000024] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x7aed16d152, max_idle_ns: 440795225656 ns
[    0.000045] Switching to timer-based delay loop, resolution 1ns
[    0.000213] Ignoring duplicate/late registration of read_current_timer delay
[    0.000222] clocksource: armada_370_xp_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
[    0.000409] Calibrating delay loop (skipped), value calculated using timer frequency.. 1066.00 BogoMIPS (lpj=5330000)
[    0.000422] CPU: Testing write buffer coherency: ok
[    0.000443] CPU0: Spectre v2: using BPIALL workaround
[    0.000450] pid_max: default: 32768 minimum: 301
[    0.000925] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000937] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001950] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002389] Setting up static identity map for 0x100000 - 0x100060
[    0.002496] mvebu-soc-id: MVEBU SoC ID=0x6820, Rev=0x4
[    0.002605] mvebu-pmsu: Initializing Power Management Service Unit
[    0.002706] rcu: Hierarchical SRCU implementation.
[    0.002911] smp: Bringing up secondary CPUs ...
[    0.003160] Booting CPU 1
[    0.003474] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.003483] CPU1: Spectre v2: using BPIALL workaround
[    0.003564] smp: Brought up 1 node, 2 CPUs
[    0.003574] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
[    0.003582] CPU: All CPU(s) started in SVC mode.
[    0.005922] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.006018] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.006034] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.006208] pinctrl core: initialized pinctrl subsystem
[    0.007091] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.007826] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.008480] thermal_sys: Registered thermal governor 'step_wise'
[    0.008658] cpuidle: using governor ladder
[    0.008811] mvebu-pmsu: CPU hotplug support is currently broken on Armada 38x: disabling
[    0.008822] mvebu-pmsu: CPU idle is currently broken on Armada 38x: disabling
[    0.018348] cryptd: max_cpu_qlen set to 1000
[    0.019866] SCSI subsystem initialized
[    0.019968] libata version 3.00 loaded.
[    0.020116] usbcore: registered new interface driver usbfs
[    0.020148] usbcore: registered new interface driver hub
[    0.020186] usbcore: registered new device driver usb
[    0.021009] clocksource: Switched to clocksource arm_global_timer
[    0.021731] NET: Registered PF_INET protocol family
[    0.021837] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.022267] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.022292] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.022302] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.022323] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.022353] TCP: Hash tables configured (established 2048 bind 2048)
[    0.022412] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.022437] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.022604] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.022627] PCI: CLS 0 bytes, default 64
[    0.032282] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.036262] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.036286] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.037549] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.039493] armada-38x-pinctrl f1018000.pinctrl: registered pinctrl driver
[    0.040226] debugfs: Directory 'f1018100.gpio' with parent 'regmap' already present!
[    0.040589] debugfs: Directory 'f1018140.gpio' with parent 'regmap' already present!
[    0.040943] mvebu-pcie soc:pcie: host bridge /soc/pcie ranges:
[    0.040978] mvebu-pcie soc:pcie:      MEM 0x00f1080000..0x00f1081fff -> 0x0000080000
[    0.041068] mvebu-pcie soc:pcie:      MEM 0x00f1040000..0x00f1041fff -> 0x0000040000
[    0.041092] mvebu-pcie soc:pcie:      MEM 0x00f1044000..0x00f1045fff -> 0x0000044000
[    0.041112] mvebu-pcie soc:pcie:      MEM 0x00f1048000..0x00f1049fff -> 0x0000048000
[    0.041129] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0100000000
[    0.041146] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0100000000
[    0.041163] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0200000000
[    0.041179] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0200000000
[    0.041196] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0300000000
[    0.041212] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0300000000
[    0.041229] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0400000000
[    0.041242] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0400000000
[    0.041436] mvebu-pcie soc:pcie: PCI host bridge to bus 0000:00
[    0.041448] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.041460] pci_bus 0000:00: root bus resource [mem 0xf1080000-0xf1081fff] (bus address [0x00080000-0x00081fff])
[    0.041471] pci_bus 0000:00: root bus resource [mem 0xf1040000-0xf1041fff] (bus address [0x00040000-0x00041fff])
[    0.041481] pci_bus 0000:00: root bus resource [mem 0xf1044000-0xf1045fff] (bus address [0x00044000-0x00045fff])
[    0.041490] pci_bus 0000:00: root bus resource [mem 0xf1048000-0xf1049fff] (bus address [0x00048000-0x00049fff])
[    0.041499] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xe7ffffff]
[    0.041506] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.041595] pci 0000:00:01.0: [11ab:6820] type 01 class 0x060400
[    0.042568] PCI: bus0: Fast back to back transfers disabled
[    0.042588] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.043491] PCI: bus1: Fast back to back transfers enabled
[    0.043509] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.043552] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.043923] mv_xor f1060800.xor: Marvell shared XOR driver
[    0.111837] mv_xor f1060800.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.112097] mv_xor f1060900.xor: Marvell shared XOR driver
[    0.181582] mv_xor f1060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.181860] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.183077] printk: console [ttyS0] disabled
[    0.203204] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 30, base_baud = 12500000) is a 16550A
[    1.046220] printk: console [ttyS0] enabled
[    1.053664] loop: module loaded
[    1.056835] Loading iSCSI transport class v2.0-870.
[    1.064469] spi-nor spi0.0: found mx25l12805d, expected m25p128
[    1.070458] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    1.079761] 2 fixed-partitions partitions found on MTD device spi0.0
[    1.086192] Creating 2 MTD partitions on "spi0.0":
[    1.091020] 0x000000000000-0x000000400000 : "uboot"
[    1.096302] 0x000000400000-0x000001000000 : "firmware"
[    1.107974] hwmon hwmon0: temp1_input not attached to any thermal zone
[    1.115014] mdio_bus f1072004.mdio-mii: MDIO device at address 1 is missing.
[    1.123473] mvneta f1070000.ethernet eth0: Using random mac address 92:3a:14:df:f3:30
[    1.132385] mvneta f1030000.ethernet eth1: Using random mac address f6:3a:a6:24:a1:73
[    1.140358] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.146934] ehci-pci: EHCI PCI platform driver
[    1.151443] ehci-platform: EHCI generic platform driver
[    1.156798] ehci-orion: EHCI orion driver
[    1.161189] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    1.166545] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 1
[    1.174175] xhci-hcd f10f0000.usb3: hcc params 0x0a000990 hci version 0x100 quirks 0x0000000000010010
[    1.183510] xhci-hcd f10f0000.usb3: irq 51, io mem 0xf10f0000
[    1.189391] xhci-hcd f10f0000.usb3: xHCI Host Controller
[    1.194747] xhci-hcd f10f0000.usb3: new USB bus registered, assigned bus number 2
[    1.202285] xhci-hcd f10f0000.usb3: Host supports USB 3.0 SuperSpeed
[    1.209003] hub 1-0:1.0: USB hub found
[    1.212806] hub 1-0:1.0: 1 port detected
[    1.216960] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.225430] hub 2-0:1.0: USB hub found
[    1.229218] hub 2-0:1.0: 1 port detected
[    1.233472] usbcore: registered new interface driver usb-storage
[    1.240123] armada38x-rtc f10a3800.rtc: registered as rtc0
[    1.245746] armada38x-rtc f10a3800.rtc: setting system clock to 2024-03-22T22:14:54 UTC (1711145694)
[    1.255121] i2c_dev: i2c /dev entries driver
[    1.259537] mv64xxx_i2c f1011000.i2c: can't get pinctrl, bus recovery not supported
[    1.269260] orion_wdt: Initial timeout 171 sec
[    1.274074] sdhci: Secure Digital Host Controller Interface driver
[    1.280289] sdhci: Copyright(c) Pierre Ossman
[    1.284803] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.291775] marvell-cesa f1090000.crypto: CESA device successfully registered
[    1.299745] NET: Registered PF_INET6 protocol family
[    1.305651] Segment Routing with IPv6
[    1.309374] In-situ OAM (IOAM) with IPv6
[    1.313388] NET: Registered PF_PACKET protocol family
[    1.316875] mmc0: SDHCI controller on f10d8000.sdhci [f10d8000.sdhci] using ADMA
[    1.318491] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.339172] 8021q: 802.1Q VLAN Support v1.8
[    1.343421] Registering SWP/SWPB emulation handler
[    1.362518] Freeing unused kernel image (initmem) memory: 8192K
[    1.392118] Run /init as init process
[    1.395804]   with arguments:
[    1.395807]     /init
[    1.395810]   with environment:
[    1.395812]     HOME=/
[    1.395815]     TERM=linux
[    1.561140] init: Console is alive
[    1.564699] init: - watchdog -
[    1.571558] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    1.579592] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    1.588309] init: - preinit -
[    1.687038] random: jshn: uninitialized urandom read (4 bytes read)
[    1.718968] random: jshn: uninitialized urandom read (4 bytes read)
[    1.735335] random: jshn: uninitialized urandom read (4 bytes read)
[    1.811919] mvneta f1070000.ethernet eth0: could not attach PHY: -19
[    1.818328] mvneta f1070000.ethernet eth0: cannot probe MDIO bus
[    3.887643] procd: - early -
[    3.890612] procd: - watchdog -
[    4.413707] procd: - watchdog -
[    4.417035] procd: - ubus -
[    4.422867] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.469599] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.476146] random: ubusd: uninitialized urandom read (4 bytes read)
[    4.483523] procd: - init -
[    4.673486] kmodloader: loading kernel modules from /etc/modules.d/*
[    4.706714] PPP generic driver version 2.4.2
[    4.712165] NET: Registered PF_PPPOX protocol family
[    4.720452] kmodloader: done loading kernel modules from /etc/modules.d/*
[    5.130204] urngd: v1.0.2 started.
[    5.428135] random: crng init done
[    5.431571] random: 26 urandom warning(s) missed due to ratelimiting
[   13.166549] mvneta f1070000.ethernet eth0: could not attach PHY: -19
[   13.173049] mvneta f1070000.ethernet eth0: cannot probe MDIO bus
[   13.191586] br-lan: port 1(eth0) entered blocking state
[   13.196862] br-lan: port 1(eth0) entered disabled state
[   13.202349] device eth0 entered promiscuous mode

These are embedded devices, there are no generic images, each device needs its own bespoke DTS and image/ sysupgrade recipes. Even if -on the face of it- two devices are very similar, there are likely some difference (and be it just different OEM partitioning, bootloader settings, compression details, etc.), these need to be accounted for (the initramfs image are more forgiving, as they bypass all the storage specific aspects and can't harm your installed system). If you are lucky, basing your development on that done for a similar device can kickstart your efforts, but there will still be quite some things left to do.

I am actually re-compiling that with the said ethernet driver, I think it was r8169 one, that also has that support. ChatGPT gave me quite some advices.

Do yourself a favour and avoid that mechanical parrot high on acid…

5 Likes

Yes none of them got ethernet working. It was fun trying. I tried several images, Linksys WRT1200AC almost got it working, but again no ethernet :frowning:

Without the Ethernet setup included in the dts the device won’t be detected by the kernel
Check the doozan forum to see if they have created a suitable dts and use that to create a custom image.

Or just use the doozan Debian rootfs and run Debian on your nas.

Also, there’s basically zero chance and Armada device has a Realtek Ethernet controller, the SOC has a Marvell gigabit eth included.

If you want to keep trying pre compiled initramfs go with the Buffalo ls421de or the global scale mirabox, these are closer to your asusstor NAS than the Marvell dev boards or any router device

Nope, tried that initramfs. Doesn't go past till starting kernel. Working image was this, but only ethernet didn't work: openwrt-mvebu-cortexa9-marvell_a388-rd-initramfs-kernel.bin

I was gonna try debian images, but why don't they provide initramfs? I am too tired, I am gonna do all that work and it's not gonna work. Booring. They must provide initramfs.

I have installed debian to an hdd, trying to boot from it. But run into some problems. I am asking why this might not work? I do everything right. This is marvells u-boot. Debian installer from TFTP worked, but why it's not booting? Chatgpt said to me do these commands, they seem right. They reach the data right. What am I missing here? After bootz the machine just freezes. I am just this close. If I do this I'll do openwrt next.

Hit any key to stop autoboot:  0 
Marvell>> ttttttt
Unknown command 'ttttttt' - try 'help'
Marvell>> scsi init
AHCI init for unit0
SATA link 0 timeout.
Target spinup took 0 ms.

Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found
scanning bus for devices...
  Device 0: (1:0) Vendor: ATA Prod.: ST9160310AS Rev: 0303
            Type: Hard Disk
            Capacity: 152627.8 MB = 149.0 GB (312581808 x 512)
Found 1 device(s).
Marvell>> ext2load scsi 0:1 0x80000000 /vmlinuz
5423616 bytes read in 237 ms (21.8 MiB/s)
Marvell>> ext2load scsi 0:1 0x88000000 /initrd.img
23415107 bytes read in 987 ms (22.6 MiB/s)
Marvell>> grep
Unknown command 'grep' - try 'help'
Marvell>> bootz 0x80000000 0x88000000

You may want to ask questions at the doozan linux device hacking forum. Bodhi, who runs that forum, is very familiar with different marvell kirkwood and armada devices. Once you have a working dts file for Debian it should be a lot easier to then create an OpenWrt firmware.

The kernel needs to be prepared in a way uboot understands, as a uboot compatible image.
you can’t call the uncompressed kernel file.

Do some reading on the uboot boot process and creating a bootable kernel

I actually did try both, but still nothing:

cd /boot
cp vmlinuz-6.1.0-21-armmp zImage.fdt
cat dts/armada-385-linksys-caiman.dtb >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "Linux Kernel" -d zImage.fdt uImage

Are you still having fun?

Chatgpt got mad at me because I asked it why pi was an irrational number without using the word irrational...
Like "I do not think either of us are enjoying this conversation" mad.

1 Like

It was fun until I did everything right but it won't work. I almost got debian working.

The thing is chatgpt gave me the right commands for u-boot. But couldn't succeed somehow. Weird.

Chatgpt does not know how to say "I don't know".

1 Like

You can’t use a linksys router dts for a NAS device.
And your load addresses look to be way too high. Check where the default kernel is loaded in the uboot bootcmd.

And ChatGPT is worse than useless for uboot commands, don’t use its nonsense guesses.

Edit, the instructions for the WD mybook duo should get you very close to running. Ignore the kwboot section.

So, in the official firmware of this NAS, it's an IMG file. Inside it there is AS10XX.dtb file. u-boot also requires it. But, this device originally uses kernel 3.10 or something. Debian 12 is 6.1.0 If I append that, would it still work?
OMG WAIT I DAMN DID IT!!!! I am running debian 12 on this NAS right now! Ethernet works heck yeah!
So you were saying noo you can't use linksys wrt1200 dtb file huh? dtb file go brr :rofl:

1 Like

Not sure what your message means, but if you got it working how about sharing what was required so future readers can understand what was required for this device.