Re: [OpenWrt-Devel] [CC 15.05] polarssl: Security update (CVE-2015-5291)

2015-11-27 Thread Stefan Peter
Dear all
Am 24.11.2015 um 16:43 schrieb j...@openwrt.org:
> The polarssl package has been rebuilt and was uploaded to the Chaos
> Calmer 15.05 repository due to a reported security issue.

Why does this not show up in the CC git tree?
> 
> REFERENCES
> 
...

>  * 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=72f741c118ac89f4fb6f03211227ec86c2eb5f6d
>  * 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=c3eab1cd32f7576a9aa21f7554cb31daeaab5e3b
>  * 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=56ac71722f0d275a1f1a04b4a1bc0e00303ebfcd
>  * 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=cef3ed688e2e7a8521ad386b64849258087f4f9c
>  * 
> http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=ed8b2452a211dc09c85e73f252d8922ee7e2efd0


all return '404 - Unknown commit object'


With kind regards

Stefan Peter
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lldpd: add STOP=01 param in init script

2015-11-27 Thread Alexandru Ardelean
From: Alexandru Ardelean 

This should ensure that lldpd is among the first processes to stop,
so that it has time to send the shutdown LLDPU to the other side,
before the network goes down.

Signed-off-by: Alexandru Ardelean 
---
 package/network/services/lldpd/files/lldpd.init | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/network/services/lldpd/files/lldpd.init 
b/package/network/services/lldpd/files/lldpd.init
index 04e5b8c..6965189 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -1,7 +1,8 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2008-2012 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 
 START=90
+STOP=01
 
 USE_PROCD=1
 LLDPCLI=/usr/sbin/lldpcli
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [CC 15.05] polarssl: Security update (CVE-2015-5291)

2015-11-27 Thread francesco . borromini
Probably because it's in the packages tree, which is separate. You'll find it 
in the log there.

> Message: 3 
> Date: Fri, 27 Nov 2015 10:39:12 +0100 
> From: Stefan Peter  
> To: openwrt-devel@lists.openwrt.org 
> Subject: Re: [OpenWrt-Devel] [CC 15.05] polarssl: Security update 
> (CVE-2015-5291) 
> Message-ID: <565824c0.3020...@gmail.com> 
> Content-Type: text/plain; charset=windows-1252 
>
> Dear all 
> Am 24.11.2015 um 16:43 schrieb j...@openwrt.org: 
> > The polarssl package has been rebuilt and was uploaded to the Chaos 
> > Calmer 15.05 repository due to a reported security issue. 
>
> Why does this not show up in the CC git tree? 
> > 
> > REFERENCES 
> > 
> ... 
>
> >  * 
> >http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=72f741c118ac89f4fb6f03211227ec86c2eb5f6d
> > 
> >  * 
> >http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=c3eab1cd32f7576a9aa21f7554cb31daeaab5e3b
> > 
> >  * 
> >http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=56ac71722f0d275a1f1a04b4a1bc0e00303ebfcd
> > 
> >  * 
> >http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=cef3ed688e2e7a8521ad386b64849258087f4f9c
> > 
> >  * 
> >http://git.openwrt.org/?p=15.05/openwrt.git;a=commit;h=ed8b2452a211dc09c85e73f252d8922ee7e2efd0
> > 
>
>
> all return '404 - Unknown commit object' 
>
>
> With kind regards 
>
> Stefan Peter 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] b53: add 'flush_arl' command per port

2015-11-27 Thread Alexandru Ardelean
This would in essence re-use the current b53_flush_arl() function
with the added part that we can select a single port to flush ARL for.

Signed-off-by: Alexandru Ardelean 

---
 .../generic/files/drivers/net/phy/b53/b53_common.c | 29 ++
 .../generic/files/drivers/net/phy/b53/b53_regs.h   |  4 +++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 859d8d1..8c8d217 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -336,12 +336,17 @@ static int b53_set_jumbo(struct b53_device *dev, int 
enable, int allow_10_100)
return b53_write16(dev, B53_JUMBO_PAGE, dev->jumbo_size_reg, max_size);
 }
 
-static int b53_flush_arl(struct b53_device *dev)
+static int b53_flush_arl(struct b53_device *dev, int port)
 {
unsigned int i;
+   u8 age_ctrl = FAST_AGE_DONE | FAST_AGE_DYNAMIC | FAST_AGE_STATIC;
 
-   b53_write8(dev, B53_CTRL_PAGE, B53_FAST_AGE_CTRL,
-  FAST_AGE_DONE | FAST_AGE_DYNAMIC | FAST_AGE_STATIC);
+   if (port > -1 && port < B53_N_PORTS) {
+   b53_write8(dev, B53_CTRL_PAGE, B53_FAST_AGE_PORT_CTRL, 
FAST_AGE_SINGLE_PORT(port));
+   age_ctrl |= FAST_AGE_PORT;
+   }
+
+   b53_write8(dev, B53_CTRL_PAGE, B53_FAST_AGE_CTRL, age_ctrl);
 
for (i = 0; i < 10; i++) {
u8 fast_age_ctrl;
@@ -355,7 +360,7 @@ static int b53_flush_arl(struct b53_device *dev)
mdelay(1);
}
 
-   pr_warn("time out while flushing ARL\n");
+   pr_warn("time out while flushing ARL, port %d\n", port);
 
return -EINVAL;
 }
@@ -565,7 +570,7 @@ static int b53_switch_reset(struct b53_device *dev)
 
b53_enable_mib(dev);
 
-   return b53_flush_arl(dev);
+   return b53_flush_arl(dev, -1);
 }
 
 /*
@@ -890,6 +895,14 @@ static int b53_port_get_mib(struct switch_dev *sw_dev,
return 0;
 }
 
+static int b53_port_flush_arl(struct switch_dev *sw_dev,
+   const struct switch_attr *attr,
+   struct switch_val *val)
+{
+   struct b53_device *dev = sw_to_b53(sw_dev);
+   return b53_flush_arl(dev, val->port_vlan);
+}
+
 static struct switch_attr b53_global_ops_25[] = {
{
.type = SWITCH_TYPE_INT,
@@ -976,6 +989,12 @@ static struct switch_attr b53_port_ops[] = {
.description = "Get port's MIB counters",
.get = b53_port_get_mib,
},
+   {
+   .type = SWITCH_TYPE_NOVAL,
+   .name = "flush_arl",
+   .description = "Flush ARL",
+   .set = b53_port_flush_arl,
+   },
 };
 
 static struct switch_attr b53_no_ops[] = {
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h 
b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
index 144e1c8..138d26b 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
@@ -135,6 +135,10 @@
 #define   FAST_AGE_MC  BIT(5)
 #define   FAST_AGE_DONEBIT(7)
 
+/* Fast Aging Port Control register (8 bit) */
+#define B53_FAST_AGE_PORT_CTRL 0x89
+#define   FAST_AGE_SINGLE_PORT(p)  ((u8)(0xf & p))
+
 /*
  * Status Page registers
  */
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] rtl8xxxu: Add new driver for Realtek WiFi USB devices

2015-11-27 Thread Felix Fietkau
On 2015-11-26 17:22, Bruno Randolf wrote:
> On 11/26/2015 04:04 PM, W. Michael Petullo wrote:
>>> This new driver supports RTL8723AU, RTL8188CU, RTL8188RU, RTL8191CU, and
>>> RTL8192CU and is taken from:
>>> https://git.kernel.org/cgit/linux/kernel/git/jes/linux.git/log/?h=rtl8723au-mac80211
>> 
>> Has there been any progress getting this merged?
> 
> Yes, AFAIK rtl8xxxu has been merged into the next 4.4 kernel.
> 
> No idea if OpenWRT plans to update mac80211/backports to a newer version
> any time soon, but that would be the most straightforward way to get
> this driver into OpenWRT.
I plan on doing another update soon, maybe even next week.

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


Re: [OpenWrt-Devel] fstools: factory reset on power failure during startup

2015-11-27 Thread Florian Eckert
Hi,

I have tested your patch since last day when I got the patch from you.
I am using an programmable dc/dc power supply, who switches the power
between startup randomly.
I will run the test during the weekend. And then I will see what
happend on Monday morning.
But for now i havn't lost the configuration anymore.

Flo


2015-11-26 14:25 GMT+01:00 Florian Eckert :
> Hi,
>
> thank your very much for your fast reply and the fix :-).
> I will try it and give you an respond.
>
> flo
>
> 2015-11-26 14:05 GMT+01:00 Felix Fietkau :
>> On 2015-11-26 09:24, Florian Eckert wrote:
>>> Hi,
>>>
>>> I am using openwrt CC and an ubifs filesystem on top of ubi.
>>> If I plug off the power during startup, some times my configuration
>>> get lost and i am back to factory reset.
>>>
>>> In the package fstools there is the bin "mount_root" it is called
>>> twice during startup.
>>> 1. S10boot at line 10
>>> 2. S95done at line 6
>>>
>>> this calles edit the ./fs_state link
>>>
>>> S10boot/S95done:
>>> ---
>>> Because ubifs is doing filesystem handling in a background process
>>> "ubi_bgt0d", could it be possible,
>>> that (see code) ./.fs_state is not rewritten written anymore?
>>> So that at next boot the system thinks he is in upgrade mode?
>>>
>>> If I add a sleep(10) between unlink and symlink function call i can
>>> reproduce the failure if i unplug the power.
>>> I think the first think what should be done is to call
>>> "snprintf(valstr, sizeof(valstr), "%d", state);" before "unlink(path).
>>>
>>> Or this this a deeper Problem?
>> I think you're right that there's a race here. When I wrote this code,
>> I never actually intended for the file to get re-written after the
>> first boot, it seems that I simply forgot to add the necessary check
>> for it.
>> Please test if this fstools patch fixes the problem:
>> ---
>> --- a/libfstools/overlay.c
>> +++ b/libfstools/overlay.c
>> @@ -311,6 +311,9 @@ int fs_state_set(const char *dir, enum fs_state state)
>> char valstr[16];
>> char *path;
>>
>> +   if (fs_state_get(dir) == state)
>> +   return 0;
>> +
>> path = alloca(strlen(dir) + 1 + sizeof("/.fs_state"));
>> sprintf(path, "%s/.fs_state", dir);
>> unlink(path);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] mac80211: install new firmware for ath9k-htc on target

2015-11-27 Thread Alexey Brodkin
For quite some time new firmware for ath9k-htc devices
is available in
http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ath9k_htc/

Moreover ath9k-htc kernel driver expects this new v1.4
firmware to exist in /lib/firmware/ath9k_htc.

What happens currently:
>8--
[7.83] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
requested
[7.84] usb 1-1: Direct firmware load for
ath9k_htc/htc_9271-1.4.0.fw failed with error -2
[7.85] usb 1-1: Falling back to user helper
[7.87] usbcore: registered new interface driver ath9k_htc
[7.88] firmware ath9k_htc!htc_9271-1.4.0.fw:
firmware_loading_store: map pages failed
[7.89] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
[8.20] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size:
50980
[8.44] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
credits
[   10.72] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[   10.74] ath9k_htc 1-1:1.0: FW RMW support: Off
[   10.76] ieee80211 phy0: Atheros AR9271 Rev:1
>8--

And with that patch new firmware is used instead:
>8--
[   33.92] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
requested
[   34.23] usb 1-1: ath9k_htc: Transferred FW:
ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[   34.48] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
credits
[   34.74] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.4
[   34.75] ath9k_htc 1-1:1.0: FW RMW support: On
>8--

Signed-off-by: Alexey Brodkin 
Cc: Felix Fietkau 
---
 package/kernel/mac80211/Makefile | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 4b4f774..7165fc3 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -1828,6 +1828,11 @@ define KernelPackage/ath9k-htc/install
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
$(1)/lib/firmware/
+   $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
+   $(INSTALL_DATA) \
+   
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_9271-1.4.0.fw \
+   
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_7010-1.4.0.fw \
+   $(1)/lib/firmware/ath9k_htc
 endef
 
 define KernelPackage/b43/install
