[OpenWrt-Devel] [PATCH v2] base-files/hotplug: fix dedicated group for tty devices

2019-04-02 Thread Michael Heimpold
Commit 124ab1dc0a and 5523ee3459 introduced the assignment of the
group "tty" to /dev/tty* devices in order to support unprivileged
user access to serial devices.

However, due to an improperly rebased commit this feature broke.

This patch restores the lost hunk in hotplug.json file to
re-introduce this feature and also renames the existing "tty" group
to "dialout" as this is the more typical name for such a group
on desktop systems.

Fixes: 5209cfa534 ("procd: fix hotplug.json syntax")
Signed-off-by: Michael Heimpold 
---

@jow: I was not sure whether I should keep the group id 5 for dialout,
so I just compared the other group ids with my Debian system and found
that they are all equal. So I just decided to keep the 20 for dialout
to also match the Debian scheme. Please advice if you think we should
stay with 5 to not break any existing stuff?

 package/base-files/files/etc/group  | 2 +-
 package/system/procd/files/hotplug.json | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/group 
b/package/base-files/files/etc/group
index e8e2adf4ac..5b06dc6db9 100644
--- a/package/base-files/files/etc/group
+++ b/package/base-files/files/etc/group
@@ -1,8 +1,8 @@
 root:x:0:
 daemon:x:1:
 adm:x:4:
-tty:x:5:
 mail:x:8:
+dialout:x:20:
 audio:x:29:
 www-data:x:33:
 ftp:x:55:
diff --git a/package/system/procd/files/hotplug.json 
b/package/system/procd/files/hotplug.json
index 1c949bbea3..f676bac79e 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -20,6 +20,10 @@
[ "regex", "DEVNAME", "^snd" ],
[ "makedev", "/dev/%DEVNAME%", 
"0660", "audio" ]
],
+   [ "if",
+   [ "regex", "DEVNAME", "^tty" ],
+   [ "makedev", "/dev/%DEVNAME%", 
"0660", "dialout" ]
+   ],
[ "if",
[ "has", "DEVNAME" ],
[ "makedev", "/dev/%DEVNAME%", 
"0600" ]
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] ath79: add support for OCEDO Ursus

2019-04-02 Thread David Bauer
Hello,

I've tried your suggenstions on my unit (and try to provide some
information from my work with the other two APs from OCEDO/Riverbed).

