Porting guide ar71xx to ath79?

Hi all,

I've raised a pull request with a port to ath79 for my D-Link DIR-825-C1 (Link). I included support for DIR-835-A1 as well, as it's included also in the "mach" file for ar71xx.

The two routers are similar, except for some LEDs. Anyway, I don't have an 835 myself, so I would be glad if somebody could test this. I'd be interested in knowing if it works in general (it should) and especially if the interfaces get the correct MAC addresses and if the LEDs are fine.

I don't know if anybody still uses this router. I've seen some forum posts that suggest some do (hello @terry98 and @br14).

It'd be cool if I could get some feedback on the DIR-835-A1. My mail address is in the pull request.

Thanks!
Seb

2 Likes

FYI

I have created a new target page to reflect the status of ar71xx->ath79 migration:
https://openwrt.org/docs/techref/targets/ar71xx-ath79 - shows ar71xx-ath79 only (=migrated devices)

The already existing pages for ar71xx + ath79 have been modified to show both, ar71xx + ath79:
https://openwrt.org/docs/techref/targets/ar71xx - shows ath79 + ar71xx
https://openwrt.org/docs/techref/targets/ath79 - shows ath79 + ar71xx

I updated the status of the devices listed further above accordingly.

For already existing (ar71xx-) devices, you can update the status yourself by editing the respective dataentry:

  • Set target = ath79 β†’ devices with this target can be found only in ath79
  • Set target = ar71xx-ath79 β†’ devices with this target can be found in both, ar71xx and ath79
  • Set Unsupported functions = ath79 WIP β†’ incomplete ath79 migration; work in progress
  • Set Unsupported functions = <empty> β†’ 100% complete ath79 migration; no manual adjustment of configuration necessary when migrating from ar71xx to ath79
6 Likes

please backup those mtd partitions, especially art !!!
the PR is here
if you don't know how to build them I can link you an image, but it would be better to build it yourself, also please have a functioning serial ttl connected to the board (you can find in the wiki what pins you need to use and connect)

maybe others can review this on flash layout calculations

Regards

1 Like

@lucize
i will try to make a backup. Can you link me an image i can test ? Dont really know how to properly build one myself, but i would like to test.

im really after flow offloading, that comes with newer kernels.

please don't try, just DO it, or also you could end with an useless box
cat /dev/mtd0ro > /tmp/mtd0.img etc.. and copy them from the device (scp, or move them under /www/ and use the browser to download the image 192.168.1.1/mtd0.img) maybe just the ones mentioned above

there is a high chance that you'll need a serial ttl adapter (3.3v) so you can see if something goes wrong with the image (like the wireless or the switch part)

you can use sysupgrade, maybe you need to use -F option
the images factory and sysupgrade

@lucize
As instructed, i've made a backup of the partitions. So your image should just flash over existing openwrt installation or do i need extra (besides the -F option) ?

Also, if something goes bad, i assume i need to flash back backuped partitions from serial, correct ?

use sysupgrade without saving changes. If is not working you will write a normal ar71xx image via uboot, the backup is for the scenario if I didn't calculated the partitions correctly and overwrite the them, openwrt doesn't write those partitions.

Looks like the image is broken, because when i hook up serial, i get a kernel panic

U-Boot 1.1.4-g6ce9309a-dirty (Oct 26 2016 - 09:20:53)

ap152 - Dragonfly 1.0

DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 393k for U-Boot at: 83f9c000
Reserving 16448k for malloc() at: 82f8c000
Reserving 44 Bytes for Board Info at: 82f8bfd4
Reserving 36 Bytes for Global Data at: 82f8bfb0
Reserving 128k for boot params() at: 82f6bfb0
Stack Pointer at: 82f6bf98
Now running in RAM - U-Boot at: 83f9c000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16MB, sector count = 256
Flash: 16 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ath_gmac_enet_initialize...
No valid address in Flash. Using fixed address
ath_gmac_enet_initialize: reset mask:c02200
athr_mgmt_init ::done
Dragonfly  ----> S17 PHY *
athrs17_reg_init: complete
SGMII in forced mode
athr_gmac_sgmii_setup SGMII done
: cfg1 0x80000000 cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
eth0 up
eth0
Setting 0x181162c0 to 0x20402100
factory boot check integer ok.
factory boot load fs uboot len 131072 to addr 0x80010000.
Hit any key to stop autoboot:  0
## Starting application at 0x80010000 ...


U-Boot 1.1.4-g6ce9309a-dirty (Oct 26 2016 - 09:24:21)

ap152 - Dragonfly 1.0

DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 122k for U-Boot at: 83fe0000
Reserving 16448k for malloc() at: 82fd0000
Reserving 44 Bytes for Board Info at: 82fcffd4
Reserving 36 Bytes for Global Data at: 82fcffb0
Reserving 128k for boot params() at: 82faffb0
Stack Pointer at: 82faff98
Now running in RAM - U-Boot at: 83fe0000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16MB, sector count = 256
Flash: 16 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ath_gmac_enet_initialize...
No valid address in Flash. Using fixed address
ath_gmac_enet_initialize: reset mask:c02200
athr_mgmt_init ::done
Dragonfly  ----> S17 PHY *
athrs17_reg_init: complete
SGMII in forced mode
athr_gmac_sgmii_setup SGMII done
: cfg1 0x80000000 cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
eth0 up
eth0
Setting 0x181162c0 to 0x20402100
Hit any key to stop autoboot:  0
## Booting image at 9f040000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.87
   Created:      2018-12-10  15:32:22 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1604589 Bytes =  1.5 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9f040040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 4.14.87 (luci@srv.domain.local) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7410-d3a7587)) #0 Mon Dec 10 15:32:22 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] MIPS: machine is TP-Link TL-WR1043N Version 5
[    0.000000] SoC: Qualcomm Atheros QCA956X ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x474 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 58272K/65536K available (3746K kernel code, 150K rwdata, 904K rodata, 1208K init, 204K bss, 7264K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 775.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4932285024 ns
[    0.000007] sched_clock: 32 bits at 387MHz, resolution 2ns, wraps every 5541893118ns
[    0.008212] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.074760] pid_max: default: 32768 minimum: 301
[    0.079779] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.086762] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097792] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.108180] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.114671] pinctrl core: initialized pinctrl subsystem
[    0.121005] NET: Registered protocol family 16
[    0.145845] clocksource: Switched to clocksource MIPS
[    0.152086] NET: Registered protocol family 2
[    0.157332] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.164683] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.171427] TCP: Hash tables configured (established 1024 bind 1024)
[    0.178256] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.184420] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.191274] NET: Registered protocol family 1
[    0.199553] Crashlog allocated RAM at address 0x3f00000
[    0.206232] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.217064] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.223210] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.241355] io scheduler noop registered
[    0.245491] io scheduler deadline registered (default)
[    0.252527] pinctrl-single 1804002c.pinmux: 512 pins at pa b804002c size 64
[    0.260313] gpio-export gpio-export: 1 gpio(s) exported
[    0.266584] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.273854] console [ttyS0] disabled
[    0.277688] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 8, base_baud = 1562500) is a 16550A
[    0.286792] console [ttyS0] enabled
[    0.286792] console [ttyS0] enabled
[    0.294335] bootconsole [early0] disabled
[    0.294335] bootconsole [early0] disabled
[    0.318747] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.323659] 8 fixed-partitions partitions found on MTD device spi0.0
[    0.330232] Creating 8 MTD partitions on "spi0.0":
[    0.335187] 0x000000000000-0x000000020000 : "factory-uboot"
[    0.341667] 0x000000020000-0x000000040000 : "u-boot"
[    0.347497] 0x000000040000-0x000000f00000 : "firmware"
[    0.353697] 0x000000f00000-0x000000f20000 : "product-info"
[    0.360037] 0x000000f20000-0x000000fc0000 : "config"
[    0.365797] 0x000000fc0000-0x000000fd0000 : "partition-table"
[    0.372413] 0x000000fd0000-0x000000ff0000 : "logs"
[    0.378027] 0x000000ff0000-0x000001000000 : "art"
[    0.384456] libphy: Fixed MDIO Bus: probed
[    0.726207] libphy: ag71xx_mdio: probed
[    0.733158] switch0: Atheros AR8337 rev. 2 switch registered on mdio-bus.0
[    1.727008] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd036, driver=Atheros AR8216/AR8236/AR8316]
[    1.738611] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:SGMII
[    1.747288] NET: Registered protocol family 10
[    1.756064] Segment Routing with IPv6
[    1.759928] NET: Registered protocol family 17
[    1.764549] 8021q: 802.1Q VLAN Support v1.8
[    1.770907] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.778685] Please append a correct "root=" boot option; here are the available partitions:
[    1.787323] 1f00             128 mtdblock0
[    1.787326]  (driver?)
[    1.794074] 1f01             128 mtdblock1
[    1.794077]  (driver?)
[    1.800830] 1f02           15104 mtdblock2
[    1.800833]  (driver?)
[    1.807586] 1f03             128 mtdblock3
[    1.807589]  (driver?)
[    1.814340] 1f04             640 mtdblock4
[    1.814343]  (driver?)
[    1.821097] 1f05              64 mtdblock5
[    1.821100]  (driver?)
[    1.827853] 1f06             128 mtdblock6
[    1.827857]  (driver?)
[    1.834608] 1f07              64 mtdblock7
[    1.834610]  (driver?)
[    1.841363] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.850445] Rebooting in 1 seconds..

The usual "tpl" doesn't seem to be working (to get to bootloader and flash the image back). Is it any different with V5 hw ?

