Porting guide ar71xx to ath79?

Yes, that's my point, the majority of us freeriders aren't going to build for ourselves..........

It's not difficult to build. Even installing linux is not required now. So it is a matter of being lazy.

Why it shouldn't be build by the bots?
It is the latest ar71xx build major release which means it will also receive the following 19.07.x minor releases.

source-only flag is not set to ar71xx target in openwrt-19.07 branch.

and BuildBot: http://buildbot.openwrt.org/openwrt-19.07/images/waterfall

2 Likes

Great thanks. I'm mistaken.

Hi guys,

currently I am trying to port the ZyXEL NBG6616 to ath79. I started porting when ath79 was still on kernel 4.14. While resuming work on that device some weeks ago, after rebasing onto current master (using kernel 4.19) i discovered that my device will no longer boot.

Bootlog 4.19:

U-Boot 2009.11 (Jan 20 2015 - 10:35:51)

NBG6616 - Scorpion 1.0
DRAM:  32bit ddr2 128 MB
Flash: 16 MB
*** Warning *** : PCIe WLAN Module not found !!!
Net:   eth0, eth1


ZyXEL zloader v1.41 (Jan 20 2015 - 11:02:19)
Multiboot clinent version: 1.2
dup 1 speed 1000

Hit any key to stop autoboot:  0
### JFFS2 loading '/boot/vmlinux.lzma.uImage' to 0x80400000
Scanning JFFS2 FS: '/boot/vmlinux.lzma.uImage' found, done
Loading file: done
### JFFS2 load complete: 1808626 bytes loaded to 0x80400000
## Booting kernel from Legacy Image at 80400000 ...
   Image Name:   MIPS OpenWrt Linux-4.19.69
   Created:      2019-08-31  11:32:46 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1808562 Bytes =  1.7 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA: uncompress or overwrite error 1 - must RESET board to recover

Bootlog 4.14:

U-Boot 2009.11 (Jan 20 2015 - 10:35:51)

NBG6616 - Scorpion 1.0
DRAM:  32bit ddr2 128 MB
Flash: 16 MB
*** Warning *** : PCIe WLAN Module not found !!!
Net:   eth0, eth1


ZyXEL zloader v1.41 (Jan 20 2015 - 11:02:19)
Multiboot clinent version: 1.2
dup 1 speed 1000

Hit any key to stop autoboot:  0
### JFFS2 loading '/boot/vmlinux.lzma.uImage' to 0x80400000
Scanning JFFS2 FS: '/boot/vmlinux.lzma.uImage' found, done
Loading file: done
### JFFS2 load complete: 1710940 bytes loaded to 0x80400000
## Booting kernel from Legacy Image at 80400000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.141
   Created:      2019-08-31  11:32:46 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1710876 Bytes =  1.6 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

My current patch can be found here.

Would be nice if someone has an idea on how to proceed here.
Thanks in advance

1 Like

well seeing it says overwrite error and your .19 is larger... first stop would be to slim it down to see if it resolves the issue... would it not?

yeah, that was my first thought as well but i tried it the other way around and made the kernel partition larger but ran into the same issue. Is it possible that there is a size restriction implemented inside uboot?

out of curiosity.... how did you come up with this?;

KERNEL_SIZE := 2048k
IMAGE_SIZE := 15323k
RAS_ROOTFS_SIZE := 14464k
  
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | pad-to 64k | check-size $$$$(IMAGE_SIZE) | zyxel-ras-image
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)

KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage

all the pad stuff seems worthy of investigation? ( grain of salt )

that stuff was copied directly from ar71xx

Has anybody encountered ar7242 based device with the 10/100 internal port actually being used?
I am now facing that with Edgeswitch 5XP which uses that port as a management port but under OpenWrt I cant get it to work.

Has anybody managed to get qca8k working with qca8337 switch?
I edited the DTS for my QCA9558 based board, enabled DSA and qca8k in kernel config and also disabled ar8216 but qca8k does not even throw any error

1 Like

tried before, couldn't get anything out of it

It really does not make sense, I would at least expect some error.

And I got it figured out, example binding was incorrect, it was fixed only earlier this year.
Now the switch gets registered, and ports are detected and brought up, but traffic still does not work.
Most likely some delays, those require some backporting.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/net/dsa/qca8k.txt?h=v5.4-rc4&id=fb1eb41a3dd4cfff274c98f3c3324ab329641298

1 Like

I'm not yet seeing any implementation of the port_vlan_* functions for qca8k, at least on Linux master. At least as far as I can tell, qca8k only supports port-based VLANs so far.