On 02.04.19 00:19, Petr Štetiar wrote:
> markus.sche...@gmail.com  [2019-03-21 16:43:27]:
> 
> Hi,
> 
>> +label = "ursus:green:wlan2";
>> +label = "ursus:green:wlan5";
> 
> could we please make it wlan2g and wlan5g in order to stay consistent?
> 
> I found this old PR[1] for ar71xx, which makes me wonder if the stuff bellow
> is correct.
> 
>> + {
>> +status = "okay";
>> +
>> +phy1: ethernet-phy@1 {
>> +reg = <1>;
>> +};
>> +
> 
> In that ar71xx code it seems, that phy2 is connected through GMAC1/SGMII. Can
> you please explain in your commit message what is connected where in more
> details?

The OCEDO Ursus / Riverbed AP5r is a bit odd here as the MDIO lines for
the GMAC1 PHY is connected to the MDIO interface of GMAC0 (nothing
connected to GMAC1 MDIO). This is also how it's interfaced in the ar71xx
PR from last year ago.

> 
>> +phy2: ethernet-phy@2 {
>> +reg = <2>;
>> +};
>> +};
>> +
>> + {
>> +status = "okay";
> 
> add newline here
> 
>> +mtd-mac-address = < 0x00>;
>> +phy-handle = <>;
>> +pll-data = <0xa600 0x8101 0x80001313>;
> 
>   pll-data = <0xae00 0xa101 0xa0001313>;

I'm experiencing low throughput with this. The PLL-values from the PR
also match the ones i get via devmem from the vendor SteelWrt.

> 
> what is expected phy-mode here?

This information seems to be redundant to me as QCA9558 only supports
RGMII/SGMII and this information is already present in the inherited
qca9557.dtsi. While we could (theoretically) use the mux to switch the
interfaces between the GMACs i don't see support for it currently
neither in ar71xx nor ath79.

> 
>> + {
>> +status = "okay";
> 
> add newline here
> 
>> +mtd-mac-address = < 0x12>;
> 
>   mtd-mac-address = < 0xc>; ?

It seems the original firmware derives the MAC addresses for the
interfaces from the local OCEDO/Riverbed gateway the AP is connected to
(note the devices are not intended to be used independently). The device
itself has 4 unique addresses stored in the ART partition. The first one
used for eth0 (only MAC address matching the original firmware), the
other ones seem to be for IPSec tunnels but they are also device-unique.

Because of that, I've decided to distribute the 3 i had for the Raccoon
and Koala across eth0/wlan0/wlan1. This patch seems to match the scheme
of the existing two, adding the forth IP address to eth1, which i would
also aim for.

> 
>> +phy-handle = <>;
>> +pll-data = <0x3000101 0x101 0x1313>;
> 
> what is expected phy-mode here?
> 
>   pll-data = <0x030 0x101 0x1313>;

I get around ~2% of packet-loss with these. I know they are used in the
ar71xx PR, but as the ones currently used in this patch are matching the
ones from SteelWrt I'm more confident with whats present here.

Best wishes
David

> 
> 1. 
> https://github.com/openwrt/openwrt/pull/1016/commits/6bc138ec46ce956783aba7f8c83608982030a8be
> 
> -- ynezz
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [RFC] ath79: add support for COMFAST CF-E313AC

2019-04-02 Thread Roger Pueyo Centelles | Guifi.net
Hi,

Sorry for the inconvenience, but I'd like to insist on this topic since
it didn't get much traction on the first attempt.

I mostly succeeded in adding support for the COMFAST CF-E313AC devices,
but I ran into a couple of issues:

1) I need to remove the board-2.bin file shipped with the
ath10k-firmware-qca9888-ct so that the driver uses the actual
calibration data from the flash, dumped to board.bin (see [1]
)

2) the device has a 16MB SPI flash chip, but the stock firmware only
uses the first 8 MB, so I'm wasting the remaining 8 MB


I'd appreciate any comment on the topic. I also opened a pull request
(see [2] ) at GitHub,
where you're also very welcome to share your thoughts.

Thanks,

Roger


[1]
https://github.com/openwrt/openwrt/pull/1942/commits/9028a627bb9eb39ba74c9273cdf393bcd12c30cb#diff-8c41cbed377d406698f49b82d78a2057

[2] https://github.com/openwrt/openwrt/pull/1942

