Flashing the Ubiquiti Unifi UAP v2

It's not the same hardware, the Nanostation has two Ethernet ports and the UAP only has one. In both cases though I think the AR7241 internal switch is involved. (this is because the bootloader recovery expects to TFTP from what would be a "LAN" port on a 5 port router, not the separate un-switched WAN port). So even though only one of the five PHYs on the AR7241 is actually wired out to a physical port, it is one of the switched ones.

For snapshot builds consider the "LAN enumeration" note from the Nanostation page:

These should still be swconfig based. Is the swconfig command present? Does it show the switch port going up and down as the network cable is plugged and unplugged (on the other side of the POE injector of course).

In 19.07.6 ubnt_unifi build eth0 works fine and there is no switch in config: swconfig list shows nothing.

in snapshot ubnt_unifi build eth0 doesn't work, link state of eth0 is always down and can't be brought up. There is a switch in configuration:

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        ar8xxx_mib_poll_interval: 500
        ar8xxx_mib_type: 0
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
        arl_table: address resolution table

Port 0:
        mib: No MIB data
        pvid: 0
        link: port:0 link:up speed:10baseT half-duplex 
Port 1:
        mib: No MIB data
        pvid: 0
        link: port:1 link:up speed:10baseT half-duplex 
Port 2:
        mib: No MIB data
        pvid: 0
        link: port:2 link:up speed:10baseT half-duplex 
Port 3:
        mib: No MIB data
        pvid: 0
        link: port:3 link:up speed:10baseT half-duplex 
Port 4:
        mib: No MIB data
        pvid: 0
        link: port:4 link:up speed:10baseT half-duplex 
root@OpenWrt:/#

in snapshot ubnt_nanostation-m build eth0 doesn't work, link state of eth0 can be brought up, thou cable plug/unplug is not recognized. There is a switch in configuration:

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        ar8xxx_mib_poll_interval: 500
        ar8xxx_mib_type: 0
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
        arl_table: address resolution table

Port 0:
        mib: No MIB data
        pvid: 0
        link: port:0 link:up speed:10baseT half-duplex 
Port 1:
        mib: No MIB data
        pvid: 0
        link: port:1 link:up speed:10baseT half-duplex 
Port 2:
        mib: No MIB data
        pvid: 0
        link: port:2 link:up speed:10baseT half-duplex 
Port 3:
        mib: No MIB data
        pvid: 0
        link: port:3 link:up speed:10baseT half-duplex 
Port 4:
        mib: No MIB data
        pvid: 0
        link: port:4 link:up speed:10baseT half-duplex
 root@OpenWrt:/# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
    link/ether 02:27:22:0a:22:85 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::27:22ff:fe0a:2285/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN qlen 1000
    link/ether 00:27:22:0a:22:85 brd ff:ff:ff:ff:ff:ff
    inet 172.16.66.180/24 brd 172.16.66.255 scope global eth1
       valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:27:22:0b:22:85 brd ff:ff:ff:ff:ff:ff

Still struggling. my /etc/board.json looks like this:

root@OpenWrt:~# cat /etc/board.json
{
	"model": {
		"id": "ubnt,unifi",
		"name": "Ubiquiti UniFi"
	},
	"network": {
		"lan": {
			"device": "eth0",
			"protocol": "static"
		}
	},
	"system": {
		"label_macaddr": "00:27:22:0b:22:85"
	}
}
root@OpenWrt:~#

and this is strange for me, that there is no switch section in there and there is a switch in the system.
BTW, how do your /etc/config/network, /etc/board.json and swconfig dev switch0 show look like?

And one more strange thing I've found

kernel log of 19.07.7 unifi build with working eth0 contains this:

[    1.418811] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:04 [uid=004dd041, driver=Generic PHY]
[    1.428871] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii

kernel log of snapshot unifi build with broken eth0 contains this:

[    1.222054] switch0: Atheros AR724X/AR933X built-in rev. 0 switch registered on mdio.0
[    1.606583] ag71xx 19000000.eth: connected to PHY at mdio.0:1f:04 [uid=00000000, driver=Generic PHY]
[    1.616800] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii

kernel log of snapshot nanostation build with semi-working eth0 contains this:

[    1.842266] switch0: Atheros AR724X/AR933X built-in rev. 0 switch registered on mdio.0
[    1.926945] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.936995] eth0: Atheros AG71xx at 0xba000000, irq 5, mode: gmii

As you may note, ag71xx connects to PHY different way in all 3 cases. I think this is the reason of broken eth0. Is there any way to control this?

I managed to build an image that works fine on my unifi ap. I've just changed in target/linux/ath79/dts/ar7241_ubnt_unifi.dtsi

#include "ar7241.dtsi" -> #include "ar7240.dtsi"

and rebuild the system. That's it.

Hi
Were you able to flash it permantly at last?
Thank you

It's a v1 or a v2?
Thank you

Hi, no. The devices are currently just running the initramfs-build and are connected to a UPS. So far, they are working well enough, but will be replaced with a different system in time.