Are you aware of any development that would support "normal" VLANs with qca8k?

Not really, I am just trying to compare throughput on qca8k and old driver for now.
But even with tuning the delays, I can get any RX traffic

1 Like

I have been at it for a day now, but still cant get any traffic.
It looks like its sending some TX packets, but nothing is being received.
Its weird as ports are detected and speed auto negotiation works.
My current DTS config on QCA9558.

&mdio0 {
	status = "okay";

	phy_port1: phy@0 {
		reg = <0>;
	};

	phy_port2: phy@1 {
		reg = <1>;
	};

	switch@1f {
		compatible = "qca,qca8337";
		#address-cells = <1>;
		#size-cells = <0>;

		reg = <0x1f>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			port@0 {
				reg = <0>;
				label = "cpu";
				ethernet = <&eth0>;
				phy-mode = "rgmii-id";

 				fixed-link {
 					speed = <1000>;
 					full-duplex;
 				};
			};

			port@1 {
				reg = <1>;
				label = "wan";
				phy-handle = <&phy_port1>;
			};

			port@2 {
				reg = <2>;
				label = "lan";
				phy-handle = <&phy_port2>;
			};

			/*
			 * Disabled until DSA supports multiple CPUs,
			 * otherwise it causes undefined behavior.
			 *
			 * port@6 {
			 *	reg = <6>;
			 *	label = "cpu";
			 *	ethernet = <&gmac2>;
			 *	phy-mode = "sgmii";
			 *
 			 *	fixed-link {
 			 *		speed = <1000>;
 			 *		full-duplex;
 			 *	};
			 * };
			 */
		};
	};		
};

&eth0 {
	status = "okay";

	pll-data = <0xa6000000 0x00000101 0x00001616>;
	mtd-mac-address = <&art 0x0>;
	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

looks like zyxel had much fun with uboot-args:

NBG6616# printenv
baudrate=115200
ipaddr=192.168.1.1
serverip=192.168.1.33
uboot_env_ver=1.5
img_prefix=nbg6616-
loadaddr=80400000
readonly=ro
setmtdparts=setenv mtdparts mtdparts=spi0.0:${ldr_psize}(u-boot)${readonly},${env_psize}(env)${readonly},${rfdat_psize}(RFdata)${readonly},${rfsdat_psize}(rootfs_data),${romd_psize}(romd),${hdr_psize}(header),${rfs_psize}(rootfs)
flashargs=setenv bootargs board=NBG6616 root=/dev/mtdblock6 rootfstype=jffs2 noinitrd ${bootmode} ${zld_ver}
addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}
addmtd=setenv bootargs ${bootargs} ${mtdparts}
boot_flash=run setmtdparts flashargs addtty addmtd;fsload ${loadaddr} /boot/vmlinux.lzma.uImage;bootm ${loadaddr}
bootcmd=run boot_flash
ldr_paddr=0x9f000000
ldr_psize=0x30000
env_paddr=0x9f030000
env_psize=0x10000
rfdat_paddr=0x9f040000
rfdat_psize=0x10000
rfsdat_paddr=0x9f050000
rfsdat_psize=0x60000
romd_paddr=0x9f0b0000
romd_psize=0x60000
hdr_paddr=0x9f110000
hdr_psize=0x10000
rfs_paddr=0x9f120000
rfs_psize=0xee0000
lu=tftp ${loadaddr} ${dir}u-boot.bin;zflash erase ${ldr_paddr} ${ldr_psize};zflash write ${fileaddr} ${ldr_paddr} ${filesize}
lf=tftp ${loadaddr} ${dir}${img_prefix}rootfs.jffs2;nand erase ${rfs_paddr} ${rootfs_psize};nand write ${fileaddr} ${rfs_paddr} ${filesize}
hostname=NBG6616
serialnum=S150A14010294
countrycode=E1
ethaddr=90:EF:68:7E:AC:3C
stdin=serial
stdout=serial
stderr=serial
ver=U-Boot 2009.11 (Jan 20 2015 - 10:35:51)
boot_zld=bootm 9f020000
ethrotate=no
netretry=no
ethact=eth0

Environment size: 1489/65532 bytes

so i guess thats the problem which causes the failed boot, because mtdparts are too small. even if i resize it in the device tree, the device wont boot. is there any way to override those uboot-vars from device-tree?

You can use chosen node with bootargs property.
That should overide it, you can simply pass rootfs=squashfs,jffs2 and fixed partitions should take care of the rest.