El 19/3/19 a les 13:33, Roger Pueyo Centelles ha escrit:
> Hi,
>
> I've just added support for the COMFAST CF-E313AC, an  outdoor wireless
> CPE with two Ethernet ports and a 802.11ac radio (see patch below).
>
> Everything is working fine but I've got two issues for which I'd like to
> get some advise:
>
> 1) target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
>
>I had to add "rm /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin", since
>the driver tries to board-2.bin (the default calibration data from the
>firmware package) first and, when that file is not found, falls back to
>board.bin (the calibration data read from the flash).
>
>I haven't seen this on any other device, so I guess there must be a more
>elegant way to deal with it. Any idea?
>
> 2) target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts
>
>The device is equipped with a "w25q128" flash chip (16384 Kbytes) but the
>stock firmware image only used half of it (nvram partition finishes at
>0x0080, i.e., 8192 Kbytes):
>
>*** stock firmware bootlog ***
> [...]
>[0.73] 0x-0x0001 : "u-boot"
>[0.74] 0x0001-0x0002 : "art"
>[0.74] 0x0002-0x001a : "kernel"
>[0.75] 0x001a-0x007e : "rootfs"
>[0.76] mtd: device 3 (rootfs) set to be root filesystem
>[0.76] 1 squashfs-split partitions found on MTD device rootfs
>[0.77] 0x006c-0x007e : "rootfs_data"
>[0.78] 0x007e-0x007f : "configs"
>[0.78] 0x007f-0x0080 : "nvram"
>[0.79] 0x0002-0x007e : "firmware"
> [...]
>
>Is there a way to use the remaining half of the flash?
>
>
> Any comments regarding these or other issues will be highly appreciated.
>
> Thanks!
>
>
>
> ---
>  .../ath79/base-files/etc/board.d/01_leds  |   9 ++
>  .../etc/hotplug.d/firmware/11-ath10k-caldata  |   7 +
>  .../ath79/dts/qca9531_comfast_cf-e313ac.dts   | 143 ++
>  target/linux/ath79/image/generic.mk   |   8 +
>  4 files changed, 167 insertions(+)
>  create mode 100644 target/linux/ath79/dts/qca9531_comfast_cf-e313ac.dts
>
> diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds 
> b/target/linux/ath79/base-files/etc/board.d/01_leds
> index db5a6a4578..50c9ca2a8d 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -47,6 +47,15 @@ comfast,cf-e120a-v3)
>   ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" 
> "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
>   ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" 
> "wlan0" "76" "100"
>   ;;
> +comfast,cf-e313ac)
> + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
> + ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" 
> "0x02"
> + ucidef_set_rssimon "wlan0" "20" "1"
> + ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" 
> "wlan0" "1" "100"
> + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" 
> "$boardname:red:rssimediumlow" "wlan0" "26" "100"
> + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" 
> "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
> + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" 
> "wlan0" "76" "100"
> + ;;
>  dlink,dir-859-a1)
>   ucidef_set_led_switch "internet" "WAN" "$boardname:green:internet" 
> "switch0" "0x20"
>   ;;
> diff --git 
> a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
> b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 8651c97099..3096c4e1e8 100644
> --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ 

Re: [OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M (XW)

2019-04-02 Thread Adrian Schmutzler
> -Original Message-
> From: Petr Štetiar [mailto:yn...@true.cz]
> Sent: Dienstag, 2. April 2019 15:15
> To: Adrian Schmutzler 
> Cc: openwrt-devel@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M
> (XW)
> 
> Adrian Schmutzler  [2019-04-02 14:07:39]:
> 
> Hi,
> 
> > > # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
> > > +# UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
> 
>  define Device/ubnt
>   UBNT_VERSION := 6.0.0
> 
> so it defaults to version 6.0.0 as it's used now, but it could be overriden if
> the board needs to, like for example `ubnt-xw` variant:
> 
>  define Device/ubnt-xw
>   UBNT_VERSION := 6.0.4
> 
> > Maybe include the 6.0.4 in the commented list of versions, depending on how
> literally you take the "e.g."
> 
> I've just backported it as it is in ath79 now, and I see no point to update
> comment each time we add new version :-) I think, that it's there mainly as an
> example of usage, rather then documentation for this variable.
> 
> Or do you find it as it is somehow misleading or unclear?
> 
> -- ynezz

Hi,

on first look I somehow assumed that the other lists are self-contained.

However, since this is not the case and the "e.g." is indicating that 
correctly, just leave it as it is.

Best

Adrian





pgpbjUW7Op0_s.pgp
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M (XW)

2019-04-02 Thread Petr Štetiar
Adrian Schmutzler  [2019-04-02 14:07:39]:

Hi,

> > # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
> > +# UBNT_VERSION e.g. one of (6.0.0, 8.5.0)

 define Device/ubnt
  UBNT_VERSION := 6.0.0

so it defaults to version 6.0.0 as it's used now, but it could be overriden if
the board needs to, like for example `ubnt-xw` variant:

 define Device/ubnt-xw
  UBNT_VERSION := 6.0.4

> Maybe include the 6.0.4 in the commented list of versions, depending on how 
> literally you take the "e.g."

I've just backported it as it is in ath79 now, and I see no point to update
comment each time we add new version :-) I think, that it's there mainly as an
example of usage, rather then documentation for this variable.

Or do you find it as it is somehow misleading or unclear?

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M (XW)

2019-04-02 Thread Adrian Schmutzler
LGTM, except one nitpick in 1/2:

[...]

> # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
> +# UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
>  define Device/ubnt