-- 
2.5.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mac80211: install new firmware for ath9k-htc on target

2015-11-27 Thread Hauke Mehrtens
On 11/27/2015 04:36 PM, Alexey Brodkin wrote:
> For quite some time new firmware for ath9k-htc devices
> is available in
> http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ath9k_htc/
> 
> Moreover ath9k-htc kernel driver expects this new v1.4
> firmware to exist in /lib/firmware/ath9k_htc.
> 
> What happens currently:
> >8--
> [7.83] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
> requested
> [7.84] usb 1-1: Direct firmware load for
> ath9k_htc/htc_9271-1.4.0.fw failed with error -2
> [7.85] usb 1-1: Falling back to user helper
> [7.87] usbcore: registered new interface driver ath9k_htc
> [7.88] firmware ath9k_htc!htc_9271-1.4.0.fw:
> firmware_loading_store: map pages failed
> [7.89] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
> [8.20] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size:
> 50980
> [8.44] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
> credits
> [   10.72] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
> [   10.74] ath9k_htc 1-1:1.0: FW RMW support: Off
> [   10.76] ieee80211 phy0: Atheros AR9271 Rev:1
> >8--
> 
> And with that patch new firmware is used instead:
> >8--
> [   33.92] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
> requested
> [   34.23] usb 1-1: ath9k_htc: Transferred FW:
> ath9k_htc/htc_9271-1.4.0.fw, size: 51008
> [   34.48] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
> credits
> [   34.74] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.4
> [   34.75] ath9k_htc 1-1:1.0: FW RMW support: On
> >8--
> 
> Signed-off-by: Alexey Brodkin 
> Cc: Felix Fietkau 
> ---
>  package/kernel/mac80211/Makefile | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/package/kernel/mac80211/Makefile 
> b/package/kernel/mac80211/Makefile
> index 4b4f774..7165fc3 100644
> --- a/package/kernel/mac80211/Makefile
> +++ b/package/kernel/mac80211/Makefile
> @@ -1828,6 +1828,11 @@ define KernelPackage/ath9k-htc/install
>   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
>   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
>   $(1)/lib/firmware/
> + $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
> + $(INSTALL_DATA) \
> + 
> $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_9271-1.4.0.fw \
> + 
> $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_7010-1.4.0.fw \
> + $(1)/lib/firmware/ath9k_htc
>  endef
>  
>  define KernelPackage/b43/install
> 


Are the old files needed by this driver any more? If the new firmware
files are supporting all devices which are supported by the old ones,
please do not include the old firmware files any more.

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


Re: [OpenWrt-Devel] [PATCH] mac80211: install new firmware for ath9k-htc on target

2015-11-27 Thread Felix Fietkau
On 2015-11-27 16:36, Alexey Brodkin wrote:
> For quite some time new firmware for ath9k-htc devices
> is available in
> http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ath9k_htc/
> 
> Moreover ath9k-htc kernel driver expects this new v1.4
> firmware to exist in /lib/firmware/ath9k_htc.
> [...]
>  package/kernel/mac80211/Makefile | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/package/kernel/mac80211/Makefile 
> b/package/kernel/mac80211/Makefile
> index 4b4f774..7165fc3 100644
> --- a/package/kernel/mac80211/Makefile
> +++ b/package/kernel/mac80211/Makefile
> @@ -1828,6 +1828,11 @@ define KernelPackage/ath9k-htc/install
>   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
>   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
>   $(1)/lib/firmware/
> + $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
> + $(INSTALL_DATA) \
> + 
> $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_9271-1.4.0.fw \
> + 
> $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_7010-1.4.0.fw \
> + $(1)/lib/firmware/ath9k_htc
>  endef
Please remove the install commands for the old firmware.

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


[OpenWrt-Devel] [PATCH v2] mac80211: install new firmware for ath9k-htc on target

2015-11-27 Thread Alexey Brodkin
For quite some time new firmware for ath9k-htc devices
is available in
http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ath9k_htc/

Moreover ath9k-htc kernel driver expects this new v1.4
firmware to exist in /lib/firmware/ath9k_htc.

What happens currently:
>8--
[7.83] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
requested
[7.84] usb 1-1: Direct firmware load for
ath9k_htc/htc_9271-1.4.0.fw failed with error -2
[7.85] usb 1-1: Falling back to user helper
[7.87] usbcore: registered new interface driver ath9k_htc
[7.88] firmware ath9k_htc!htc_9271-1.4.0.fw:
firmware_loading_store: map pages failed
[7.89] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
[8.20] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size:
50980
[8.44] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
credits
[   10.72] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[   10.74] ath9k_htc 1-1:1.0: FW RMW support: Off
[   10.76] ieee80211 phy0: Atheros AR9271 Rev:1
>8--

And with that patch new firmware is used instead:
>8--
[   33.92] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw
requested
[   34.23] usb 1-1: ath9k_htc: Transferred FW:
ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[   34.48] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33
credits
[   34.74] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.4
[   34.75] ath9k_htc 1-1:1.0: FW RMW support: On
>8--

Signed-off-by: Alexey Brodkin 
Cc: Felix Fietkau 
Cc: Hauke Mehrtens 
---

Changes compared to v1:

 * Removed installation of old firmware

 package/kernel/mac80211/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 4b4f774..1dd1b84 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -1823,11 +1823,11 @@ endef
 
 
 define KernelPackage/ath9k-htc/install
-   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
$(INSTALL_DATA) \
-   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
-   $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
-   $(1)/lib/firmware/
+   
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_9271-1.4.0.fw \
+   
$(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ath9k_htc/htc_7010-1.4.0.fw \
+   $(1)/lib/firmware/ath9k_htc
 endef
 
 define KernelPackage/b43/install
-- 
2.5.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] New Ubiquiti AC products locked against 3rd party firmware?

2015-11-27 Thread Ben West
I'm forwarding a post from listserv discussing the proposed FCC regulations
that would (indirectly) compel firmware lockdown.

This person is reporting a new Ubiquiti AC AP where there the bootloader
does an RSA signature check on the firmware image.

Could anyone else confirm if they've observed the same, and if it now
prevents loading OpenWRT, etc?  Or at least, confirm if the RSA signature
checking by the bootloader was not present before?

-- Forwarded message --
From: Andrew Margarit | Cucumber WiFI 
Date: Fri, Nov 27, 2015 at 7:59 AM
Subject: Re: [FCC] New AP with the lockdown
To: f...@lists.prplfoundation.org


Hi there,

Just to let you know, I've been looking at the Ubiquiti new AC APs, and it
looks like they added a RSA check in the bootloader.

Firmware Version: BZ.qca956x.v3.4.7.3284.150911.1650
RSA Signed Firmware. Verfiying please wait...
Decrypted hash: f8 2b 45 72 9f e4 5f 46 a0 96 43 37 57 4f 49 ab 43 dc 1e 8c
Image hash: f8 2b 45 72 9f e4 5f 46 a0 96 43 37 57 4f 49 ab 43 dc 1e 8c

All fun and good!

..

-- 
Andrew Margarit

Wi-FI Chief | Cucumber Tony
and...@polkaspots.com
cucumberwifi.io

twitter/cucumbertony


___
FCC mailing list
f...@lists.prplfoundation.org
http://lists.prplfoundation.org/cgi-bin/mailman/listinfo/fcc




-- 
Ben West
http://gowasabi.net
b...@gowasabi.net
314-246-9434
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] kernel: Hyper-V support for Linux 3.18

2015-11-27 Thread Ning Ye
kernel: Update Hyper-V support for Linux 3.18 and OpenWRT  trunk.  Now
requires at least 96 MB memory for VM.

Signed-off-by: Ning Ye 
---
 config/Config-images.in | 10 
 package/kernel/linux/modules/virtual.mk | 86
+
 target/linux/x86/config-3.18|  9 
 target/linux/x86/image/Makefile | 10 
 4 files changed, 115 insertions(+)

diff --git a/config/Config-images.in b/config/Config-images.in index
a60dd50..ff16ef0 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -238,6 +238,16 @@ menu "Target Images"
select TARGET_IMAGES_PAD
select PACKAGE_kmod-e1000
 
+   config VHD_IMAGES
+   bool "Build Hyper-V image files (VHD)"
+   depends on TARGET_x86 || TARGET_x86_64
+   select GRUB_IMAGES
+   select TARGET_IMAGES_PAD
+   select PACKAGE_kmod-hyperv-balloon
+   select PACKAGE_kmod-hyperv-net-vsc
+   select PACKAGE_kmod-hyperv-util
+   select PACKAGE_kmod-hyperv-storage
+
config TARGET_IMAGES_PAD
bool "Pad images to filesystem size (for JFFS2)"
depends on GRUB_IMAGES
diff --git a/package/kernel/linux/modules/virtual.mk
b/package/kernel/linux/modules/virtual.mk
index 61a8a87..2d9f8dd 100644
--- a/package/kernel/linux/modules/virtual.mk
+++ b/package/kernel/linux/modules/virtual.mk
@@ -169,3 +169,89 @@ define KernelPackage/xen-pcidev/description
 endef
 
 $(eval $(call KernelPackage,xen-pcidev))
+
+#
+# Hyper-V Drives depends on x86 or x86_64.
+#
+define KernelPackage/hyperv-balloon
+  SUBMENU:=$(VIRTUAL_MENU)
+  DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+  TITLE:=Microsoft Hyper-V Balloon Driver
+  KCONFIG:= \
+CONFIG_HYPERV_BALLOON \
+CONFIG_HYPERVISOR_GUEST=y \
+CONFIG_PARAVIRT=n \
+CONFIG_HYPERV=y
+  FILES:=$(LINUX_DIR)/drivers/hv/hv_balloon.ko \
+$(LINUX_DIR)/drivers/hv/hv_vmbus.ko
+  AUTOLOAD:=$(call AutoLoad,06,hv_balloon) endef
+
+define KernelPackage/hyperv-balloon/description
+  Microsofot Hyper-V balloon driver.
+endef
+
+$(eval $(call KernelPackage,hyperv-balloon))
+
+define KernelPackage/hyperv-net-vsc
+  SUBMENU:=$(VIRTUAL_MENU)
+  DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+  TITLE:=Microsoft Hyper-V Network Driver
+  KCONFIG:= \
+CONFIG_HYPERV_NET \
+CONFIG_HYPERVISOR_GUEST=y \
+CONFIG_PARAVIRT=n \
+CONFIG_HYPERV=y
+  FILES:=$(LINUX_DIR)/drivers/net/hyperv/hv_netvsc.ko \
+$(LINUX_DIR)/drivers/hv/hv_vmbus.ko
+  AUTOLOAD:=$(call AutoLoad,35,hv_netvsc) endef
+
+define KernelPackage/hyperv-net-vsc/description
+  Microsoft Hyper-V Network Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-net-vsc))
+
+define KernelPackage/hyperv-util
+  SUBMENU:=$(VIRTUAL_MENU)
+  DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+  TITLE:=Microsoft Hyper-V Utility Driver
+  KCONFIG:= \
+CONFIG_HYPERV_UTILS \
+CONFIG_HYPERVISOR_GUEST=y \
+CONFIG_PARAVIRT=n \
+CONFIG_HYPERV=y
+  FILES:=$(LINUX_DIR)/drivers/hv/hv_util.ko \
+$(LINUX_DIR)/drivers/hv/hv_vmbus.ko
+  AUTOLOAD:=$(call AutoLoad,10,hv_util) endef
+
+define KernelPackage/hyperv-util/description
+  Microsoft Hyper-V Utility Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-util))
+
+#
+# Hyper-V Storage Drive needs to be in kernel rather than module to load
the root fs.
+#
+define KernelPackage/hyperv-storage
+  SUBMENU:=$(VIRTUAL_MENU)
+  DEPENDS:=@(TARGET_x86||TARGET_x86_64) +kmod-scsi-core
+  TITLE:=Microsoft Hyper-V Storage Driver
+  KCONFIG:= \
+CONFIG_HYPERV_STORAGE=y \
+CONFIG_HYPERVISOR_GUEST=y \
+CONFIG_PARAVIRT=n \
+CONFIG_HYPERV=y
+  FILES:=$(LINUX_DIR)/drivers/scsi/hv_storvsc.ko \
+$(LINUX_DIR)/drivers/hv/hv_vmbus.ko
+  AUTOLOAD:=$(call AutoLoad,40,hv_storvsc) endef
+
+define KernelPackage/hyperv-storage/description
+  Microsoft Hyper-V Storage Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-storage))
diff --git a/target/linux/x86/config-3.18 b/target/linux/x86/config-3.18
index bb647c8..8ac3709 100644
--- a/target/linux/x86/config-3.18
+++ b/target/linux/x86/config-3.18
@@ -204,6 +204,15 @@ CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_GEODE=y
 CONFIG_HW_RANDOM_VIA=y
 # CONFIG_HYPERVISOR_GUEST is not set