Was able to resurrect the device using tftp flash back to stock and again to openwrt stable. Looks like the image needs some work.

hmm, I think the firmware splitter is not working, I"ll check that, but seems promising //

Great stuff! When you have a build ready, id be happy to test.

I think I was wrong with the firmware splitter, is not tplink type but denx,uimage, try this new image

also the recovery u-boot from first commit

Set your Ethernet adapter to 192.168.0.10. Enable your TFTP
server with the firmware image in the root named fw.bin
(can be any name, just change the tftp command that comes later)
When the router starts its boot process,
press β€œenter” to interrupt auto boot.

Enter the following commands:
tftp 0x80060000 fw.bin
erase 0x9f040000 +${filesize}
cp.b 0x80060000 0x9f040000 ${filesize}
reset

here are the links
factory https://drive.google.com/open?id=1rsiW0SB58mQ9BI9QhoiQyWbQQOR8xd94
sysupgrade https://drive.google.com/open?id=1jwfTodOhkVQavTMxbG-4a1yNk1_iOuZA

Based on Archer A7/C7 v5 work, I created ath79 DTS for Archer C7 v4 (see https://github.com/openwrt/openwrt/pull/1726). There are some fixes that I think should be also in C7 v5 (like missing LED aliases led-boot and others, and fixing ar8327 init values - if there are no LEDs on the back panel with ethernet ports, LED initialization is useless), but because I do not have one, I have not tried to fix them. So enjoy C7 v4 :slight_smile:

1 Like

What is the current status of NAND drivers with the ath79 target?

I've found a few posts from the June, 2018 timeframe suggesting that there was work to be done, as well as an inquiry in October, 2018.

The contents of build_dir/target-mips_24kc_musl/linux-ath79_nand/linux-4.14.93/drivers/mtd/, including nand/Kconfig, didn't provide any insight about available NAND drivers for the qca95xx chips (qca9563, of particular interest to me). Yes, my branch is a bit behind, based on commit 62dadcb86c from January 19, 2019.

Edit: I have since found https://github.com/openwrt/openwrt/pull/1428 which, in closing comment, states:

But it requires 4.19 to not have to backport pretty much the whole MTD and SPI subsystems_

Please re-spin the patch as soon as we have kernel 4.19 support. The approach was already NAK'ed upstream and I don't see much gain in adding the hack if the next major kernel in OpenWrt will provide a suitable solution.

Still interested in any updates on the topic.

At least 19.0x would still be on 4.14 AFAIK. But I suppose you're comfortable enough running master once that bumps to 4.19 :slight_smile:.

FYI, I have some ar71xx devices that don't seem to have been ported to ath79 :

  • HORNETUB (this seems to have disappeared from ar71xx snapshots ...)
  • onion-omega
  • carambola2
  • wpj344
  • wrt160nl

If there's anything I can do to help, let me know. In particular, I'm happy to test snapshots.

Thanks

Tried uploading an ath79 sysupgrade image from luci and command line for wr842nd/v1 and the upgrade aborted. Tried prebuilt image from snapshot and from self built image using imagebuilder and got same result.
"The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform."

Have used the prebuilt snapshot ath79 image for wr703 with no reported errors.
Am reluctant to try and force a sysupgrade on the wr842 device.
Tried searching the forum but haven't found anything that would suggest a way forward. Any suggestions on where to look/proceed?
edit: fixed typo, target device is wr842n/v1

1 Like

What does sysupgrade -v --test /tmp/your_upgrade_image return?

At least on current master, I don't see an image for the v1:

jeff@deb-devel:~/devel/openwrt/target/linux/ath79/image$ fgrep 841 * | fgrep 'define Device'
grep: lzma-loader: Is a directory
tiny-tp-link.mk:define Device/tplink_tl-wr841-v5
tiny-tp-link.mk:define Device/tplink_tl-wr841-v7
tiny-tp-link.mk:define Device/tplink_tl-wr841-v8
tiny-tp-link.mk:define Device/tplink_tl-wr841-v9
tiny-tp-link.mk:define Device/tplink_tl-wr841-v11

Edit: A new thread would be a good place to pose the question and receive responses, as this is somewhat off-topic.

My typo error should have been wr842n/v1 not 841
edit: new topic here https://forum.openwrt.org/t/ath79-image-builder-problem-for-wr842n-v1/30197?u=greybeard

1 Like

Jeff, I just had the same error on my netgear WNDR3800, and the command above gave:

root@netgear:/tmp# sysupgrade -v --test openwrt-ath79-generic-netgear_wndr3800-squashfs-sysupgrade.bin 
Device wndr3700 not supported by this image
Supported devices: netgear,wndr3800 wndr3800
Image check 'fwtool_check_image' failed.
root@netgear:/tmp# 

The current image installed is simply today's snapshot for openwrt-ar71xx-generic-wndr3800-squashfs-sysupgrade.bin

Maybe we need some adjustment on either version?