[...]

> +  UBNT_VERSION := 6.0.4

[...]

Maybe include the 6.0.4 in the commented list of versions, depending on how 
literally you take the "e.g."

Best

Adrian

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org] On
> Behalf Of Petr Štetiar
> Sent: Dienstag, 2. April 2019 13:27
> To: openwrt-devel@lists.openwrt.org
> Cc: Petr Štetiar 
> Subject: [OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M (XW)
> 
> Hi,
> 
> this two patches are adding support for Ubiquity Bullet M (XW) to ar71xx.
> 
> First patch which fixes factory image so it's usable on newer AirOS versions
> is basically just backport from ath79 and shouldn't hopefully introduce any
> regressions. Without this patch, I simply wasn't able to boot ar71xx factory
> image on my Bullet M2HP (XW).
> 
> Second patch is from my point of view simple addition of the board to ar71xx
> platform, and since there's already support for this device in ath79 for some
> time, I see no reason why it shouldn't be included in ar71xx as well.
> 
> Upgrade from ar71xx to ath79 works out of the box as well:
> 
>  root@OpenWrt:/# cat /tmp/sysinfo/board_name
>  bullet-m-xw
> 
>  root@OpenWrt:/# sysupgrade -v -n
> http://downloads.openwrt.org/snapshots/targets/
>  ath79/generic/openwrt-ath79-generic-ubnt_bullet-m-xw-squashfs-
> sysupgrade.bin
>  ...
>  Upgrade completed
> 
> Petr Štetiar (2):
>   ar71xx: ubnt-m-xw: Fix factory image flashing using TFTP recovery
>   ar71xx: Add support for Ubiquity Bullet M (XW)
> 
>  target/linux/ar71xx/base-files/etc/board.d/01_leds   |  1 +
>  .../linux/ar71xx/base-files/etc/board.d/02_network   |  1 +
>  target/linux/ar71xx/base-files/etc/diag.sh   |  1 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh |  3 +++
>  .../linux/ar71xx/base-files/lib/upgrade/platform.sh  |  1 +
>  .../ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c  |  3 +++
>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h   |  1 +
>  target/linux/ar71xx/image/generic-ubnt.mk| 20 
> ++--
>  8 files changed, 29 insertions(+), 2 deletions(-)
> 
> --
> 1.9.1
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


pgpDCKAZlGo3D.pgp
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ath79: ubnt-m-xw: Fix factory image flashing using TFTP recovery method

2019-04-02 Thread Petr Štetiar
Petr Štetiar  [2019-04-02 13:26:42]:

> Ubiquity allows flashing of unsigned factory images via TFTP recovery
> method[1]. They claim in airOS v6.0.7 release changelog[2] following:

Please don't bother with this patch, I've sent it accidentaly. Removed from
patchwork as well. Sorry for the noise.

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/2] ar71xx: Add support for Bullet M (XW)

2019-04-02 Thread Petr Štetiar
Hi,

this two patches are adding support for Ubiquity Bullet M (XW) to ar71xx.

First patch which fixes factory image so it's usable on newer AirOS versions
is basically just backport from ath79 and shouldn't hopefully introduce any
regressions. Without this patch, I simply wasn't able to boot ar71xx factory
image on my Bullet M2HP (XW).

Second patch is from my point of view simple addition of the board to ar71xx
platform, and since there's already support for this device in ath79 for some
time, I see no reason why it shouldn't be included in ar71xx as well.

Upgrade from ar71xx to ath79 works out of the box as well:

 root@OpenWrt:/# cat /tmp/sysinfo/board_name
 bullet-m-xw

 root@OpenWrt:/# sysupgrade -v -n 
http://downloads.openwrt.org/snapshots/targets/
 ath79/generic/openwrt-ath79-generic-ubnt_bullet-m-xw-squashfs-sysupgrade.bin
 ...
 Upgrade completed