+# CONFIG_HYPERV is not set
+# CONFIG_HYPERV_BALLOON is not set
+# CONFIG_HYPERV_NET is not set
+# CONFIG_HYPERV_STORAGE is not set
+# CONFIG_HYPERV_UTILS is not set
+# CONFIG_HYPERV_KEYBOARD is not set
+# CONFIG_FB_HYPERV is not set
+# CONFIG_HID_HYPERV_MOUSE is not set
+# CONFIG_VMWARE_BALLOON is not set
 CONFIG_HZ_PERIODIC=y
 CONFIG_I8253_LOCK=y
 # CONFIG_I8K is not set
diff --git a/target/linux/x86/image/Makefile
b/target/linux/x86/image/Makefile index 8e56372..50507a7 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -148,6 +148,15 @@ ifneq ($(CONFIG_VMDK_IMAGES),)
   endef
 endif
 
+ifneq ($(CONFIG_VHD_IMAGES),)
+  define Image/Build/vhd
+   rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vhd || t

[OpenWrt-Devel] [PATCH procd v3 00/17] ujail fs jail rework/fixes/improvements

2015-11-27 Thread Etienne CHAMPETIER
same as v2 serie, just using include guard instead of pragma once

Etienne CHAMPETIER (17):
  ujail: don't add non existant library_path
  ujail: don't pass unused arg in clone call
  ujail: stop using extern in elf.h
  ujail: use more const in elf.*
  ujail: put #include guard macro in all *.h
  ujail: add  to log.h
  ujail: add  and  to seccomp.h
  ujail: remove "#include log.h" from elf.h
  ujail: search libs in /lib before /lib64
  ujail: use PATH_MAX for path related buffers
  ujail: add init_library_search()
  ujail: fixup code style: "func()" -> "func(void)"
  ujail: remove some debug/dev hack
  ujail: DT_STRTAB uses d_ptr in d_un union (not d_val)
  ujail: rework fs jail part
  ujail: automatically add script (#!) interpreter
  ujail: add ELF interpreter (DT_INTERP) to the jail

 CMakeLists.txt  |   2 +-
 jail/capabilities.h |   4 ++
 jail/elf.c  | 154 +---
 jail/elf.h  |  14 ++--
 jail/fs.c   | 181 
 jail/fs.h   |  21 ++
 jail/jail.c | 118 +++---
 jail/jail.h |  18 ++
 jail/log.h  |   4 ++
 jail/preload.c  |   2 -
 jail/seccomp.c  |   2 -
 jail/seccomp.h  |   7 ++
 12 files changed, 337 insertions(+), 190 deletions(-)
 create mode 100644 jail/fs.c
 create mode 100644 jail/fs.h
 create mode 100644 jail/jail.h

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


[OpenWrt-Devel] [PATCH procd v3 02/17] ujail: don't pass unused arg in clone call

2015-11-27 Thread Etienne CHAMPETIER
clone() call need a function with "void *" arg
(else we have a compilation error)

Signed-off-by: Etienne CHAMPETIER 
---
 jail/jail.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jail/jail.c b/jail/jail.c
index 56dc9ca..9952ed9 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -272,7 +272,7 @@ static int exec_jail()
exit(EXIT_FAILURE);
 }
 
-static int spawn_jail(void *arg)
+static int spawn_jail(void *_notused)
 {
if (opts.name && sethostname(opts.name, strlen(opts.name))) {
ERROR("failed to sethostname: %s\n", strerror(errno));
@@ -424,7 +424,7 @@ int main(int argc, char **argv)
if (opts.namespace) {
jail_process.pid = clone(spawn_jail,
child_stack + STACK_SIZE,
-   CLONE_NEWUTS | CLONE_NEWPID | CLONE_NEWNS | 
CLONE_NEWIPC | SIGCHLD, argv);
+   CLONE_NEWUTS | CLONE_NEWPID | CLONE_NEWNS | 
CLONE_NEWIPC | SIGCHLD, NULL);
} else {
jail_process.pid = fork();
}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 04/17] ujail: use more const in elf.*

2015-11-27 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 28 +++-
 jail/elf.h  |  4 ++--
 jail/jail.c |  2 +-
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 34a5aca..fb046b4 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -69,7 +69,7 @@ static void alloc_library(const char *path, const char *name)
DEBUG("adding library %s/%s\n", path, name);
 }
 
-static int elf_open(char **dir, char *file)
+static int elf_open(char **dir, const char *file)
 {
struct library_path *p;
char path[256];
@@ -95,7 +95,7 @@ static int elf_open(char **dir, char *file)
return fd;
 }
 
-char* find_lib(char *file)
+const char* find_lib(const char *file)
 {
struct library *l;
static char path[256];
@@ -114,7 +114,7 @@ char* find_lib(char *file)
return path;
 }
 
