Add support for Linksys EA6350 v3

linkwifi

Got WiFi working now, going to test out the sysupgrade file - if all goes well I will tidy up my commits and submit a patch.

Did you extract the BDF-s from stock firmware?

I modified the 11-ath10k-caldata script from hotplug.d to pull the caldata from ART on the SPI flash.

That's not enough, since they all reuse the same BMI IDs for the IPQ40XX series you also gotta extract the BDF-s for 2.4 and 5GHz.
And generate a custom board-2.bin for them, then you include it in ipq-wifi package.
And off course push it upstream on ath10k mailing list

I'm slightly confused - why have the cal data saved on flash to need a different file again?

I have seen this repo, is this the script I need?:

Is there any documentation on the correct way to do this?

Calibration data is unique to each device, but BDF files are unique to design of the board and QCA unfortunately distributs them to all vendors with the same BMI IDs, so that is why upstream board-2.bin seems to recognize everything but that is not correct.
In order to calibrate the radio fully you need BDFs from stock firmware.

Yes, that is the correct script.
Take a look here, its explained really well.

I can make it for you if its an issue, you just gotta provide me with a bootlog to read BMIs from

Also, you gotta add a ath10k propery to the DTS.
Like this:

1 Like

Perfect, thanks robimarko.

I'll have a read through all of the information and give it a go. (Interesting because 8devices-jalepeno is the board ID I used to get it working)

If I hit any issues is it okay to drop you a message on here?

How long do the guys upstream take to add support for new BDF's?

Ok, give it a go.
But please dont reuse IDs as that way radios are way off on calibration.

Sure, please contact me if any issue arise, I have been doing a lot of IPQ40xx boards lately.
Upstream usually takes a long time, that is why we have a ipq-wifi package until its upstream.

I unpackaged the stock firmware and in /lib/firmware you can find BDFs to regions.
We usually use FCC or EU/ETSI ones.

Brilliant, I managed to grab the board files from the original firmware, generated the board-2.bin and added that to the ipq-wifi package. Boot log seems good:

(EA6350v3) # tftpboot 82000000 image.itb
eth0 PHY0 up Speed :1000 Full duplex
eth0 PHY1 Down Speed :10 Half duplex
eth0 PHY2 Down Speed :10 Half duplex
eth0 PHY3 Down Speed :10 Half duplex
eth0 PHY4 Down Speed :10 Half duplex
Using eth0 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.1
Filename 'image.itb'.
Load address: 0x82000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################
done
Bytes transferred = 8893136 (87b2d0 hex)
(EA6350v3) # bootm
## Booting kernel from FIT Image at 82000000 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM OpenWrt Linux-4.14.68
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x820000e4
     Data Size:    8875100 Bytes = 8.5 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80208000
     Entry Point:  0x80208000
     Hash algo:    crc32
     Hash value:   f2c77c12
     Hash algo:    sha1
     Hash value:   9fd1797793d31086c2888e2437501ae313e903dd
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Flattened Device Tree from FIT Image at 82000000
   Using 'config@1' configuration
   Trying 'fdt@1' FDT blob subimage
     Description:  ARM OpenWrt linksys_ea6350v3 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x82876e7c
     Data Size:    16164 Bytes = 15.8 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   56d185aa
     Hash algo:    sha1
     Hash value:   780966d0ef1e44f79b6f06ec5ff855b3554246c4
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x82876e7c
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 87228000, end 8722ef23 ... OK
ipq: fdt fixup unable to find compatible node
In ART, mac0=0xFFFFFFFFFFFF, mac1=0xFFFFFFFFFFFF, mac2=0x6038E08994A5, mac3=0x6038E08994A6
get_eth_mac_address@1407: the base hw_mac_addr='60:38:E0:89:94:A3' is valid!
Using machid 0x8010100 from environment

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.68 (ryan@ryan-linux) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r8055-6e80dd5)) #0 SMP Tue Sep 11 13:00:09 2018
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Linksys EA6350v3
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from start_kernel+0x88/0x3c0 with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu @cfdaf000 s29260 r8192 d23988 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64512
[    0.000000] Kernel command line:
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 236592K/260096K available (4195K kernel code, 137K rwdata, 1168K rodata, 14336K init, 272K bss, 23504K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc0718dc8   (5188 kB)
[    0.000000]       .init : 0xc0900000 - 0xc1700000   (14336 kB)
[    0.000000]       .data : 0xc1700000 - 0xc1722480   ( 138 kB)
[    0.000000]        .bss : 0xc1724000 - 0xc17682b0   ( 273 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 48.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb11fd3bfb, max_idle_ns: 440795203732 ns
[    0.000007] sched_clock: 56 bits at 48MHz, resolution 20ns, wraps every 4398046511096ns
[    0.000022] Switching to timer-based delay loop, resolution 20ns
[    0.000249] Calibrating delay loop (skipped), value calculated using timer frequency.. 96.00 BogoMIPS (lpj=480000)
[    0.000269] pid_max: default: 32768 minimum: 301
[    0.000401] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000420] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001019] CPU: Testing write buffer coherency: ok
[    0.001702] Setting up static identity map for 0x80300000 - 0x80300060
[    0.001847] Hierarchical SRCU implementation.
[    0.002480] smp: Bringing up secondary CPUs ...
[    0.005216] smp: Brought up 1 node, 4 CPUs
[    0.005236] SMP: Total of 4 processors activated (384.00 BogoMIPS).
[    0.005244] CPU: All CPU(s) started in SVC mode.
[    0.009138] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.009282] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.009305] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.009497] pinctrl core: initialized pinctrl subsystem
[    0.010467] NET: Registered protocol family 16
[    0.010716] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.011733] cpuidle: using governor ladder
[    0.011775] cpuidle: using governor menu
[    0.028386] usbcore: registered new interface driver usbfs
[    0.028450] usbcore: registered new interface driver hub
[    0.028540] usbcore: registered new device driver usb
[    0.028586] pps_core: LinuxPPS API ver. 1 registered
[    0.028596] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.028621] PTP clock support registered
[    0.029825] clocksource: Switched to clocksource arch_sys_counter
[    0.030679] NET: Registered protocol family 2
[    0.031293] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.031335] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.031384] TCP: Hash tables configured (established 2048 bind 2048)
[    0.031488] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.031525] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.031730] NET: Registered protocol family 1
[    0.200113] No memory allocated for crashlog
[    0.200600] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    0.203777] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.203793] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.209043] io scheduler noop registered
[    0.209063] io scheduler deadline registered (default)
[    0.211735] bam-dma-engine 8e04000.dma: num-channels unspecified in dt
[    0.211755] bam-dma-engine 8e04000.dma: num-ees unspecified in dt
[    0.212444] tcsr 1949000.tcsr: setting wifi_glb_cfg = 41000000
[    0.212525] tcsr 194b000.tcsr: setting usb hs phy mode select = e700e7
[    0.212597] tcsr 1953000.ess_tcsr: setting ess interface select = 0
[    0.212671] tcsr 1957000.tcsr: setting wifi_noc_memtype_m0_m2 = 2222222
[    0.212889] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.213435] msm_serial 78af000.serial: msm_serial: detected port #0
[    0.213482] msm_serial 78af000.serial: uartclk = 1843200
[    0.213532] 78af000.serial: ttyMSM0 at MMIO 0x78af000 (irq = 25, base_baud = 115200) is a MSM
[    0.213556] msm_serial: console setup on port #0
[    0.719124] console [ttyMSM0] enabled
[    0.724049] msm_serial: driver initialized
[    0.731561] loop: module loaded
[    0.732705] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    0.735318] m25p80 spi0.0: mx25l1606e (2048 Kbytes)
[    0.741766] 10 fixed-partitions partitions found on MTD device spi0.0
[    0.746275] Creating 10 MTD partitions on "spi0.0":
[    0.752895] 0x000000000000-0x000000040000 : "SBL1"
[    0.758210] 0x000000040000-0x000000060000 : "MIBIB"
[    0.763030] 0x000000060000-0x0000000c0000 : "QSEE"
[    0.767747] 0x0000000c0000-0x0000000d0000 : "CDT"
[    0.772636] 0x0000000d0000-0x0000000e0000 : "APPSBLENV"
[    0.777355] 0x0000000e0000-0x000000160000 : "APPSBL"
[    0.782451] 0x000000160000-0x000000170000 : "ART"
[    0.787586] 0x000000170000-0x000000190000 : "u_env"
[    0.792270] 0x000000190000-0x0000001b0000 : "s_env"
[    0.796873] 0x0000001b0000-0x0000001c0000 : "devinfo"
[    0.802644] libphy: ipq40xx_mdio: probed
[    0.886982] ESS reset ok!
[    0.919954] ESS reset ok!
[    1.350253] libphy: Fixed MDIO Bus: probed
[    1.449963] i2c /dev entries driver
[    1.490186] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
[    1.490227] nand: Winbond W25N01GV 1G 3.3V 8-bit
[    1.495617] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.500752] Scanning device for bad blocks
[    1.525551] random: fast init done
[    2.004932] random: crng init done
[    2.056161] 6 fixed-partitions partitions found on MTD device spi0.1
[    2.056195] Creating 6 MTD partitions on "spi0.1":
[    2.061972] 0x000000000000-0x000002800000 : "kernel"
[    2.078233] 0x000000300000-0x000002800000 : "rootfs"
[    2.088912] mtd: device 11 (rootfs) set to be root filesystem
[    2.092272] mtdsplit: no squashfs found in "rootfs"
[    2.093789] 0x000002800000-0x000005000000 : "alt_kernel"
[    2.099304] 0x000002b00000-0x000005000000 : "alt_rootfs"
[    2.104786] 0x000005000000-0x000005100000 : "sysdiag"
[    2.109863] 0x000005100000-0x000008000000 : "syscfg"
[    2.116078] NET: Registered protocol family 10
[    2.121005] Segment Routing with IPv6
[    2.123624] NET: Registered protocol family 17
[    2.127651] 8021q: 802.1Q VLAN Support v1.8
[    2.131660] Registering SWP/SWPB emulation handler
[    2�[    2.169859] Freeing unused kernel memory: 14336K
[    2.214219] init: Console is alive
[    2.214488] init: - watchdog -
[    2.230695] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.515618] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.515699] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    2.520321] xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f665 hci version 0x100 quirks 0x02010010
[    2.527647] xhci-hcd xhci-hcd.0.auto: irq 94, io mem 0x08a00000
[    2.537033] hub 1-0:1.0: USB hub found
[    2.542225] hub 1-0:1.0: 1 port detected
[    2.546268] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    2.550093] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    2.555359] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0  SuperSpeed
[    2.563064] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.570239] hub 2-0:1.0: USB hub found
[    2.577876] hub 2-0:1.0: 1 port detected
[    2.581840] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    2.585478] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    2.591039] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220f665 hci version 0x100 quirks 0x02010010
[    2.598369] xhci-hcd xhci-hcd.1.auto: irq 95, io mem 0x06000000
[    2.607581] hub 3-0:1.0: USB hub found
[    2.612942] hub 3-0:1.0: 1 port detected
[    2.616992] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    2.620828] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    2.626096] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[    2.633750] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.640744] hub 4-0:1.0: USB hub found
[    2.648595] hub 4-0:1.0: config failed, hub doesn't have any ports! (err -19)
[    2.653812] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.672062] init: - preinit -
[    3.202789] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    3.202880] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    6.375995] procd: - early -
[    6.376130] procd: - watchdog -
[    7.051037] procd: - watchdog -
[    7.053790] procd: - ubus -
[    7.126682] procd: - init -
Please press Enter to activate this console.
[    7.266198] kmodloader: loading kernel modules from /etc/modules.d/*
[    7.274559] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    7.797359] u32 classifier
[    7.797388]     input device check on
[    7.798959]     Actions configured
[    7.803898] Mirror/redirect action on
[    7.809981] nf_conntrack version 0.5.0 (4096 buckets, 16384 max)
[    7.812787] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[    7.815806] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
[    7.825211] ip_tables: (C) 2000-2006 Netfilter Core Team
[    8.522873] xt_time: kernel timezone is -0000
[    8.725074] PPP generic driver version 2.4.2
[    8.726097] NET: Registered protocol family 24
[    8.922286] ath10k_ahb a000000.wifi: Direct firmware load for ath10k/pre-cal-ahb-a000000.wifi.bin failed with error -2
[    8.922339] ath10k_ahb a000000.wifi: Falling back to user helper
[    9.899623] ath10k_ahb a000000.wifi: Direct firmware load for ath10k/QCA4019/hw1.0/firmware-6.bin failed with error -2
[    9.899671] ath10k_ahb a000000.wifi: Falling back to user helper
[    9.969453] firmware ath10k!QCA4019!hw1.0!firmware-6.bin: firmware_loading_store: map pages failed
[    9.971676] ath10k_ahb a000000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[    9.977352] ath10k_ahb a000000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1
[    9.992027] ath10k_ahb a000000.wifi: firmware ver 10.4-3.5.3-00057 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 6a15d64d
[   10.036015] ath10k_ahb a000000.wifi: board_file api 2 bmi_id 0:16 crc32 f0f49832
[   11.423023] ath10k_ahb a000000.wifi: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 512 raw 0 hwcrypto 1
[   11.661929] ath10k_ahb a800000.wifi: Direct firmware load for ath10k/pre-cal-ahb-a800000.wifi.bin failed with error -2
[   11.661977] ath10k_ahb a800000.wifi: Falling back to user helper
[   13.054293] ath10k_ahb a800000.wifi: Direct firmware load for ath10k/QCA4019/hw1.0/firmware-6.bin failed with error -2
[   13.054346] ath10k_ahb a800000.wifi: Falling back to user helper
[   13.117501] firmware ath10k!QCA4019!hw1.0!firmware-6.bin: firmware_loading_store: map pages failed
[   13.117801] ath10k_ahb a800000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000
[   13.125474] ath10k_ahb a800000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1
[   13.138444] ath10k_ahb a800000.wifi: firmware ver 10.4-3.5.3-00057 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 6a15d64d
[   13.183862] ath10k_ahb a800000.wifi: board_file api 2 bmi_id 0:17 crc32 f0f49832
[   14.581169] ath10k_ahb a800000.wifi: htt-ver 2.2 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 512 raw 0 hwcrypto 1
[   14.603141] kmodloader: done loading kernel modules from /etc/modules.d/*
[   25.403812] br-lan: port 1(eth0) entered blocking state
[   25.403856] br-lan: port 1(eth0) entered disabled state
[   25.408176] device eth0 entered promiscuous mode
[   25.415630] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   25.431704] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   26.409959] br-lan: port 1(eth0) entered forwarding state
[   26.414748] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

Going to go through and test everything now, then submit a PR and email ath10k.

Have you added the qcom,ath10k-calibration-variant to DTS?

Any chance you have your tree public so I can take a look at it?

For ath10k you can check the archive for September, I submitted BDF-s for 2 devices

I have indeed.

I will push it to git shortly, I will post the link here. Just trying to work out how to flash the file without having a serial console - Linksys check the firmware header before doing a sysupgrade. Looking for a workaround.

Awesome, thank you.

I've managed to work out the "signature" that linksys use to verify updates - and I've succeeded in writing the image at /dev/mtd10 - HOWEVER, this isn't loaded by u-boot at the address I expected, so I will have to work out what is going on there.
I'll get back to that on monday :slight_smile:

Here's my commit:

Let me know what you think :slight_smile:

Left some comments.
Please, dont mess with sysupgrade image but instead make a build recipe for Linksys image and call that for factory image.

Hi Escalion,

How did you get terminal access without having a serial console?

thx

Hey robimarko.
I've made the improvements ref. the comments made and pushed the changes.

I have made some progress with factory image, that I can now flash a file from the Linksys UI with the generated factory bin with some extra steps:

Generate CRC with: printf "%08X" $(dd if=factory.bin bs=$(stat -c%s factory.bin) count=1|cksum| cut -d ' ' -f1)
Replace FFFFFFFF with generated CRC in file sig.txt (MUST BE 256 bytes long):

.LINKSYS.01000409EA6350v3       FFFFFFFF       K0000000F0246434

then
cat factory.bin sig.txt > factory.img

The resulting file can be flashed successfully, HOWEVER, I have the following issue (and I've been scratching my head for a couple hours)

main_loop@455: run_command(if test $boot_part = 1; then run bootpart1; else run bootpart2; fi, 0)

NAND read: device 1 offset 0x2800000, size 0x300000
 3145728 bytes read: OK
## Booting kernel from FIT Image at 82000000 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM OpenWrt Linux-4.14.71
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x820000e4
     Data Size:    2922949 Bytes = 2.8 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80208000
     Entry Point:  0x80208000
     Hash algo:    crc32
     Hash value:   bd0a1919
     Hash algo:    sha1
     Hash value:   9a1ae3798bb47d0b893f29d4e77633cc2f2bbc2f
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Flattened Device Tree from FIT Image at 82000000
   Using 'config@1' configuration
   Trying 'fdt@1' FDT blob subimage
     Description:  ARM OpenWrt linksys_ea6350v3 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x822c9be8
     Data Size:    16164 Bytes = 15.8 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   f6119e79
     Hash algo:    sha1
     Hash value:   2f996e5da4e4119af3f5099a33b64204d1ce60bb
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x822c9be8
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 87228000, end 8722ef23 ... OK
ipq: fdt fixup unable to find compatible node
In ART, mac0=0xFFFFFFFFFFFF, mac1=0xFFFFFFFFFFFF, mac2=0x6038E08994A5, mac3=0x6038E08994A6
get_eth_mac_address@1407: the base hw_mac_addr='60:38:E0:89:94:A3' is valid!
Using machid 0x8010100 from environment

Starting kernel ...
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.71 (ryan@ryan-linux) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r8055-6e80dd5)) #0 SMP Fri Sep 21 17:33:36 2018
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Linksys EA6350v3
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from start_kernel+0x88/0x3c0 with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu @cfdaf000 s29260 r8192 d23988 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64512
[    0.000000] Kernel command line: init=/sbin/init rootfstype=squashfs ubi.mtd=13,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 249920K/260096K available (4196K kernel code, 137K rwdata, 1168K rodata, 1024K init, 256K bss, 10176K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc0719060   (5189 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a22680   ( 138 kB)
[    0.000000]        .bss : 0xc0a24000 - 0xc0a64258   ( 257 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 48.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb11fd3bfb, max_idle_ns: 440795203732 ns
[    0.000008] sched_clock: 56 bits at 48MHz, resolution 20ns, wraps every 4398046511096ns
[    0.000022] Switching to timer-based delay loop, resolution 20ns
[    0.000249] Calibrating delay loop (skipped), value calculated using timer frequency.. 96.00 BogoMIPS (lpj=480000)
[    0.000269] pid_max: default: 32768 minimum: 301
[    0.000400] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000419] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000946] CPU: Testing write buffer coherency: ok
[    0.001639] Setting up static identity map for 0x80300000 - 0x80300060
[    0.001779] Hierarchical SRCU implementation.
[    0.002412] smp: Bringing up secondary CPUs ...
[    0.005120] smp: Brought up 1 node, 4 CPUs
[    0.005141] SMP: Total of 4 processors activated (384.00 BogoMIPS).
[    0.005149] CPU: All CPU(s) started in SVC mode.
[    0.009357] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.009505] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.009530] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.009731] pinctrl core: initialized pinctrl subsystem
[    0.010684] NET: Registered protocol family 16
[    0.011008] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.012026] cpuidle: using governor ladder
[    0.012069] cpuidle: using governor menu
[    0.028844] usbcore: registered new interface driver usbfs
[    0.028916] usbcore: registered new interface driver hub
[    0.028996] usbcore: registered new device driver usb
[    0.029044] pps_core: LinuxPPS API ver. 1 registered
[    0.029053] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.029078] PTP clock support registered
[    0.030450] clocksource: Switched to clocksource arch_sys_counter
[    0.031249] NET: Registered protocol family 2
[    0.031876] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.031918] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.031966] TCP: Hash tables configured (established 2048 bind 2048)
[    0.032070] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.032107] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.032313] NET: Registered protocol family 1
[    0.033338] No memory allocated for crashlog
[    0.033482] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    0.036658] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.036673] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.041620] io scheduler noop registered
[    0.041640] io scheduler deadline registered (default)
[    0.044253] bam-dma-engine 8e04000.dma: num-channels unspecified in dt
[    0.044273] bam-dma-engine 8e04000.dma: num-ees unspecified in dt
[    0.044960] tcsr 1949000.tcsr: setting wifi_glb_cfg = 41000000
[    0.045043] tcsr 194b000.tcsr: setting usb hs phy mode select = e700e7
[    0.045116] tcsr 1953000.ess_tcsr: setting ess interface select = 0
[    0.045191] tcsr 1957000.tcsr: setting wifi_noc_memtype_m0_m2 = 2222222
[    0.045409] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.045961] msm_serial 78af000.serial: msm_serial: detected port #0
[    0.046007] msm_serial 78af000.serial: uartclk = 1843200
[    0.046058] 78af000.serial: ttyMSM0 at MMIO 0x78af000 (irq = 25, base_baud = 115200) is a MSM
[    0.046083] msm_serial: console setup on port #0
[    0.560068] console [ttyMSM0] enabled
[    0.564982] msm_serial: driver initialized
[    0.572466] loop: module loaded
[    0.573620] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    0.576184] m25p80 spi0.0: mx25l1606e (2048 Kbytes)
[    0.582715] 10 fixed-partitions partitions found on MTD device spi0.0
[    0.587220] Creating 10 MTD partitions on "spi0.0":
[    0.593842] 0x000000000000-0x000000040000 : "SBL1"
[    0.599194] 0x000000040000-0x000000060000 : "MIBIB"
[    0.603958] 0x000000060000-0x0000000c0000 : "QSEE"
[    0.608678] 0x0000000c0000-0x0000000d0000 : "CDT"
[    0.613570] 0x0000000d0000-0x0000000e0000 : "APPSBLENV"
[    0.618323] 0x0000000e0000-0x000000160000 : "APPSBL"
[    0.623404] 0x000000160000-0x000000170000 : "ART"
[    0.628553] 0x000000170000-0x000000190000 : "u_env"
[    0.633192] 0x000000190000-0x0000001b0000 : "s_env"
[    0.637854] 0x0000001b0000-0x0000001c0000 : "devinfo"
[    0.643545] libphy: ipq40xx_mdio: probed
[    0.678173] ESS reset ok!
[    0.711154] ESS reset ok!
[    1.140851] libphy: Fixed MDIO Bus: probed
[    1.240589] i2c /dev entries driver
[    1.280661] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
[    1.280697] nand: Winbond W25N01GV 1G 3.3V 8-bit
[    1.286087] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.290752] Scanning device for bad blocks
[    1.308506] random: fast init done
[    1.588022] random: crng init done
[    1.682088] 6 fixed-partitions partitions found on MTD device spi0.1
[    1.682121] Creating 6 MTD partitions on "spi0.1":
[    1.687519] 0x000000000000-0x000002800000 : "kernel"
[    1.693365] 0x000000300000-0x000002800000 : "rootfs"
[    1.698280] mtd: device 11 (rootfs) set to be root filesystem
[    1.705241] mtdsplit: no squashfs found in "rootfs"
[    1.707847] 0x000002800000-0x000005000000 : "alt_kernel"
[    1.713358] 0x000002b00000-0x000005000000 : "alt_rootfs"
[    1.718846] 0x000005000000-0x000005100000 : "sysdiag"
[    1.723987] 0x000005100000-0x000008000000 : "syscfg"
[    1.730128] NET: Registered protocol family 10
[    1.734724] Segment Routing with IPv6
[    1.737664] NET: Registered protocol family 17
[    1.741701] 8021q: 802.1Q VLAN Support v1.8
[    1.745772] Registering SWP/SWPB emulation handler
[    1.753641] ubi0: attaching mtd13
[    2.556492] ubi0: scanning is finished
[    2.556545] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    2.559238] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd13, error -22
[    2.566391] UBI error: cannot attach mtd13
[    2.573564] UBI: block: can't open volume on ubi0_0, err=-19
[    2.5775�[    2.585469] Waiting for root device /dev/ubiblock0_0...

Could I have defined something incorrectly?

Here is the env:

(EA6350v3) # printenv
altkern=2800000
auto_recovery=yes
baudrate=115200
boot_count=2
boot_part=2
boot_part_ready=3
boot_ver=0.6.0
bootcmd=if test $boot_part = 1; then run bootpart1; else run bootpart2; fi
bootdelay=2
bootpart1=set bootargs $partbootargs && nand read $loadaddr $prikern $kernsize && bootm $loadaddr
bootpart2=set bootargs $partbootargs2 && nand read $loadaddr $altkern $kernsize && bootm $loadaddr
ethact=eth0
ethaddr=60:38:E0:89:94:A3
flash_type=0
flashimg=tftpboot $loadaddr $image && nand erase $prikern $imgsize && nand write $loadaddr $prikern $filesize
flashimg2=tftpboot $loadaddr $image && nand erase $altkern $imgsize && nand write $loadaddr $altkern $filesize
hw_mac_addr=60:38:E0:89:94:A3
image=civic.img
imgsize=0x2800000
ipaddr=192.168.1.1
kernsize=300000
loadaddr=0x82000000
machid=8010100
netmask=255.255.255.0
partbootargs=init=/sbin/init rootfstype=squashfs ubi.mtd=11,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro
partbootargs2=init=/sbin/init rootfstype=squashfs ubi.mtd=13,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro
prikern=0
serverip=192.168.1.100
stderr=serial
stdin=serial
stdout=serial
sw_version=0.6.0

Environment size: 1203/131068 bytes

mantisgb: I do have a serial console :slight_smile:

1 Like

Hm, It looks like the bootloader is overriding partitions defined in DTS.
Are you sure that the partition layout matches the one you set in DTS?
If so, then you can use a chose node and pass bootargs simply like this to make kernel ignore ones by bootloader

The override seems to be acting correctly (it has a failsafe updater - which I need to find a way to update the env on successful update) and the partitions are in the correct place.
It seems I need to generate a UBIFS instead of merely appending the rootfs - which makes sense as UBI is better for NAND.
I'll have a play with a couple of options today.

No need for UBIFS, when you declare a ubi partition it will wrap everything inside a UBIFS.
You can use init.d folder and make a script to check if the model matches yours and then execute commands to modify U-boot env.
You can simply use u-boot-envtools

It seems odd as the factory image generated looks like this:

binwalk signed.img 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
228           0xE4            gzip compressed data, maximum compression, from Unix, NULL date (1970-01-01 00:00:00)
3145728       0x300000        Squashfs filesystem, little endian, version 4.0, compression:xz, size: 4781364 bytes, 1959 inodes, blocksize: 262144 bytes, created: 2018-09-21 17:33:36

Whereas the Linksys firnware looks like this:

binwalk FW_EA6350v3_3.1.9.182357_prod.img 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
14119         0x3727          xz compressed data
14340         0x3804          xz compressed data
3145728       0x300000        UBI erase count header, version: 1, EC: 0x0, VID header offset: 0x800, data offset: 0x1000

Which makes sense as the key lines of failure are:
mtd: device 11 (rootfs) set to be root filesystem - The upgrade was writtin to alt_* (mtd12,13)

[    1.918039] ubi0: attaching mtd13
i0: scanning is finished
[    3.471654] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    3.474378] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd13, error -22

If I generate a UBIFS for the factory binary I'm hoping that this should resolve the issue - but I may have to redefine its' sysupgrade image too for compatibility with the bootloader.

Well, you made a recipe for it and it looks to be incorrect.