Petr Štetiar (2):
  ar71xx: ubnt-m-xw: Fix factory image flashing using TFTP recovery
  ar71xx: Add support for Ubiquity Bullet M (XW)

 target/linux/ar71xx/base-files/etc/board.d/01_leds   |  1 +
 .../linux/ar71xx/base-files/etc/board.d/02_network   |  1 +
 target/linux/ar71xx/base-files/etc/diag.sh   |  1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh |  3 +++
 .../linux/ar71xx/base-files/lib/upgrade/platform.sh  |  1 +
 .../ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c  |  3 +++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h   |  1 +
 target/linux/ar71xx/image/generic-ubnt.mk| 20 ++--
 8 files changed, 29 insertions(+), 2 deletions(-)

-- 
1.9.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ath79: ubnt-m-xw: Fix factory image flashing using TFTP recovery method

2019-04-02 Thread Petr Štetiar
Ubiquity allows flashing of unsigned factory images via TFTP recovery
method[1]. They claim in airOS v6.0.7 release changelog[2] following:

 All future airOS versions will be signed in this way and not allow
 unsigned firmware to be loaded except via TFTP.

U-boot bootloader on M-XW devices expects factory image revision
version in specific format. On airOS v6.1.7 with `U-Boot 1.1.4-s1039
(May 24 2017 - 15:58:18)` bootloader checks if the revision major(?)
number is actually a number, but in currently generated images there's
OpenWrt text and so the check fails:

 Hit any key to stop autoboot:  0
 Setting default IP 192.168.1.20
 Starting TFTP server...
 Receiving file from 192.168.1.25:38438
 Received 4981148 bytes
 Firmware check failed! (1)

By placing arbitrary correct number first in major version, we make the
bootloader happy and we can flash factory images over TFTP again:

 Received 3735964 bytes
 Firmware Version: XW.ar934x.v6.0.4-42.r8474-56aa1ac-OpenWrt
 Setting U-Boot environment variables
 Un-Protected 1 sectors
 Erasing Flash done

Patch provided by AREDN[3] project, tested on Bullet M2 XW (ynezz) and
Nanostation M5 XW (ae6xe).

1. 
https://help.ubnt.com/hc/en-us/articles/204910124-UniFi-TFTP-Recovery-for-Bricked-Access-Points
2. https://dl.ubnt.com/firmwares/XW-fw/v6.0.7/changelog.txt
3. https://github.com/aredn

Signed-off-by: Petr Štetiar 
---
 target/linux/ath79/image/generic-ubnt.mk | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/target/linux/ath79/image/generic-ubnt.mk 
b/target/linux/ath79/image/generic-ubnt.mk
index 2d0b1ad..66c16e4 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -1,4 +1,9 @@
-DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION
+DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION
+
+# On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like
+# VERSION_DIST being on the place of major(?) version number, so we need to
+# use some number.
+UBNT_REVISION := $(VERSION_DIST)-$(REVISION)
 
 # mkubntimage is using the kernel image direct
 # routerboard creates partitions out of the ubnt header