-static int elf64_find_section(char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
+static int elf64_find_section(const char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
 {
Elf64_Ehdr *e;
Elf64_Phdr *ph;
@@ -137,7 +137,7 @@ static int elf64_find_section(char *map, unsigned int type, 
unsigned int *offset
return -1;
 }
 
-static int elf32_find_section(char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
+static int elf32_find_section(const char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
 {
Elf32_Ehdr *e;
Elf32_Phdr *ph;
@@ -160,7 +160,7 @@ static int elf32_find_section(char *map, unsigned int type, 
unsigned int *offset
return -1;
 }
 
-static int elf_find_section(char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
+static int elf_find_section(const char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
 {
int clazz = map[EI_CLASS];
 
@@ -174,10 +174,10 @@ static int elf_find_section(char *map, unsigned int type, 
unsigned int *offset,
return -1;
 }
 
-static int elf32_scan_dynamic(char *map, int dyn_offset, int dyn_size, int 
load_offset)
+static int elf32_scan_dynamic(const char *map, int dyn_offset, int dyn_size, 
int load_offset)
 {
Elf32_Dyn *dynamic = (Elf32_Dyn *) (map + dyn_offset);
-   char *strtab = NULL;
+   const char *strtab = NULL;
 
while ((void *) dynamic < (void *) (map + dyn_offset + dyn_size)) {
Elf32_Dyn *curr = dynamic;
@@ -208,10 +208,10 @@ static int elf32_scan_dynamic(char *map, int dyn_offset, 
int dyn_size, int load_
return 0;
 }
 
-static int elf64_scan_dynamic(char *map, int dyn_offset, int dyn_size, int 
load_offset)
+static int elf64_scan_dynamic(const char *map, int dyn_offset, int dyn_size, 
int load_offset)
 {
Elf64_Dyn *dynamic = (Elf64_Dyn *) (map + dyn_offset);
-   char *strtab = NULL;
+   const char *strtab = NULL;
 
while ((void *) dynamic < (void *) (map + dyn_offset + dyn_size)) {
Elf64_Dyn *curr = dynamic;
@@ -242,7 +242,7 @@ static int elf64_scan_dynamic(char *map, int dyn_offset, 
int dyn_size, int load_
return 0;
 }
 
-int elf_load_deps(char *library)
+int elf_load_deps(const char *library)
 {
unsigned int dyn_offset, dyn_size;
unsigned int load_offset, load_vaddr;
@@ -288,10 +288,12 @@ int elf_load_deps(char *library)
if (dir) {
alloc_library(dir, library);
} else {
-   char *elf = strdup(library);
+   char *elf1 = strdup(library);
+   char *elf2 = strdup(library);
 
-   alloc_library(dirname(elf), basename(library));
-   free(elf);
+   alloc_library(dirname(elf1), basename(elf2));
+   free(elf1);
+   free(elf2);
}
clazz = map[EI_CLASS];
 
diff --git a/jail/elf.h b/jail/elf.h
index 19ceb3e..ddbe234 100644
--- a/jail/elf.h
+++ b/jail/elf.h
@@ -31,8 +31,8 @@ struct library_path {
 extern struct avl_tree libraries;
 
 void alloc_library_path(const char *path);
-char* find_lib(char *file);
-int elf_load_deps(char *library);
+int elf_load_deps(const char *library);
+const char* find_lib(const char *file);
 void load_ldso_conf(const char *conf);
 
 #endif
diff --git a/jail/jail.c b/jail/jail.c
index 9952ed9..52f88ef 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -212,7 +212,7 @@ static char** build_envp(const char *seccomp)
static char preload_var[64];
static char seccomp_var[64];
static char debug_var[] = "LD_DEBUG=all";
-   char *preload_lib = find_lib("libpreload-seccomp.so");
+   const char *preload_lib = find_lib("libpreload-seccomp.so");
int count = 0;
 
if (seccomp && !preload_lib) {
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https:

[OpenWrt-Devel] [PATCH procd v3 01/17] ujail: don't add non existant library_path

2015-11-27 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index cbb3051..34a5aca 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -33,6 +33,10 @@ static LIST_HEAD(library_paths);
 
 void alloc_library_path(const char *path)
 {
+   struct stat s;
+   if (stat(path, &s))
+   return;
+
struct library_path *p;
char *_path;
 
@@ -343,10 +347,6 @@ void load_ldso_conf(const char *conf)
load_ldso_conf(gl.gl_pathv[i]);
globfree(&gl);
} else {
-   struct stat s;
-
-   if (stat(line, &s))
-   continue;
alloc_library_path(line);
}
}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 03/17] ujail: stop using extern in elf.h

2015-11-27 Thread Etienne CHAMPETIER
extern qualifiers for function definitions doesn't really make sense

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/jail/elf.h b/jail/elf.h
index 3ae311e..19ceb3e 100644
--- a/jail/elf.h
+++ b/jail/elf.h
@@ -30,9 +30,9 @@ struct library_path {
 
 extern struct avl_tree libraries;
 
-extern void alloc_library_path(const char *path);
-extern char* find_lib(char *file);
-extern int elf_load_deps(char *library);
-extern void load_ldso_conf(const char *conf);
+void alloc_library_path(const char *path);
+char* find_lib(char *file);
+int elf_load_deps(char *library);
+void load_ldso_conf(const char *conf);
 
 #endif
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 06/17] ujail: add to log.h

2015-11-27 Thread Etienne CHAMPETIER
headers must include all there dependencies, no more, no less
(it uses fprintf)

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 1 -
 jail/jail.c | 1 -
 jail/log.h  | 1 +
 3 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index fb046b4..6d36215 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -16,7 +16,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/jail/jail.c b/jail/jail.c
index 52f88ef..7349a05 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/jail/log.h b/jail/log.h
index 56c98a0..74a9f11 100644
--- a/jail/log.h
+++ b/jail/log.h
@@ -14,6 +14,7 @@
 #define _JAIL_LOG_H_
 
 extern int debug;
+#include 
 #include 
 
 #define INFO(fmt, ...) do { \
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 07/17] ujail: add and to seccomp.h

2015-11-27 Thread Etienne CHAMPETIER
headers must include all there dependencies, no more, no less

Signed-off-by: Etienne CHAMPETIER 
---
 jail/preload.c | 2 --
 jail/seccomp.c | 2 --
 jail/seccomp.h | 3 +++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/jail/preload.c b/jail/preload.c
index a1cc0b6..5466f27 100644
--- a/jail/preload.c
+++ b/jail/preload.c
@@ -13,12 +13,10 @@
 
 #define _GNU_SOURCE
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include "seccomp.h"
 #include "../preload.h"
diff --git a/jail/seccomp.c b/jail/seccomp.c
index de01fc6..dcd19ec 100644
--- a/jail/seccomp.c
+++ b/jail/seccomp.c
@@ -10,11 +10,9 @@
  * found in the LICENSE file.
  */
 #define _GNU_SOURCE 1
-#include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/jail/seccomp.h b/jail/seccomp.h
index 0992b79..6032812 100644
--- a/jail/seccomp.h
+++ b/jail/seccomp.h
@@ -13,6 +13,9 @@
 #ifndef _JAIL_SECCOMP_H_
 #define _JAIL_SECCOMP_H_
 
+#include 
+#include 
+
 #define INFO(fmt, ...) do { \
syslog(LOG_INFO,"preload-seccomp: "fmt, ## __VA_ARGS__); \
fprintf(stderr,"preload-seccomp: "fmt, ## __VA_ARGS__); \
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 08/17] ujail: remove "#include log.h" from elf.h

2015-11-27 Thread Etienne CHAMPETIER
headers must include all there dependencies, no more, no less

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 1 +
 jail/elf.h  | 2 --
 jail/jail.c | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 6d36215..5e22606 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -26,6 +26,7 @@
 #include 
 
 #include "elf.h"
+#include "log.h"
 
 struct avl_tree libraries;
 static LIST_HEAD(library_paths);
diff --git a/jail/elf.h b/jail/elf.h
index 570e4d0..4ab928d 100644
--- a/jail/elf.h
+++ b/jail/elf.h
@@ -16,8 +16,6 @@
 #include 
 #include 
 
-#include "log.h"
-
 struct library {
struct avl_node avl;
char *name;
diff --git a/jail/jail.c b/jail/jail.c
index 7349a05..ae09623 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -28,6 +28,7 @@
 
 #include "elf.h"
 #include "capabilities.h"
+#include "log.h"
 
 #include 
 #include 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 05/17] ujail: put #include guard macro in all *.h

2015-11-27 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 jail/capabilities.h | 4 
 jail/elf.h  | 3 ++-
 jail/log.h  | 3 +++
 jail/seccomp.h  | 4 
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/jail/capabilities.h b/jail/capabilities.h
index e6699e9..11b8cc2 100644
--- a/jail/capabilities.h
+++ b/jail/capabilities.h
@@ -10,5 +10,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#ifndef _JAIL_CAPABILITIES_H_
+#define _JAIL_CAPABILITIES_H_
 
 int drop_capabilities(const char *file);
+
+#endif
diff --git a/jail/elf.h b/jail/elf.h
index ddbe234..570e4d0 100644
--- a/jail/elf.h
+++ b/jail/elf.h
@@ -10,8 +10,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#ifndef _JAIL_ELF_H_
+#define _JAIL_ELF_H_
 
-#ifndef _ELF_H__
 #include 
 #include 
 
diff --git a/jail/log.h b/jail/log.h
index b1d201e..56c98a0 100644
--- a/jail/log.h
+++ b/jail/log.h
@@ -10,6 +10,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#ifndef _JAIL_LOG_H_
+#define _JAIL_LOG_H_
 
 extern int debug;
 #include 
@@ -25,3 +27,4 @@ extern int debug;
if (debug) printf("jail: "fmt, ## __VA_ARGS__); \
} while (0)
 
+#endif
diff --git a/jail/seccomp.h b/jail/seccomp.h
index 45eede7..0992b79 100644
--- a/jail/seccomp.h
+++ b/jail/seccomp.h
@@ -10,6 +10,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#ifndef _JAIL_SECCOMP_H_
+#define _JAIL_SECCOMP_H_
 
 #define INFO(fmt, ...) do { \
syslog(LOG_INFO,"preload-seccomp: "fmt, ## __VA_ARGS__); \
@@ -17,3 +19,5 @@
} while (0)
 
 int install_syscall_filter(const char *argv, const char *file);
+
+#endif
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 09/17] ujail: search libs in /lib before /lib64

2015-11-27 Thread Etienne CHAMPETIER
musl (openwrt DD r47603 x86-64) looks for lib only in /lib,
not in /lib64, and /lib64 is a symlink to /lib, so ujail find
all the libs in /lib64, add them in the jail (only under /lib64)
and then musl fails to find the libs.

uClibc (openwrt CC r47608 x86-64) looks for lib in /lib and
/usr/lib, not in /lib64 (/lib64 is also a symlink to /lib)

/lib64 is before /lib since the first commit, i don't know
if it was on purpose

this partly fixes
https://dev.openwrt.org/ticket/20785

Signed-off-by: Etienne CHAMPETIER 
---
 jail/jail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jail/jail.c b/jail/jail.c
index ae09623..e8c8f08 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -154,8 +154,8 @@ static int build_jail_fs()
}
 
avl_init(&libraries, avl_strcmp, false, NULL);
-   alloc_library_path("/lib64");
alloc_library_path("/lib");
+   alloc_library_path("/lib64");
alloc_library_path("/usr/lib");
load_ldso_conf("/etc/ld.so.conf");
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 10/17] ujail: use PATH_MAX for path related buffers

2015-11-27 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 9 +
 jail/jail.c | 9 +
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 5e22606..2acac71 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -72,7 +73,7 @@ static void alloc_library(const char *path, const char *name)
 static int elf_open(char **dir, const char *file)
 {
struct library_path *p;
-   char path[256];
+   char path[PATH_MAX];
int fd = -1;
 
*dir = NULL;
@@ -98,7 +99,7 @@ static int elf_open(char **dir, const char *file)
 const char* find_lib(const char *file)
 {
struct library *l;
-   static char path[256];
+   static char path[PATH_MAX];
const char *p;
 
l = avl_find_element(&libraries, file, l, avl);
@@ -313,7 +314,7 @@ err_out:
 void load_ldso_conf(const char *conf)
 {
FILE* fp = fopen(conf, "r");
-   char line[256];
+   char line[PATH_MAX];
 
if (!fp) {
DEBUG("failed to open %s\n", conf);
@@ -323,7 +324,7 @@ void load_ldso_conf(const char *conf)
while (!feof(fp)) {
int len;
 
-   if (!fgets(line, 256, fp))
+   if (!fgets(line, sizeof(line), fp))
break;
len = strlen(line);
if (len < 2)
diff --git a/jail/jail.c b/jail/jail.c
index e8c8f08..90aa482 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "elf.h"
 #include "capabilities.h"
@@ -93,8 +94,8 @@ static int mount_bind(const char *root, const char *path, 
const char *name, int
 {
const char *p = path;
struct stat s;
-   char old[256];
-   char new[256];
+   char old[PATH_MAX];
+   char new[PATH_MAX];
int fd;
 
if (strstr(p, "local"))
@@ -209,8 +210,8 @@ static int build_jail_fs()
 static char** build_envp(const char *seccomp)
 {
static char *envp[MAX_ENVP];
-   static char preload_var[64];
-   static char seccomp_var[64];
+   static char preload_var[PATH_MAX];
+   static char seccomp_var[PATH_MAX];
static char debug_var[] = "LD_DEBUG=all";
const char *preload_lib = find_lib("libpreload-seccomp.so");
int count = 0;
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 12/17] ujail: fixup code style: "func()" -> "func(void)"

2015-11-27 Thread Etienne CHAMPETIER
Signed-off-by: Etienne CHAMPETIER 
---
 jail/jail.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jail/jail.c b/jail/jail.c
index 5b24f63..b7e6946 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -139,7 +139,7 @@ static int mount_bind(const char *root, const char *path, 
const char *name, int
return 0;
 }
 
-static int build_jail_fs()
+static int build_jail_fs(void)
 {
struct library *l;
struct extra *m;
@@ -253,7 +253,7 @@ ujail will not use namespace/build a jail,\n\
 and will only drop capabilities/apply seccomp filter.\n\n");
 }
 
-static int exec_jail()
+static int exec_jail(void)
 {
char **envp = build_envp(opts.seccomp);
if (!envp)
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 11/17] ujail: add init_library_search()

2015-11-27 Thread Etienne CHAMPETIER
move all libraries search initialisation stuff
into elf.c / init_library_search()

for now we don't handle musl specific files

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 13 +++--
 jail/elf.h  |  3 +--
 jail/jail.c |  6 +-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 2acac71..c3a392c 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -32,7 +32,7 @@
 struct avl_tree libraries;
 static LIST_HEAD(library_paths);
 
-void alloc_library_path(const char *path)
+static void alloc_library_path(const char *path)
 {
struct stat s;
if (stat(path, &s))
@@ -311,7 +311,7 @@ err_out:
return ret;
 }
 
-void load_ldso_conf(const char *conf)
+static void load_ldso_conf(const char *conf)
 {
FILE* fp = fopen(conf, "r");
char line[PATH_MAX];
@@ -356,3 +356,12 @@ void load_ldso_conf(const char *conf)
 
fclose(fp);
 }
+
+void init_library_search(void)
+{
+   avl_init(&libraries, avl_strcmp, false, NULL);
+   alloc_library_path("/lib");
+   alloc_library_path("/lib64");
+   alloc_library_path("/usr/lib");
+   load_ldso_conf("/etc/ld.so.conf");
+}
diff --git a/jail/elf.h b/jail/elf.h
index 4ab928d..6244e76 100644
--- a/jail/elf.h
+++ b/jail/elf.h
@@ -29,9 +29,8 @@ struct library_path {
 
 extern struct avl_tree libraries;
 
-void alloc_library_path(const char *path);
 int elf_load_deps(const char *library);
 const char* find_lib(const char *file);
-void load_ldso_conf(const char *conf);
+void init_library_search(void);
 
 #endif
diff --git a/jail/jail.c b/jail/jail.c
index 90aa482..5b24f63 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -154,11 +154,7 @@ static int build_jail_fs()
return -1;
}
 
-   avl_init(&libraries, avl_strcmp, false, NULL);
-   alloc_library_path("/lib");
-   alloc_library_path("/lib64");
-   alloc_library_path("/usr/lib");
-   load_ldso_conf("/etc/ld.so.conf");
+   init_library_search();
 
if (elf_load_deps(*opts.jail_argv)) {
ERROR("failed to load dependencies\n");
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 13/17] ujail: remove some debug/dev hack

2015-11-27 Thread Etienne CHAMPETIER
this code is present since first ujail commit (dfcfcca7)

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c  | 7 +--
 jail/jail.c | 8 ++--
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index c3a392c..7c52880 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -100,17 +100,12 @@ const char* find_lib(const char *file)
 {
struct library *l;
static char path[PATH_MAX];
-   const char *p;
 
l = avl_find_element(&libraries, file, l, avl);
if (!l)
return NULL;
 
-   p = l->path;
-   if (strstr(p, "local"))
-   p = "/lib";
-
-   snprintf(path, sizeof(path), "%s/%s", p, file);
+   snprintf(path, sizeof(path), "%s/%s", l->path, file);
 
return path;
 }
diff --git a/jail/jail.c b/jail/jail.c
index b7e6946..f62d121 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -92,21 +92,17 @@ static int mkdir_p(char *dir, mode_t mask)
 
 static int mount_bind(const char *root, const char *path, const char *name, 
int readonly, int error)
 {
-   const char *p = path;
struct stat s;
char old[PATH_MAX];
char new[PATH_MAX];
int fd;
 
-   if (strstr(p, "local"))
-   p = "/lib";
-
snprintf(old, sizeof(old), "%s/%s", path, name);
-   snprintf(new, sizeof(new), "%s%s", root, p);
+   snprintf(new, sizeof(new), "%s%s", root, path);
 
mkdir_p(new, 0755);
 
-   snprintf(new, sizeof(new), "%s%s/%s", root, p, name);
+   snprintf(new, sizeof(new), "%s%s/%s", root, path, name);
 
if (stat(old, &s)) {
ERROR("%s does not exist\n", old);
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 17/17] ujail: add ELF interpreter (DT_INTERP) to the jail

2015-11-27 Thread Etienne CHAMPETIER
this is needed by musl (openwrt DD)
uClibc/glibc is working without this

this partly fixes
https://dev.openwrt.org/ticket/20785

we still don't handle DT_RPATH, DT_RUNPATH, nodeflib, ...
see http://man7.org/linux/man-pages/man8/ld.so.8.html

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/jail/elf.c b/jail/elf.c
index 136789e..b8f2cc5 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -234,6 +234,7 @@ int elf_load_deps(const char *path, const char *map)
 {
unsigned int dyn_offset, dyn_size;
unsigned int load_offset, load_vaddr;
+   unsigned int interp_offset;
 
if (elf_find_section(map, PT_LOAD, &load_offset, NULL, &load_vaddr)) {
ERROR("failed to load the .load section from %s\n", path);
@@ -245,6 +246,10 @@ int elf_load_deps(const char *path, const char *map)
return -1;
}
 
+   if (elf_find_section(map, PT_INTERP, &interp_offset, NULL, NULL) == 0) {
+   add_path_and_deps(map+interp_offset, 1, -1, 0);
+   }
+
int clazz = map[EI_CLASS];
 
if (clazz == ELFCLASS32)
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 14/17] ujail: DT_STRTAB uses d_ptr in d_un union (not d_val)

2015-11-27 Thread Etienne CHAMPETIER
see
https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-42444/index.html

Signed-off-by: Etienne CHAMPETIER 
---
 jail/elf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 7c52880..46c19df 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -182,7 +182,7 @@ static int elf32_scan_dynamic(const char *map, int 
dyn_offset, int dyn_size, int
if (curr->d_tag != DT_STRTAB)
continue;
 
-   strtab = map + (curr->d_un.d_val - load_offset);
+   strtab = map + (curr->d_un.d_ptr - load_offset);
break;
}
 
@@ -216,7 +216,7 @@ static int elf64_scan_dynamic(const char *map, int 
dyn_offset, int dyn_size, int
if (curr->d_tag != DT_STRTAB)
continue;
 
-   strtab = map + (curr->d_un.d_val - load_offset);
+   strtab = map + (curr->d_un.d_ptr - load_offset);
break;
}
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 0/2] Add support for TP-LINK TL-WR841N/ND v10 to Chaos Calmer

2015-11-27 Thread Matteo Valentini
v2: previous 2/2 patch was based on wrong sources

Matteo Valentini (2):
  CC: ar71xx: fix ath79_soc_rev value for QCA9531 ver. 2
  CC: ar71xx: backport support for TP-LINK TL-WR841N/ND v10

 target/linux/ar71xx/image/Makefile|  9 -
 .../707-MIPS-ath79-add-support-for-QCA953x-SoC.patch  | 11 ---
 .../735-MIPS-ath79-add-support-for-QCA956x-SoC.patch  |  7 ---
 3 files changed, 20 insertions(+), 7 deletions(-)

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


[OpenWrt-Devel] [PATCH v2 1/2] CC: ar71xx: fix ath79_soc_rev value for QCA9531 ver. 2

2015-11-27 Thread Matteo Valentini
ath9k expects to get revision id 2 for the QCA9531 ver. 2 rev. 0. This
fixes the very low TX power on some devices like the TP-LINK
TL-WR841ND v10

As ath79_soc_rev is only used to get the revision number to ath9k on the
QCA9533, just set it to the expected value on the ver. 2.

Backport of r47262

Signed-off-by: Matteo Valentini 
---
 .../707-MIPS-ath79-add-support-for-QCA953x-SoC.patch  | 11 ---
 .../735-MIPS-ath79-add-support-for-QCA956x-SoC.patch  |  7 ---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git 
a/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
 
b/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
index 5041619..f3b4446 100644
--- 
a/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
+++ 
b/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
@@ -292,12 +292,13 @@ meaning of the bits CPUCLK_FROM_CPUPLL and 
DDRCLK_FROM_DDRPLL is reversed.
  
id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID);
major = id & REV_ID_MAJOR_MASK;
-@@ -151,6 +152,16 @@ static void __init ath79_detect_sys_type
+@@ -151,6 +152,17 @@ static void __init ath79_detect_sys_type
rev = id & AR934X_REV_ID_REVISION_MASK;
break;
  
 +  case REV_ID_MAJOR_QCA9533_V2:
 +  ver = 2;
++  ath79_soc_rev = 2;
 +  /* drop through */
 +
 +  case REV_ID_MAJOR_QCA9533:
@@ -309,9 +310,13 @@ meaning of the bits CPUCLK_FROM_CPUPLL and 
DDRCLK_FROM_DDRPLL is reversed.
case REV_ID_MAJOR_QCA9556:
ath79_soc = ATH79_SOC_QCA9556;
chip = "9556";
-@@ -169,9 +180,9 @@ static void __init ath79_detect_sys_type
+@@ -167,11 +179,12 @@ static void __init ath79_detect_sys_type
+   panic("ath79: unknown SoC, id:0x%08x", id);
+   }
  
-   ath79_soc_rev = rev;
+-  ath79_soc_rev = rev;
++  if (ver == 1)
++  ath79_soc_rev = rev;
  
 -  if (soc_is_qca955x())
 -  sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u",
diff --git 
a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
 
b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index 491a7aa..ab2bc38 100644
--- 
a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ 
b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -519,7 +519,7 @@
return -ENODEV;
 --- a/arch/mips/ath79/setup.c
 +++ b/arch/mips/ath79/setup.c
-@@ -175,15 +175,30 @@ static void __init ath79_detect_sys_type
+@@ -176,6 +176,18 @@ static void __init ath79_detect_sys_type
rev = id & QCA955X_REV_ID_REVISION_MASK;
break;
  
@@ -538,8 +538,9 @@
default:
panic("ath79: unknown SoC, id:0x%08x", id);
}
- 
-   ath79_soc_rev = rev;
+@@ -183,9 +195,12 @@ static void __init ath79_detect_sys_type
+   if (ver == 1)
+   ath79_soc_rev = rev;
  
 -  if (soc_is_qca953x() || soc_is_qca955x())
 +  if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561())
-- 
2.4.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 2/2] CC: ar71xx: backport support for TP-LINK TL-WR841N/ND v10

2015-11-27 Thread Matteo Valentini
The TL-WR841N/ND v10 is mostly identical to the v9. Apart from some minor
changes, it contains a newer revision of the QCA9533 SoC and the CPU clock
is significantly higher.

Backport of r47263

Signed-off-by: Matteo Valentini 
---
 target/linux/ar71xx/image/Makefile | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 013a215..95d9a08 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -546,6 +546,13 @@ define Device/tl-wr841n-v9
 TPLINK_HWID := 0x08410009
 endef
 
+define Device/tl-wr841n-v10
+$(Device/tplink-4mlzma)
+BOARDNAME := TL-WR841N-v9
+DEVICE_PROFILE := TLWR841
+TPLINK_HWID := 0x08410010
+endef
+
 define Device/tl-wr842n-v2
 $(Device/tplink-8mlzma)
 BOARDNAME := TL-WR842N-v2
@@ -566,7 +573,7 @@ define Device/tl-wr847n-v8
 DEVICE_PROFILE := TLWR841
 TPLINK_HWID := 0x08470008
 endef
-TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr842n-v2 tl-wr843nd-v1 
tl-wr847n-v8
+TARGET_DEVICES += tl-wr841n-v8 tl-wr841n-v9 tl-wr841n-v10 tl-wr842n-v2 
tl-wr843nd-v1 tl-wr847n-v8
 
 define Device/tl-wr941nd-v5
 $(Device/tplink-4mlzma)
-- 
2.4.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 16/17] ujail: automatically add script (#!) interpreter

2015-11-27 Thread Etienne CHAMPETIER
this make simple script work easily with ujail

Signed-off-by: Etienne CHAMPETIER 
---
 jail/fs.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/jail/fs.c b/jail/fs.c
index aeab730..c848700 100644
--- a/jail/fs.c
+++ b/jail/fs.c
@@ -79,6 +79,29 @@ void mount_list_init(void) {
avl_init(&mounts, avl_strcmp, false, NULL);
 }
 
+static int add_script_interp(const char *path, const char *map, int size)
+{
+   int start = 2;
+   while (start < size && map[start] != '/') {
+   start++;
+   }
+   if (start >= size) {
+   ERROR("bad script interp (%s)", path);
+   return -1;
+   }
+   int stop = start + 1;
+   while (stop < size && map[stop] > 0x20 && map[stop] <= 0x7e) {
+   stop++;
+   }
+   if (stop >= size || (stop-start) > PATH_MAX) {
+   ERROR("bad script interp (%s)", path);
+   return -1;
+   }
+   char buf[PATH_MAX];
+   strncpy(buf, map+start, stop-start);
+   return add_path_and_deps(buf, 1, -1, 0);
+}
+
 int add_path_and_deps(const char *path, int readonly, int error, int lib)
 {
assert(path != NULL);
@@ -135,6 +158,11 @@ int add_path_and_deps(const char *path, int readonly, int 
error, int lib)
goto out;
}
 
+   if (map[0] == '#' && map[1] == '!') {
+   ret = add_script_interp(path, map, s.st_size);
+   goto out;
+   }
+
if (map[0] == ELFMAG0 && map[1] == ELFMAG1 && map[2] == ELFMAG2 && 
map[3] == ELFMAG3) {
ret = elf_load_deps(path, map);
goto out;
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH procd v3 15/17] ujail: rework fs jail part

2015-11-27 Thread Etienne CHAMPETIER
Change functions to work with full paths (do less split and concat of path)
  Store "soname" as key and the fullpath as path in "libraries"
  Remove "extras" list and replace it with "mounts" avl_tree
  ("mounts" also store fullpath)

Add add_path_and_deps() function to handle file/lib openning and mmaping
  Check if file is an elf (magic number) before passing it to elf_load_deps()
  elf_load_deps() now only handle elf parsing part
  next commit adds script (#!) handling

Use add_path_and_deps() with -r and -w args to automatically add dependencies

Signed-off-by: Etienne CHAMPETIER 
---
 CMakeLists.txt |   2 +-
 jail/elf.c |  98 +---
 jail/elf.h |   4 +-
 jail/fs.c  | 153 +
 jail/fs.h  |  21 
 jail/jail.c|  91 ++
 jail/jail.h|  18 +++
 7 files changed, 246 insertions(+), 141 deletions(-)
 create mode 100644 jail/fs.c
 create mode 100644 jail/fs.h
 create mode 100644 jail/jail.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d749c25..2718125 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,7 @@ ADD_DEPENDENCIES(preload-seccomp syscall-names-h)
 endif()
 
 IF(JAIL_SUPPORT)
-ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c jail/capabilities.c)
+ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c jail/fs.c jail/capabilities.c)
 TARGET_LINK_LIBRARIES(ujail ubox blobmsg_json)
 INSTALL(TARGETS ujail
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
diff --git a/jail/elf.c b/jail/elf.c
index 46c19df..136789e 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -12,14 +12,10 @@
  */
 
 #define _GNU_SOURCE
-#include 
 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -27,6 +23,7 @@
 #include 
 
 #include "elf.h"
+#include "fs.h"
 #include "log.h"
 
 struct avl_tree libraries;
@@ -52,7 +49,11 @@ static void alloc_library_path(const char *path)
DEBUG("adding ld.so path %s\n", path);
 }
 
-static void alloc_library(const char *path, const char *name)
+/*
+ * path = full path
+ * name = soname/avl key
+ */
+void alloc_library(const char *path, const char *name)
 {
struct library *l;
char *_name, *_path;
@@ -67,47 +68,38 @@ static void alloc_library(const char *path, const char 
*name)
l->path = strcpy(_path, path);
 
avl_insert(&libraries, &l->avl);
-   DEBUG("adding library %s/%s\n", path, name);
+   DEBUG("adding library %s (%s)\n", path, name);
 }
 
-static int elf_open(char **dir, const char *file)
+int lib_open(char **fullpath, const char *file)
 {
struct library_path *p;
char path[PATH_MAX];
int fd = -1;
 
-   *dir = NULL;
+   *fullpath = NULL;
 
list_for_each_entry(p, &library_paths, list) {
-   if (strlen(p->path))
-   snprintf(path, sizeof(path), "%s/%s", p->path, file);
-   else
-   strncpy(path, file, sizeof(path));
+   snprintf(path, sizeof(path), "%s/%s", p->path, file);
fd = open(path, O_RDONLY);
if (fd >= 0) {
-   *dir = p->path;
+   *fullpath = strdup(path);
break;
}
}
 
-   if (fd == -1)
-   fd = open(file, O_RDONLY);
-
return fd;
 }
 
 const char* find_lib(const char *file)
 {
struct library *l;
-   static char path[PATH_MAX];
 
l = avl_find_element(&libraries, file, l, avl);
if (!l)
return NULL;
 
-   snprintf(path, sizeof(path), "%s/%s", l->path, file);
-
-   return path;
+   return l->path;
 }
 
 static int elf64_find_section(const char *map, unsigned int type, unsigned int 
*offset, unsigned int *size, unsigned int *vaddr)
@@ -197,7 +189,7 @@ static int elf32_scan_dynamic(const char *map, int 
dyn_offset, int dyn_size, int
if (curr->d_tag != DT_NEEDED)
continue;
 
-   if (elf_load_deps(&strtab[curr->d_un.d_val]))
+   if (add_path_and_deps(&strtab[curr->d_un.d_val], 1, -1, 1))
return -1;
}
 
@@ -231,79 +223,37 @@ static int elf64_scan_dynamic(const char *map, int 
dyn_offset, int dyn_size, int
if (curr->d_tag != DT_NEEDED)
continue;
 
-   if (elf_load_deps(&strtab[curr->d_un.d_val]))
+   if (add_path_and_deps(&strtab[curr->d_un.d_val], 1, -1, 1))
return -1;
}
 
return 0;
 }
 
-int elf_load_deps(const char *library)
+int elf_load_deps(const char *path, const char *map)
 {
unsigned int dyn_offset, dyn_size;
unsigned int load_offset, load_vaddr;
-   struct stat s;
-   char *map = NULL, *dir = NULL;
-   int clazz, fd, ret = -1;
-
-   if (avl_find(&libraries, library))
-   return 0;
-
-   fd = elf_

Re: [OpenWrt-Devel] UniFi-AC-LR ( or UniFi-AC-LITE )

2015-11-27 Thread Andrew Margarit | Cucumber WiFI

They have added this

Firmware Version: BZ.qca956x.v3.4.7.3284.150911.1650
RSA Signed Firmware. Verfiying please wait...

Decrypted hash: f8 2b 45 72 9f e4 5f 46 a0 96 43 37 57 4f 49 ab 43 dc 1e 8c
Image hash: f8 2b 45 72 9f e4 5f 46 a0 96 43 37 57 4f 49 ab 43 dc 1e 8c


RSA signature check.
Could it be similar to this?
https://github.com/xdarklight/mktplinkfw3/blob/master/README.md

--
They must have some sort of protection in there bootloader,
immediately after OpenWRT is put onto the device via TFTP the error
"Application terminated, rc=0x" shows up.
I wonder what it's expecting?

Interestingly enough, there is a 2nd kernel partition ( kernel0 and
kernel1 ) It boots into kernel1 if kernel0 fails.

Receiving file from 192.168.1.25:53844
Received 3539292 bytes
TFTP Transfer Complete.
Bytes transferred = 3539292 (36015c hex)
## Starting application at 0x80200020 ...
Firmware Version: BZ.qca956x.v6.0.0-OpenWrt-r47065
## Application terminated, rc = 0x
## Starting application at 0x80200020 ...
Number of boot partitions = 2
get_mtd_params: name=bs
ubnt_flash_read: addr=8023b480, sa=9ff9, sz=131072
ubnt_get_bootsel: Boot partition selected = 1
Loading Kernel Image @ 8100, size = 7929856
Verifying 'kernel1' parition:OK
## Application terminated, rc = 0x0
## Booting image at 9f80 ...
   Image Name:   MIPS OpenWrt Linux-3.3.8
   Created:  2015-09-12   0:03:12 UTC
   Image Type:   MIPS Linux Multi-File Image (lzma compressed)
   Data Size:6877256 Bytes =  6.6 MB
   Load Address: 8006
   Entry Point:  8006
   Contents:
   Image 0:  6877248 Bytes =  6.6 MB
   Verifying Checksum at 0x9f800040 ...OK
   Uncompressing Multi-File Image ... OK
No initrd
## Transferring control to Linux (at address 8006) ...
## Giving linux memsize in bytes, 134217728

Starting kernel ...

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


[OpenWrt-Devel] [PATCH] brcm63xx: Add NuCom R5010UNv2 support

2015-11-27 Thread dani
This patch adds support for the NuCom R5010UNv2.

It's a BCM6328 based board. It has an onboard BCM43217 wifi chip. For this
wifi chip looks like the brcmsmac driver isn't still supported, b43 drivers are 
used
for the profile of the router.

It's worth mentioning this board was affected by a bug solved with
https://dev.openwrt.org/changeset/46707

Signed-off-by: Daniel Gonzalez 
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh 
b/target/linux/brcm63xx/base-files/etc/diag.sh
index 7826fad..c0fb31e 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -102,6 +102,9 @@ set_state() {
p870hw-51a_v2)
status_led="P870HW-51a:green:power"
;;
+   r5010un_v2)
+   status_led="96328ang:green:power"
+   ;;
rta770bw)
status_led="RTA770BW:green:diag"
;;
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
index bdb3dad..34d5c51 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
@@ -46,6 +46,9 @@ homehub2a)
ucidef_set_led_usbdev "usb1" "USB1" "HOMEHUB2A:blue:phone" "1-1"
ucidef_set_led_usbdev "usb2" "USB2" "HOMEHUB2A:green:phone" "2-1"
;;
+r5010un_v2)
+   ucidef_set_led_usbdev "usb" "USB" "96328ang:green:usb" "1-2"
+   ;;
 esac
 
 ucidef_commit_leds
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
index 129514b..70f18cb 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -94,6 +94,7 @@ fast2504n |\
 fast2704v2 |\
 hg655b |\
 p870hw-51a_v2 |\
+r5010un_v2 |\
 vr-3025un |\
 vr-3025u |\
 vr-3026e)
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index f307a4c..bc9ae21 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -23,6 +23,7 @@ case "$(brcm63xx_board_name)" in
dsl-274xb-f |\
magic |\
p870hw-51a_v2 |\
+   r5010un_v2 |\
rta770bw |\
rta770w |\
spw303v |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh 
b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 1a97c86..7dc57fd 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -180,6 +180,9 @@ brcm63xx_dt_detect() {
"Netgear DGND3700v1/DGND3800B")
board_name="dgnd3700v1_dgnd3800b"
;;
+   "NuCom R5010UN v2")
+   board_name="r5010un_v2"
+   ;;
"Pirelli A226G")
board_name="a226g"
;;
diff --git a/target/linux/brcm63xx/dts/r5010unv2.dts 
b/target/linux/brcm63xx/dts/r5010unv2.dts
new file mode 100644
index 000..8c83483
--- /dev/null
+++ b/target/linux/brcm63xx/dts/r5010unv2.dts
@@ -0,0 +1,64 @@
+/dts-v1/;
+
+#include "bcm6328.dtsi"
+
+#include 
+
+/ {
+   model = "NuCom R5010UN v2";
+   compatible = "nucom,r5010unv2", "brcm,bcm6328";
+   
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <20>;
+   debounce-interval = <60>;
+
+   reset {
+   label = "reset";
+   gpios = <&gpio0 23 1>;
+   linux,code = ;
+   };
+   wps {
+   label = "wps";
+   gpios = <&gpio0 24 1>;
+   linux,code = ;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   inet {
+   label = "96328ang:green:inet";
+   gpios = <&gpio0 1 1>;
+   };
+   inet_fail {
+   label = "96328ang:red:inet-fail";
+   gpios = <&gpio0 2 1>;
+   };
+   dsl {
+   label = "96328ang:green:dsl";
+   gpios = <&gpio0 3 1>;
+   };
+   power {
+   label = "96328ang:green:power";
+   gpios = <&gpio0 4 1>;
+   default-state = "on";
+   };
+   power_fail {
+   label = "96328ang:red:power-fail";
+   gpios = <&gpio0 5 1>;
+   };
+   wps {
+   label = "96328ang:green:wps";
+   gpios = <&gpio0 10 1>;
+   };
+   usb {
+ 

Re: [OpenWrt-Devel] [PATCH v5 1/5] ar71xx: add eth rx delay for qca955x platforms

2015-11-27 Thread Christian Lamparter
On Saturday, November 21, 2015 08:45:23 PM John Crispin wrote:
> Hi,
> 
> sorry to jump in this late at a V5 but i have a few concerns. see inline
Well, the *beautiful thing* of this platform is that Cisco charges people
a yearly fee if they want to stick with the original firmware. So people
are definitely interested in this openwrt port. Just look at the positive
response to the support thread [0].
 
> On 22/09/2015 18:49, Chris R Blake wrote:
> > From: Chris R Blake 
> > 
> > This patch is to add support for qca955x_eth_rx_delay
> > to work with the qca955x SoC.
> > 
> > Signed-off-by: Chris R Blake 
> > ---
> >  ...42-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch | 58 
> > ++
> >  1 file changed, 58 insertions(+)
> >  create mode 100644 
> > target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
> > 
> > diff --git 
> > a/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
> >  
> > b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
> > new file mode 100644
> > index 000..75e216e
> > --- /dev/null
> > +++ 
> > b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
> > @@ -0,0 +1,58 @@
> > +--- a/arch/mips/ath79/dev-eth.c
> >  b/arch/mips/ath79/dev-eth.c
> > +@@ -823,6 +825,32 @@
> > +   iounmap(base);
> > + }
> > +
> > ++void __init ath79_setup_qca955x_eth_rx_delay(unsigned int rxd,
> > ++unsigned int rxdv)
> > ++{
> > ++  void __iomem *base;
> > ++  u32 t;
> > ++
> > ++  rxd &= QCA955X_ETH_CFG_RXD_DELAY_MASK;
> > ++  rxdv &= QCA955X_ETH_CFG_RDV_DELAY_MASK;
> > ++
> > ++  base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
> > ++
> > ++  t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
> > ++
> > ++  t &= ~(QCA955X_ETH_CFG_RXD_DELAY_MASK << 
> > QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
> > ++ QCA955X_ETH_CFG_RDV_DELAY_MASK << 
> > QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
> > ++
> > ++  t |= (rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
> > ++rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
> > ++
> > ++  __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
> > ++  /* flush write */
> > ++  __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
> > ++
> > ++  iounmap(base);
> 
> this is a pretty ugly way of doing it. the register is also modified at
> a different place which is also not optimal. the register is part of the
> ethernet macs io range so this magic setting should be applied inside
> the the actual driver. could you make such a change ?
> 
>   John

Wait, the code for this function was just adapted (qca955x uses
slightly different registers and bitmask offsets) from a similar
function called:

void __init ath79_setup_ar934x_eth_rx_delay(unsigned int rxd,
unsigned int rxdv)

which is also in the dev-eth.c [1] (added Felix). If this is
"pretty ugly" then what should be done about ath79_setup_ar934x_eth_rx_delay?
If it's just the function that bothers you, I can also pass the
rx/tx delays via the ath79_setup_qca955x_eth_cfg call. but I 
would like to keep the ar71xx_regs changes in place. Ok?

> > +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> >  b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> > +@@ -1098,5 +1098,11 @@
> > +
> > + #define QCA955X_ETH_CFG_RGMII_EN  BIT(0)
> > + #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
> > ++#define QCA955X_ETH_CFG_RXD_DELAY BIT(14)
> > ++#define QCA955X_ETH_CFG_RXD_DELAY_MASK0x3
> > ++#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT   14
> > ++#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
> > ++#define QCA955X_ETH_CFG_RDV_DELAY_MASK0x3
> > ++#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT   16

Regards,
Christian

[0] 
[1] 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 8/8] ramips: update dtsi files to support second spi device

2015-11-27 Thread Álvaro Fernández Rojas

Dear Mingyu,

It works perfectly after adding the second spi clock:
https://gist.github.com/Noltari/9231b6c73c3b36e681ef

I'm sorry but I couldn't test this before.

Regards,
Álvaro.

El 23/11/2015 a las 2:41, Mingyu Li escribió:

Dear Sir.

you need to modify kernel file at "arch/mips/ralink/rt305x.c"
add the code below.

ralink_clk_add("1b00.spi", sys_rate);
+ralink_clk_add("1b40.spi", sys_rate);
ralink_clk_add("1100.timer", wdt_rate);

please let me know if the second spi works. if works
i will commit a patch about the second spi clock include
all other targets.
thanks.

Best Regards.

2015-11-23 3:08 GMT+08:00 John Crispin >:




On 22/11/2015 16:15, Álvaro Fernández Rojas wrote:
> Hello guys,
>
> I've just tested this patch on my VoCore after it was applied on
r47580.
> I had to make the following changes:
>

https://github.com/openwrt-es/openwrt/commit/e040cf00441e973978a6c168b346b13e33f37853
>
>
> However, I'm getting the following error: "spi-rt2880 1b40.spi:
> unable to get SYS clock"
> https://gist.github.com/Noltari/7629d3384fe421517336
>
> Did anyone actually test this with both spi nodes enabled?
>
> Regards,
> Álvaro.

i only compile tested it.

John

>
> El 08/10/2015 a las 16:16, Michael Lee escribió:
>> Signed-off-by: Michael Lee mailto:igv...@gmail.com>>
>> ---
>>   target/linux/ramips/dts/mt7620a.dtsi  |  32 +-
>>   target/linux/ramips/dts/mt7620n.dtsi  |  32 +-
>>   target/linux/ramips/dts/rt3050.dtsi   |   6 +-
>>   target/linux/ramips/dts/rt3352.dtsi   |  31 +-
>>   target/linux/ramips/dts/rt3883.dtsi   |  25 +-
>>   target/linux/ramips/dts/rt5350.dtsi   |  29 +-
>>   .../0051-rt5350-spi-second-device.patch   | 368
>> -
>>   7 files changed, 143 insertions(+), 380 deletions(-)
>>   delete mode 100644
>>
target/linux/ramips/patches-3.18/0051-rt5350-spi-second-device.patch
>>
>> diff --git a/target/linux/ramips/dts/mt7620a.dtsi
>> b/target/linux/ramips/dts/mt7620a.dtsi
>> index 026e745..448df75 100644
>> --- a/target/linux/ramips/dts/mt7620a.dtsi
>> +++ b/target/linux/ramips/dts/mt7620a.dtsi
>> @@ -20,6 +20,11 @@
>>   compatible = "mti,cpu-interrupt-controller";
>>   };
>>   +aliases {
>> +spi0 = &spi0;
>> +spi1 = &spi1;
>> +};
>> +
>>   palmbus@1000 {
>>   compatible = "palmbus";
>>   reg = <0x1000 0x20>;
>> @@ -202,9 +207,9 @@
>>   status = "disabled";
>>   };
>>   -spi@b00 {
>> +spi0: spi@b00 {
>>   compatible = "ralink,mt7620a-spi",
"ralink,rt2880-spi";
>> -reg = <0xb00 0x100>;
>> +reg = <0xb00 0x40>;
>> resets = <&rstctrl 18>;
>>   reset-names = "spi";
>> @@ -218,6 +223,22 @@
>>   pinctrl-0 = <&spi_pins>;
>>   };
>>   +spi1: spi@b40 {
>> +compatible = "ralink,rt2880-spi";
>> +reg = <0xb40 0x60>;
>> +
>> +resets = <&rstctrl 18>;
>> +reset-names = "spi";
>> +
>> +#address-cells = <1>;
>> +#size-cells = <1>;
>> +
>> +status = "disabled";
>> +
>> +pinctrl-names = "default";
>> +pinctrl-0 = <&spi_cs1>;
>> +};
>> +
>>   uartlite@c00 {
>>   compatible = "ralink,mt7620a-uart",
>> "ralink,rt2880-uart", "ns16550a";
>>   reg = <0xc00 0x100>;
>> @@ -305,6 +326,13 @@
>>   };
>>   };
>>   +spi_cs1: spi1 {
>> +spi1 {
>> +ralink,group = "spi_cs1";
>> +ralink,function = "spi_cs1";
>> +};
>> +};
>> +
>>   i2c_pins: i2c {
>>   i2c {
>>   ralink,group = "i2c";
>> diff --git a/target/linux/ramips/dts/mt7620n.dtsi
>> b/target/linux/ramips/dts/mt7620n.dtsi
>> index b1586ec..a3132b8 100644
>> --- a/target/linux/ramips/dts/mt7620n.dtsi
>> +++ b/target/linux/ramips/dts/mt7620n.dtsi
>> @@ -20,6 +20,11 @@
>>   compatible = "mti,cpu-interrupt-controller";
>>   };
>>   +aliases {
>> +spi0 = &spi0;
>> +spi1 = &spi1;
>> +};
>> +
>>   palmbus@1000 {
>>   compatible = "palmbus";
>>   reg = <0x1000 0x20>;
>> @@ -154,9 +159,9 @@
>>   status = "disabled";
>>   };
>>   -spi@b00 {
>> +spi0: spi@b00 {
>>   compatible = "ralink,mt7620a-spi",
   

[OpenWrt-Devel] [PATCH 1/2] ramips: add second SPI clocks

2015-11-27 Thread Álvaro Fernández Rojas
These clocks were missing in the changes introduced in r47573-47580

Signed-off-by: Álvaro Fernández Rojas 
---
 ...0051-SPI-ralink-add-Ralink-SoC-spi-clocks.patch | 30 ++
 1 file changed, 30 insertions(+)
 create mode 100644 
target/linux/ramips/patches-3.18/0051-SPI-ralink-add-Ralink-SoC-spi-clocks.patch

diff --git 
a/target/linux/ramips/patches-3.18/0051-SPI-ralink-add-Ralink-SoC-spi-clocks.patch
 
b/target/linux/ramips/patches-3.18/0051-SPI-ralink-add-Ralink-SoC-spi-clocks.patch
new file mode 100644
index 000..bca872f
--- /dev/null
+++ 
b/target/linux/ramips/patches-3.18/0051-SPI-ralink-add-Ralink-SoC-spi-clocks.patch
@@ -0,0 +1,30 @@
+--- a/arch/mips/ralink/mt7620.c
 b/arch/mips/ralink/mt7620.c
+@@ -415,6 +415,7 @@ void __init ralink_clk_init(void)
+   ralink_clk_add("1100.timer", periph_rate);
+   ralink_clk_add("1120.watchdog", periph_rate);
+   ralink_clk_add("1b00.spi", sys_rate);
++  ralink_clk_add("1b40.spi", sys_rate);
+   ralink_clk_add("1c00.uartlite", periph_rate);
+   ralink_clk_add("1d00.uart1", periph_rate);
+   ralink_clk_add("1e00.uart2", periph_rate);
+--- a/arch/mips/ralink/rt305x.c
 b/arch/mips/ralink/rt305x.c
+@@ -201,6 +201,7 @@ void __init ralink_clk_init(void)
+   ralink_clk_add("cpu", cpu_rate);
+   ralink_clk_add("sys", sys_rate);
+   ralink_clk_add("1b00.spi", sys_rate);
++  ralink_clk_add("1b40.spi", sys_rate);
+   ralink_clk_add("1100.timer", wdt_rate);
+   ralink_clk_add("1120.watchdog", wdt_rate);
+   ralink_clk_add("1500.uart", uart_rate);
+--- a/arch/mips/ralink/rt3883.c
 b/arch/mips/ralink/rt3883.c
+@@ -109,6 +109,7 @@ void __init ralink_clk_init(void)
+   ralink_clk_add("1120.watchdog", sys_rate);
+   ralink_clk_add("1500.uart", 4000);
+   ralink_clk_add("1b00.spi", sys_rate);
++  ralink_clk_add("1b40.spi", sys_rate);
+   ralink_clk_add("1c00.uartlite", 4000);
+   ralink_clk_add("1010.ethernet", sys_rate);
+   ralink_clk_add("1018.wmac", 4000);
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] ramips: adapt VoCore to new second spi device code

2015-11-27 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 target/linux/ramips/dts/VOCORE-16M.dts | 58 --
 target/linux/ramips/dts/VOCORE-8M.dts  | 58 --
 target/linux/ramips/dts/VOCORE.dtsi| 20 ++--
 3 files changed, 66 insertions(+), 70 deletions(-)

diff --git a/target/linux/ramips/dts/VOCORE-16M.dts 
b/target/linux/ramips/dts/VOCORE-16M.dts
index 464c137..a1e854e 100644
--- a/target/linux/ramips/dts/VOCORE-16M.dts
+++ b/target/linux/ramips/dts/VOCORE-16M.dts
@@ -2,40 +2,38 @@
 
 /include/ "VOCORE.dtsi"
 
-/ {
-   palmbus@1000 {
-   spi@b00 {
-   m25p80@0 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   compatible = "w25q128";
-   reg = <0>;
-   linux,modalias = "m25p80", "w25q128";
-   spi-max-frequency = <1000>;
+&spi0 {
+   status = "okay";
 
-   partition@0 {
-   label = "uboot";
-   reg = <0x0 0x3>;
-   read-only;
-   };
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "w25q128";
+   reg = <0>;
+   linux,modalias = "m25p80", "w25q128";
+   spi-max-frequency = <1000>;
 
-   partition@3 {
-   label = "uboot-env";
-   reg = <0x3 0x1>;
-   read-only;
-   };
+   partition@0 {
+   label = "uboot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "uboot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
 
-   factory: partition@4 {
-   label = "factory";
-   reg = <0x4 0x1>;
-   read-only;
-   };
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
 
-   partition@5 {
-   label = "firmware";
-   reg = <0x5 0xfb>;
-   };
-   };
+   partition@5 {
+   label = "firmware";
+   reg = <0x5 0xfb>;
};
};
 };
diff --git a/target/linux/ramips/dts/VOCORE-8M.dts 
b/target/linux/ramips/dts/VOCORE-8M.dts
index 8a081ed..ba6d32e 100644
--- a/target/linux/ramips/dts/VOCORE-8M.dts
+++ b/target/linux/ramips/dts/VOCORE-8M.dts
@@ -2,40 +2,38 @@
 
 /include/ "VOCORE.dtsi"
 
-/ {
-   palmbus@1000 {
-   spi@b00 {
-   m25p80@0 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   compatible = "s25fl064k";
-   reg = <0>;
-   linux,modalias = "m25p80", "s25fl064k";
-   spi-max-frequency = <1000>;
+&spi0 {
+   status = "okay";
 
-   partition@0 {
-   label = "uboot";
-   reg = <0x0 0x3>;
-   read-only;
-   };
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "s25fl064k";
+   reg = <0>;
+   linux,modalias = "m25p80", "s25fl064k";
+   spi-max-frequency = <1000>;
 
-   partition@3 {
-   label = "uboot-env";
-   reg = <0x3 0x1>;
-   read-only;
-   };
+   partition@0 {
+   label = "uboot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "uboot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
 
-   factory: partition@4 {
-   labe

[OpenWrt-Devel] [PATCH] procd: hotplug.json: allow passing hotplug events from all subsystems

2015-11-27 Thread Yousong Zhou
There are time that programs need to be notified of events from
subsystems that are not enumerated in the .json definition, e.g. QEMU
guest agent by default requires /dev/virtio-ports/org.qemu.guest_agent.0
which is a symlink to /dev/vportMpN from virtio-ports subsystem.

Signed-off-by: Yousong Zhou 
---
 package/system/procd/files/hotplug.json | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/package/system/procd/files/hotplug.json 
b/package/system/procd/files/hotplug.json
index 27b4836..bad2340 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -69,18 +69,13 @@
[ "button", "/etc/rc.button/%BUTTON%" ]
],
[ "if",
-   [ "eq", "SUBSYSTEM",
-   [ "net", "input", "usb", "usbmisc", "ieee1394", 
"block", "atm", "zaptel", "tty", "button" ]
-   ],
-   [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
-   ],
-   [ "if",
[ "and",
[ "eq", "SUBSYSTEM", "usb-serial" ],
[ "regex", "DEVNAME",
[ "^ttyUSB", "^ttyACM" ]
],
],
-   [ "exec", "/sbin/hotplug-call", "tty" ]
+   [ "exec", "/sbin/hotplug-call", "tty" ],
+   [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
],
 ]
-- 
2.6.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] procd: hotplug.json: allow passing hotplug events from all subsystems

2015-11-27 Thread Yousong Zhou
On 28 November 2015 at 12:22, Yousong Zhou  wrote:
> There are time that programs need to be notified of events from
> subsystems that are not enumerated in the .json definition, e.g. QEMU
> guest agent by default requires /dev/virtio-ports/org.qemu.guest_agent.0
> which is a symlink to /dev/vportMpN from virtio-ports subsystem.
>

For the record, the PR about qemu-ga is at
https://github.com/openwrt/packages/pull/2041

yousong

> Signed-off-by: Yousong Zhou 
> ---
>  package/system/procd/files/hotplug.json | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/package/system/procd/files/hotplug.json 
> b/package/system/procd/files/hotplug.json
> index 27b4836..bad2340 100644
> --- a/package/system/procd/files/hotplug.json
> +++ b/package/system/procd/files/hotplug.json
> @@ -69,18 +69,13 @@
> [ "button", "/etc/rc.button/%BUTTON%" ]
> ],
> [ "if",
> -   [ "eq", "SUBSYSTEM",
> -   [ "net", "input", "usb", "usbmisc", "ieee1394", 
> "block", "atm", "zaptel", "tty", "button" ]
> -   ],
> -   [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
> -   ],
> -   [ "if",
> [ "and",
> [ "eq", "SUBSYSTEM", "usb-serial" ],
> [ "regex", "DEVNAME",
> [ "^ttyUSB", "^ttyACM" ]
> ],
> ],
> -   [ "exec", "/sbin/hotplug-call", "tty" ]
> +   [ "exec", "/sbin/hotplug-call", "tty" ],
> +   [ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
> ],
>  ]
> --
> 2.6.3
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Add support for Ubuquiti EdgeRouter X (UBNT-ERX)

2015-11-27 Thread Nikolay Martynov
This router is based on MT7621 SoC, no wifi, nand.

Works:
* Boots.
* Ethernet.
* Switch.
* Button (reset).
* Flashing OpenWrt from stock firmware.
* Upgrading OpenWrt.

Doesn't work:
* No GPIO leds. All leds are controlled by switch,
  but stock firmware was able to control them.
* SoC has crypto engine but no open driver.
* SoC has nat acceleration, but no open driver.
* This router has 2MB spi flash soldered in but MT
  nand/spi drivers do not support pin sharing,
  so it is not accessable and disabled. Stock
  firmware could read it and it was empty.

Unknown status: PoE support.

Router has serial pins populated. If looking at the top
of the router, then counting from Eth sockets pins go as:
'GND, RX, TX, GND'. 3.3v, 57600.

U-boot bootloader supports tftpboot, controlled from serial.
This router has two kernel partitions: 'live' and 'backup'.
They are swapped during flashing (on both stock and OpenWrt).
Active partition is controlled by a flag in factory partition.
U-boot has cusotm command to switch active kernel partition.
Kernel partitions are 'bare flash' 3MB. Stock bootloader has
no UBI support. Stock rootfs is UBIFS.

Flashing procedure.
Stock firmware uses custom kernel patch to mount squashfs
from a file that is located on UBIFS volume. This makes wiping
out this volume from within stock firmware difficult.
Instead this patch builds image that is flashable by stock firmware
and contains initrams image (with minimal set of packages
to fit into kernel partition). Once this is flashed one can reboot
into initramfs OpenWrt and use sysupgrade to flash OpenWrt including
rootfs into nand.

Signed-off-by: Nikolay Martynov 
---
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   5 +-
 .../ramips/base-files/lib/upgrade/platform.sh  |  14 +++
 target/linux/ramips/base-files/lib/upgrade/ubnt.sh |  74 +
 target/linux/ramips/dts/UBNT-ERX.dts   | 117 +
 target/linux/ramips/dts/mt7621.dtsi|  20 
 target/linux/ramips/image/Makefile |  62 ++-
 target/linux/ramips/mt7621/profiles/ubnt-erx.mk|  18 
 .../patches-3.18/0901-spansion_nand_id_fix.patch   |  39 +++
 9 files changed, 328 insertions(+), 22 deletions(-)
 create mode 100644 target/linux/ramips/base-files/lib/upgrade/ubnt.sh
 create mode 100644 target/linux/ramips/dts/UBNT-ERX.dts
 create mode 100644 target/linux/ramips/mt7621/profiles/ubnt-erx.mk
 create mode 100644 
target/linux/ramips/patches-3.18/0901-spansion_nand_id_fix.patch

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 7e51229..de81553 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -122,6 +122,7 @@ ramips_setup_interfaces()
f5d8235-v2|\
hg255d|\
rt-n14u|\
+   ubnt-erx|\
ur-326n4g|\
wrtnode|\
wt3020|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 92e13c0..ba23939 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -349,6 +349,9 @@ ramips_board_detect() {
*"TEW-692GR")
name="tew-692gr"
;;
+   *"UBNT-ERX")
+   name="ubnt-erx"
+   ;;
*"UR-326N4G")
name="ur-326n4g"
;;
@@ -396,7 +399,7 @@ ramips_board_detect() {
;;
*"WizFi630A")
name="wizfi630a"
-   ;;
+   ;;
*"WL-330N")
name="wl-330n"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 073593a..987da23 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -181,12 +181,26 @@ platform_check_image() {
}
return 0
;;
+   ubnt-erx)
+   nand_do_platform_check $board $1
+   return $?;
+   ;;
esac
 
echo "Sysupgrade is not yet supported on $board."
return 1
 }
 
+platform_pre_upgrade() {
+   local board=$(ramips_board_name)
+
+   case "$board" in
+   "ubnt-erx")
+   platform_do_upgrade_ubnt_erx "$ARGV"
+   ;;
+   esac
+}
+
 platform_do_upgrade() {
local board=$(ramips_board_name)
 
diff --git a/target/linux/ramips/base-files/lib/upgrade/ubnt.sh 
b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh
new file mode 100644
index 000..dd02f17
--- /dev/null
+++ b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+UBNT_ERX_KERNEL_INDEX_OFFSET=160
+
+ubnt_ge

[OpenWrt-Devel] [PATCH v2] Add support for Ubuquiti EdgeRouter X (UBNT-ERX)

2015-11-27 Thread Nikolay Martynov
This router is based on MT7621 SoC, no wifi, nand.

Works:
* Boots.
* Ethernet.
* Switch.
* Button (reset).
* Flashing OpenWrt from stock firmware.
* Upgrading OpenWrt.

Doesn't work:
* No GPIO leds. All leds are controlled by switch,
  but stock firmware was able to control them.
* SoC has crypto engine but no open driver.
* SoC has nat acceleration, but no open driver.
* This router has 2MB spi flash soldered in but MT
  nand/spi drivers do not support pin sharing,
  so it is not accessable and disabled. Stock
  firmware could read it and it was empty.

Unknown status: PoE support.

Router has serial pins populated. If looking at the top
of the router, then counting from Eth sockets pins go as:
'GND, RX, TX, GND'. 3.3v, 57600.

U-boot bootloader supports tftpboot, controlled from serial.
This router has two kernel partitions: 'live' and 'backup'.
They are swapped during flashing (on both stock and OpenWrt).
Active partition is controlled by a flag in factory partition.
U-boot has cusotm command to switch active kernel partition.
Kernel partitions are 'bare flash' 3MB. Stock bootloader has
no UBI support. Stock rootfs is UBIFS.

Flashing procedure.
Stock firmware uses custom kernel patch to mount squashfs
from a file that is located on UBIFS volume. This makes wiping
out this volume from within stock firmware difficult.
Instead this patch builds image that is flashable by stock firmware
and contains initrams image (with minimal set of packages
to fit into kernel partition). Once this is flashed one can reboot
into initramfs OpenWrt and use sysupgrade to flash OpenWrt including
rootfs into nand.
Note: factory image is only built if initramfs image is enabled

v2: fix building all mt7621 targets along with ubnt-erx

Signed-off-by: Nikolay Martynov 
---
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   5 +-
 .../ramips/base-files/lib/upgrade/platform.sh  |  14 +++
 target/linux/ramips/base-files/lib/upgrade/ubnt.sh |  74 +
 target/linux/ramips/dts/UBNT-ERX.dts   | 117 +
 target/linux/ramips/dts/mt7621.dtsi|  20 
 target/linux/ramips/image/Makefile |  61 ++-
 target/linux/ramips/mt7621/profiles/ubnt-erx.mk|  17 +++
 .../patches-3.18/0901-spansion_nand_id_fix.patch   |  39 +++
 9 files changed, 326 insertions(+), 22 deletions(-)
 create mode 100644 target/linux/ramips/base-files/lib/upgrade/ubnt.sh
 create mode 100644 target/linux/ramips/dts/UBNT-ERX.dts
 create mode 100644 target/linux/ramips/mt7621/profiles/ubnt-erx.mk
 create mode 100644 
target/linux/ramips/patches-3.18/0901-spansion_nand_id_fix.patch

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 7e51229..de81553 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -122,6 +122,7 @@ ramips_setup_interfaces()
f5d8235-v2|\
hg255d|\
rt-n14u|\
+   ubnt-erx|\
ur-326n4g|\
wrtnode|\
wt3020|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 92e13c0..ba23939 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -349,6 +349,9 @@ ramips_board_detect() {
*"TEW-692GR")
name="tew-692gr"
;;
+   *"UBNT-ERX")
+   name="ubnt-erx"
+   ;;
*"UR-326N4G")
name="ur-326n4g"
;;
@@ -396,7 +399,7 @@ ramips_board_detect() {
;;
*"WizFi630A")
name="wizfi630a"
-   ;;
+   ;;
*"WL-330N")
name="wl-330n"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 073593a..987da23 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -181,12 +181,26 @@ platform_check_image() {
}
return 0
;;
+   ubnt-erx)
+   nand_do_platform_check $board $1
+   return $?;
+   ;;
esac
 
echo "Sysupgrade is not yet supported on $board."
return 1
 }
 
+platform_pre_upgrade() {
+   local board=$(ramips_board_name)
+
+   case "$board" in
+   "ubnt-erx")
+   platform_do_upgrade_ubnt_erx "$ARGV"
+   ;;
+   esac
+}
+
 platform_do_upgrade() {
local board=$(ramips_board_name)
 
diff --git a/target/linux/ramips/base-files/lib/upgrade/ubnt.sh 
b/target/linux/ramips/base-files/lib/upgrade/ubnt.sh
new file mode 100644
index 000..dd02f17
--- /dev/null
+++ b/target/linux/ramips/base-files/lib