@@ -17,7 +22,7 @@ define Build/mkubntimage-split
dd if=$@ of=$@.old1 bs=1024k count=1; \
dd if=$@ of=$@.old2 bs=1024k skip=1; \
$(STAGING_DIR_HOST)/bin/mkfwimage \
-   -B $(UBNT_BOARD) -v 
$(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(VERSION_DIST)-$(REVISION) \
+   -B $(UBNT_BOARD) -v 
$(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \
-k $@.old1 \
-r $@.old2 \
-o $@; \
@@ -69,6 +74,7 @@ define Device/ubnt-xw
   UBNT_CHIP := ar934x
   UBNT_BOARD := XM
   UBNT_VERSION := 6.0.4
+  UBNT_REVISION := 42.$(UBNT_REVISION)
   ATH_SOC := ar9342
 endef
 
-- 
1.9.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] ar71xx: Add support for Ubiquity Bullet M (XW)

2019-04-02 Thread Petr Štetiar
CPU: AR9342 SoC
RAM: 64 MB DDR2
Flash:8 MB NOR SPI
Ports:  100 MBit (24V PoE in)
WLAN: 2.4/5 GHz
UART: 1 UART on PCB marked as J1 with 115200 8N1 config
LEDs:   Power, Ethernet, 4x RSSI LEDs (orange, red, 2x green)
Buttons:Reset

UART connection details

  .-.
  | |
[ETH]  J1 [ANT]
  |o VCC o RX o TX o GND|
  `-'

Flashing instructions using recovery method over TFTP

 1. Unplug the ethernet cable from the router.
 2. Using paper clip press and hold the router's reset button. Make sure
you can feel it depressed by the paper clip. Do not release the button
until step 4.
 3. While keeping the reset button pressed in, plug the ethernet cable
back into the AP. Keep the reset button depressed until you see the
device's LEDs flashing in upgrade mode (alternating LED1/LED3 and
LED2/LED4), this may take up to 25 seconds.
 4. You may release the reset button, now the device should be in TFTP
transfer mode.
 5. Set a static IP on your Computer's NIC. A static IP of 192.168.1.25/24
should work.
 6. Plug the PoE injector's LAN cable directly to your computer.
 7. Start tftp client and issue following commands:
 tftp> binary
 tftp> connect 192.168.1.20
 tftp> put openwrt-ar71xx-generic-ubnt-bullet-m-xw-squashfs-factory.bin

Tested only on Bullet M2HP.

Signed-off-by: Petr Štetiar 
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds   | 1 +
 target/linux/ar71xx/base-files/etc/board.d/02_network| 1 +
 target/linux/ar71xx/base-files/etc/diag.sh   | 1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +++
 target/linux/ar71xx/base-files/lib/upgrade/platform.sh   | 1 +
 target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c | 3 +++
 target/linux/ar71xx/files/arch/mips/ath79/machtypes.h| 1 +
 target/linux/ar71xx/image/generic-ubnt.mk| 7 +++
 8 files changed, 18 insertions(+)

diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds 
b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 79f452d..41dd8c5 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -179,6 +179,7 @@ bsb)
ucidef_set_led_default "sys" "SYS" "$board:red:sys" "1"
;;
 bullet-m|\
+bullet-m-xw|\
 loco-m-xw|\
 nanostation-m|\
 nanostation-m-xw|\
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network
index a7b97bb..8e5ff10 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -68,6 +68,7 @@ ar71xx_setup_interfaces()
ap91-5g|\
aw-nr580|\
bullet-m|\
+   bullet-m-xw|\
c-55|\
cap324|\
cap4200ag|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 5565426..558f338 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -129,6 +129,7 @@ get_status_led() {
status_led="$board:red:sys"
;;
bullet-m|\
+   bullet-m-xw|\
loco-m-xw|\
nano-m|\
nanostation-m|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 56a4fab..990683a 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -530,6 +530,9 @@ ar71xx_board_detect() {
name="bullet-m"
ubnt_xm_board_detect
;;
+   *"Bullet M XW")
+   name="bullet-m-xw"
+   ;;
*"BXU2000n-2 rev. A1")
name="bxu2000n-2-a1"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 7fc3d4e..8173501 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -218,6 +218,7 @@ platform_check_image() {
archer-c7-v4|\
archer-c7-v5|\
bullet-m|\
+   bullet-m-xw|\
c-55|\
carambola2|\
cf-e316n-v2|\
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c
index ba79537..6ceb91e 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c
@@ -656,6 +656,9 @@ MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", 
"Ubiquiti Loco M XW",
 MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW",
 ubnt_rocket_m_xw_setup);
 
+MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M_XW, "UBNT-BM-XW", "Ubiquiti Bullet M XW",
+ubnt_rocket_m_xw_setup);
+
 

[OpenWrt-Devel] [PATCH 1/2] ar71xx: ubnt-m-xw: Fix factory image flashing using TFTP recovery

2019-04-02 Thread Petr Štetiar
This is backport of the same functionality in ath79, from commit
 d42a7c469 ("ath79: ubnt-m-xw: Fix factory image flashing using TFTP
 recovery method")

Ubiquity allows flashing of unsigned factory images via TFTP recovery
method[1]. They claim in airOS v6.0.7 release changelog[2] following:

 All future airOS versions will be signed in this way and not allow
 unsigned firmware to be loaded except via TFTP.

U-boot bootloader on M-XW devices expects factory image revision
version in specific format. On airOS v6.1.7 with `U-Boot 1.1.4-s1039
(May 24 2017 - 15:58:18)` bootloader checks if the revision major(?)
number is actually a number, but in currently generated images there's
OpenWrt text and so the check fails:

 Hit any key to stop autoboot:  0
 Setting default IP 192.168.1.20
 Starting TFTP server...
 Receiving file from 192.168.1.25:38438
 Received 4981148 bytes
 Firmware check failed! (1)

By placing arbitrary correct number first in major version, we make the
bootloader happy and we can flash factory images over TFTP again:

 Received 3801500 bytes
 Firmware Version: XW.ar934x.v6.0.4-42.OpenWrt-r9766+2-be42e44
 Setting U-Boot environment variables
 Un-Protected 1 sectors
 Erasing Flash done

Patch provided by AREDN[3] project, tested on Bullet M2 XW.

1. 
https://help.ubnt.com/hc/en-us/articles/204910124-UniFi-TFTP-Recovery-for-Bricked-Access-Points
2. https://dl.ubnt.com/firmwares/XW-fw/v6.0.7/changelog.txt
3. https://github.com/aredn

Signed-off-by: Petr Štetiar 
---
 target/linux/ar71xx/image/generic-ubnt.mk | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/image/generic-ubnt.mk 
b/target/linux/ar71xx/image/generic-ubnt.mk
index 5db5c87..84471a5 100644
--- a/target/linux/ar71xx/image/generic-ubnt.mk
+++ b/target/linux/ar71xx/image/generic-ubnt.mk
@@ -1,4 +1,9 @@
-DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE
+DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION UBNT_REVISION
+
+# On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like
+# VERSION_DIST being on the place of major(?) version number, so we need to
+# use some number.
+UBNT_REVISION := $(VERSION_DIST)-$(REVISION)
 
 # mkubntimage is using the kernel image direct
 # routerboard creates partitions out of the ubnt header
@@ -17,7 +22,7 @@ define Build/mkubntimage-split
dd if=$@ of=$@.old1 bs=1024k count=1; \
dd if=$@ of=$@.old2 bs=1024k skip=1; \
$(STAGING_DIR_HOST)/bin/mkfwimage \
-   -B $(UBNT_BOARD) -v 
$(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-$(REVISION) \
+   -B $(UBNT_BOARD) -v 
$(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-$(UBNT_REVISION) \
-k $@.old1 \
-r $@.old2 \
-o $@; \
@@ -36,12 +41,14 @@ endef
 # UBNT_BOARD e.g. one of (XS2, XS5, RS, XM)
 # UBNT_TYPE e.g. one of (BZ, XM, XW)
 # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x)
+# UBNT_VERSION e.g. one of (6.0.0, 8.5.0)
 define Device/ubnt
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   DEVICE_PROFILE := UBNT
   IMAGE_SIZE := 7552k
   MTDPARTS := 
spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
   UBNT_BOARD := XM
+  UBNT_VERSION := 6.0.0
   IMAGES := sysupgrade.bin factory.bin
   IMAGE/sysupgrade.bin := append-kernel | pad-to (BLOCKSIZE) | 
append-rootfs | pad-rootfs | check-size (IMAGE_SIZE)
   IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage-split
@@ -60,6 +67,8 @@ define Device/ubnt-xw
   DEVICE_PACKAGES += rssileds
   UBNT_TYPE := XW
   UBNT_CHIP := ar934x
+  UBNT_VERSION := 6.0.4
+  UBNT_REVISION := 42.$(UBNT_REVISION)
 endef
 
 define Device/ubnt-bz
-- 
1.9.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] ath79: Utilize tplink-safeloader definition

2019-04-02 Thread Adrian Schmutzler
Currently, tplink-safeloader definition is only used as base for
another common definition, while multiple devices just repeat
the same relevant parameters in their definitions.

This patch adjusts tplink-safeloader so it can be actually used
for some targets in generic-tp-link.mk.

The only functional (i.e. non-cosmetic) change introduced with
this patch is the consistent use of "check-size (IMAGE_SIZE)".

Run-tested on TP-Link CPE210 v2.

Tested-by: Adrian Schmutzler 
Signed-off-by: Adrian Schmutzler 

---

Changes in v2:
- Include CPE210 v2/v3
- Rebased
- Improved commit description/justification
---
 target/linux/ath79/image/common-tp-link.mk  |  6 --
 target/linux/ath79/image/generic-tp-link.mk | 20 +++-
 2 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/target/linux/ath79/image/common-tp-link.mk 
b/target/linux/ath79/image/common-tp-link.mk
index f22da2f801..9054284114 100644
--- a/target/linux/ath79/image/common-tp-link.mk
+++ b/target/linux/ath79/image/common-tp-link.mk
@@ -99,12 +99,14 @@ endef
 
 define Device/tplink-safeloader
   $(Device/tplink)
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header
-  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | 
append-metadata
+  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
+  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
+append-metadata | check-size (IMAGE_SIZE)
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
 
 define Device/tplink-safeloader-uimage
   $(Device/tplink-safeloader)
   KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma
+  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | 
append-metadata
 endef
diff --git a/target/linux/ath79/image/generic-tp-link.mk 
b/target/linux/ath79/image/generic-tp-link.mk
index e3a0abeb5f..ecc34b88e0 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -117,7 +117,6 @@ define Device/tplink_cpe210-v2
   TPLINK_BOARD_ID := CPE210V2
   DEVICE_PACKAGES := rssileds
   LOADER_TYPE := elf
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
   SUPPORTED_DEVICES += cpe210-v2
 endef
 TARGET_DEVICES += tplink_cpe210-v2
@@ -130,13 +129,12 @@ define Device/tplink_cpe210-v3
   DEVICE_PACKAGES := rssileds
   TPLINK_BOARD_ID := CPE210V3
   LOADER_TYPE := elf
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
   SUPPORTED_DEVICES += cpe210-v3
 endef
 TARGET_DEVICES += tplink_cpe210-v3
 
 define Device/tplink_re350k-v1
-  $(Device/tplink)
+  $(Device/tplink-safeloader)
   ATH_SOC := qca9558
   IMAGE_SIZE := 13760k
   DEVICE_TITLE := TP-Link RE350K v1
@@ -144,15 +142,11 @@ define Device/tplink_re350k-v1
   TPLINK_BOARD_ID := RE350K-V1
   TPLINK_HWID := 0x0
   TPLINK_HWREV := 0
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
-  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
-check-size (IMAGE_SIZE) | append-metadata
-  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
 TARGET_DEVICES += tplink_re350k-v1
 
 define Device/tplink_re450-v2
-  $(Device/tplink)
+  $(Device/tplink-safeloader)
   ATH_SOC := qca9563
   IMAGE_SIZE := 6016k
   DEVICE_TITLE := TP-Link RE450 v2
@@ -161,10 +155,6 @@ define Device/tplink_re450-v2
   TPLINK_HWREV := 0
   TPLINK_BOARD_ID := RE450-V2
   LOADER_TYPE := elf
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
-  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
-append-metadata | check-size (IMAGE_SIZE)
-  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
 TARGET_DEVICES += tplink_re450-v2
 
@@ -274,17 +264,13 @@ endef
 TARGET_DEVICES += tplink_tl-wr1043nd-v3
 
 define Device/tplink_tl-wr1043nd-v4
-  $(Device/tplink)
+  $(Device/tplink-safeloader)
   ATH_SOC := qca9563
   IMAGE_SIZE := 15552k
   DEVICE_TITLE := TP-Link TL-WR1043N/ND v4
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
   TPLINK_HWID := 0x10430004
   TPLINK_BOARD_ID := TLWR1043NDV4
-  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
-  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
-append-metadata | check-size (IMAGE_SIZE)
-  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
   SUPPORTED_DEVICES += tl-wr1043nd-v4
 endef
 TARGET_DEVICES += tplink_tl-wr1043nd-v4
-- 
2.11.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel