Adding OpenWrt support for custom device - Contract opportunity

2022-02-10 Thread Cristian Morales Vega
We're working with an ODM vendor in China to develop a new hardware
device. The hardware is based on the Mediatek MT7622 SoC (already
supported in OpenWRT), with a Realtek 2.5GbE PHY and MTK Wi-Fi 6. We
have limited knowledge about the details of the hardware, and frankly
we don't even know the right questions to ask. The ODM vendor is
willing and able to help with hardware matters, but has little
software expertise. We have a relationship with MTK so can request the
necessary SDKs if needed.

The ODM has already provided a more or less working demo firmware
based on an old LEDE version (probably based on a SDK from Mediatek),
but they can't provide the sources. We also have a development device
locally. From this demo firmware we can extract the Device Tree and
other basic information about the hardware.

The ask here is for a contractor to help develop an OpenWrt based
firmware to support the hardware provided by the ODM.

-- 
Cristian Morales Vega

Email crist...@samknows.com
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103

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


Re: [OpenWrt-Devel] [PATCH] ramips: mt7621: add support for disabling flow control

2016-04-11 Thread Cristian Morales Vega
Sorry, for some reason I didn't receive your reply (but patchwork told
me about it), so I am replying here.

Maybe it's something that should be done with ethtool, but I had no
idea those phys were exposed through anything other than swconfig.
What would be the "DEVNAME" in "ethtool -a DEVNAME" if I want to, for
example, check the settings of the switch port #3?


On 5 April 2016 at 15:22, Cristian Morales Vega <crist...@samknows.com> wrote:
> Signed-off-by: Cristian Morales Vega <crist...@samknows.com>
> ---
>  ...diatek-add-swconfig-driver-for-gsw_mt762x.patch | 54 
> +-
>  1 file changed, 53 insertions(+), 1 deletion(-)
>
> diff --git 
> a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
>  
> b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
> index bbad8cc..d056551 100644
> --- 
> a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
> +++ 
> b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
> @@ -28,7 +28,7 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
>   obj-$(CONFIG_NET_MEDIATEK_SOC)+= mtk-eth-soc.o
>  --- /dev/null
>  +++ b/drivers/net/ethernet/mediatek/mt7530.c
> -@@ -0,0 +1,804 @@
> +@@ -0,0 +1,856 @@
>  +/*
>  + * This program is free software; you can redistribute it and/or
>  + * modify it under the terms of the GNU General Public License
> @@ -709,6 +709,50 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
>  +  return 0;
>  +}
>  +
> ++static int mt7621_sw_get_port_fc(struct switch_dev *dev,
> ++   const struct switch_attr *attr,
> ++   struct switch_val *val)
> ++{
> ++  u32 reg;
> ++  struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, 
> swdev);
> ++
> ++  if (val->port_vlan >= MT7530_NUM_PORTS)
> ++  return -EINVAL;
> ++
> ++  reg = mdiobus_read(priv->bus, val->port_vlan, 4);
> ++  reg &= BIT(10);
> ++
> ++  val->value.i = reg ? 1 : 0;
> ++
> ++  return 0;
> ++}
> ++
> ++static int mt7621_sw_set_port_fc(struct switch_dev *dev,
> ++   const struct switch_attr *attr,
> ++   struct switch_val *val)
> ++{
> ++  u32 reg;
> ++  struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, 
> swdev);
> ++
> ++  if (val->port_vlan >= MT7530_NUM_PORTS)
> ++  return -EINVAL;
> ++
> ++  reg = mdiobus_read(priv->bus, val->port_vlan, 4);
> ++  if(val->value.i) {
> ++  reg |= BIT(10);
> ++  } else {
> ++  reg &= ~BIT(10);
> ++  }
> ++  mdiobus_write(priv->bus, val->port_vlan, 4, reg);
> ++
> ++  /* Restart auto-negotiation */
> ++  reg = mdiobus_read(priv->bus, val->port_vlan, 0);
> ++  reg |= BIT(9);
> ++  mdiobus_write(priv->bus, val->port_vlan, 0, reg);
> ++
> ++  return 0;
> ++}
> ++
>  +static const struct switch_attr mt7621_port[] = {
>  +  {
>  +  .type = SWITCH_TYPE_STRING,
> @@ -717,6 +761,14 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
>  +  .get = mt7621_sw_get_port_mib,
>  +  .set = NULL,
>  +  },
> ++  {
> ++      .type = SWITCH_TYPE_INT,
> ++  .name = "flow_ctl",
> ++  .description = "Flow Control",
> ++  .get = mt7621_sw_get_port_fc,
> ++  .set = mt7621_sw_set_port_fc,
> ++  .max = 1,
> ++  },
>  +};
>  +
>  +static const struct switch_attr mt7530_port[] = {
> --
> 2.6.3
>



-- 
Cristian Morales Vega

Email crist...@samknows.com
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: mt7621: add support for disabling flow control

2016-04-05 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega <crist...@samknows.com>
---
 ...diatek-add-swconfig-driver-for-gsw_mt762x.patch | 54 +-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git 
a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
 
b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
index bbad8cc..d056551 100644
--- 
a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
+++ 
b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch
@@ -28,7 +28,7 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
  obj-$(CONFIG_NET_MEDIATEK_SOC)+= mtk-eth-soc.o
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mt7530.c
-@@ -0,0 +1,804 @@
+@@ -0,0 +1,856 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -709,6 +709,50 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
 +  return 0;
 +}
 +
++static int mt7621_sw_get_port_fc(struct switch_dev *dev,
++   const struct switch_attr *attr,
++   struct switch_val *val)
++{
++  u32 reg;
++  struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev);
++
++  if (val->port_vlan >= MT7530_NUM_PORTS)
++  return -EINVAL;
++
++  reg = mdiobus_read(priv->bus, val->port_vlan, 4);
++  reg &= BIT(10);
++
++  val->value.i = reg ? 1 : 0;
++
++  return 0;
++}
++
++static int mt7621_sw_set_port_fc(struct switch_dev *dev,
++   const struct switch_attr *attr,
++   struct switch_val *val)
++{
++  u32 reg;
++  struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev);
++
++  if (val->port_vlan >= MT7530_NUM_PORTS)
++  return -EINVAL;
++
++  reg = mdiobus_read(priv->bus, val->port_vlan, 4);
++  if(val->value.i) {
++  reg |= BIT(10);
++  } else {
++  reg &= ~BIT(10);
++  }
++  mdiobus_write(priv->bus, val->port_vlan, 4, reg);
++
++  /* Restart auto-negotiation */
++  reg = mdiobus_read(priv->bus, val->port_vlan, 0);
++  reg |= BIT(9);
++  mdiobus_write(priv->bus, val->port_vlan, 0, reg);
++
++  return 0;
++}
++
 +static const struct switch_attr mt7621_port[] = {
 +  {
 +  .type = SWITCH_TYPE_STRING,
@@ -717,6 +761,14 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
 +  .get = mt7621_sw_get_port_mib,
 +  .set = NULL,
 +  },
++  {
++  .type = SWITCH_TYPE_INT,
++  .name = "flow_ctl",
++  .description = "Flow Control",
++  .get = mt7621_sw_get_port_fc,
++  .set = mt7621_sw_set_port_fc,
++  .max = 1,
++  },
 +};
 +
 +static const struct switch_attr mt7530_port[] = {
-- 
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] ramips: set mips16 support

2016-01-12 Thread Cristian Morales Vega
On 5 January 2016 at 12:22, Felix Fietkau <n...@openwrt.org> wrote:
> On 2016-01-05 13:18, José Vázquez wrote:
>> 2016-01-04 13:02 GMT+01:00, Cristian Morales Vega <crist...@samknows.com>:
>>> Signed-off-by: Cristian Morales Vega <crist...@samknows.com>
>>> ---
>>>  target/linux/ramips/Makefile | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
>>> index 9d7bb5b..378e2f5 100644
>>> --- a/target/linux/ramips/Makefile
>>> +++ b/target/linux/ramips/Makefile
>>> @@ -10,7 +10,7 @@ ARCH:=mipsel
>>>  BOARD:=ramips
>>>  BOARDNAME:=Ralink RT288x/RT3xxx
>>>  SUBTARGETS:=rt305x mt7620 mt7621 mt7628 mt7688 rt3883 rt288x
>>> -FEATURES:=squashfs gpio
>>> +FEATURES:=squashfs gpio mips16
>>>  MAINTAINER:=John Crispin <blo...@openwrt.org>
>>>
>>>  KERNEL_PATCHVER:=4.3
>>> --
>>> 2.5.0
>>
>> AFAIK the RT288X family do not support mips16 (they have a MIPS 4KEc
>> cpu if I'm not wrong).
> Nice catch, thanks. Fixed in r48137

Not arguing either against or in favour of backporting it to 15.05.
But I see the RT288x fix has been backported... but not the MIPS16
support. It was intended to be backported?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: set mips16 support

2016-01-04 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega <crist...@samknows.com>
---
 target/linux/ramips/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
index 9d7bb5b..378e2f5 100644
--- a/target/linux/ramips/Makefile
+++ b/target/linux/ramips/Makefile
@@ -10,7 +10,7 @@ ARCH:=mipsel
 BOARD:=ramips
 BOARDNAME:=Ralink RT288x/RT3xxx
 SUBTARGETS:=rt305x mt7620 mt7621 mt7628 mt7688 rt3883 rt288x
-FEATURES:=squashfs gpio
+FEATURES:=squashfs gpio mips16
 MAINTAINER:=John Crispin <blo...@openwrt.org>
 
 KERNEL_PATCHVER:=4.3
-- 
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: Add dependency on ip (iproute2) to cfg80211

2015-11-17 Thread Cristian Morales Vega
On 16 November 2015 at 23:40, Felix Fietkau  wrote:
> On 2015-11-16 20:28, Ted Hess wrote:
>> Changes to netifd/wireless/mac80211.sh in r46832 invoke 'ip' when making
>> a client association. 'ip' is not automatically included with cfg80211
>> custom builds -- association fails.
>>
>> Signed-off-by: Ted Hess 
> NACK. These changes were added because the busybox ip applet was enabled
> by default recently.

So there is a dependency (ip package OR ip support in Busybox), but no
way to express it?

Not that it would make sense for anybody to disable the new default in
busybox without enabling the ip package at the same time. Just
curious.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/5] target.mk: add optimization flags for MIPS 24Kc.

2015-10-28 Thread Cristian Morales Vega
On 28 October 2015 at 12:55, Yousong Zhou  wrote:
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -212,6 +212,7 @@ ifeq ($(DUMP),1)
>  CPU_CFLAGS_mips32 = -mips32 -mtune=mips32
>  CPU_CFLAGS_mips32r2 = -mips32r2 -mtune=mips32r2
>  CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
> +CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
>  CPU_CFLAGS_24kec = -mips32r2 -mtune=24kec
>  CPU_CFLAGS_34kc = -mips32r2 -mtune=34kc
>  CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc

Nothing against the patch itself. But was wondering, since the builds
are so device specific, what's the point of building for a generic
mips32(r2)?

Isn't just

CPU_CFLAGS_74kc = -march=74kc
(which the gcc manual says implies -mtune=74kc)

going to generate faster code than

CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc

without any drawback?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] getaddrinfo breaks with IPV6 and IPV4

2015-08-06 Thread Cristian Morales Vega
On 6 August 2015 at 10:52, Baptiste Clenet bapcle...@gmail.com wrote:
 Hi,

 I try to use getaddrinfo() function and I send as parameters:

   static char addrstr[256] = ::1;
   struct addrinfo *res, *ainfo;
   struct addrinfo hints;
   memset ((char *)hints, 0, sizeof(hints));
   hints.ai_socktype = SOCK_DGRAM;
   hints.ai_family = AF_UNSPEC;

   int error = getaddrinfo(addrstr, , hints, res);

   if (error != 0) {
 fprintf(stderr, getaddrinfo: %s\n, gai_strerror(error));
 return error;
   }


 And it gives me:
 getaddrinfo: Unrecognized service

 I tried with an IPV4 address, same problem. Do you know which
 implementation of getaddrinfo OpenWRT use?

Why should it recognize the  service? Give it the service you want
to use, or NULL.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Chaos Calmer 15.05-rc3

2015-07-17 Thread Cristian Morales Vega
On 17 July 2015 at 16:43, Jonas Gorski j...@openwrt.org wrote:
 On 17.07.2015 16:16, Karl Palsson wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Jonas Gorski j...@openwrt.org wrote:
 On Thu, Jul 16, 2015 at 7:08 PM, Arturo Rinaldi art...@doghunter.org
 wrote:
 after running the git 'reset' command :

 $ git reset --hard 171f0fd10830acd3259f7c229f1b65b95595f388

 in the trunk directory returns me :

 fatal: Could not parse object '171f0fd10830acd3259f7c229f1b65b95595f388'

 is by any chance the right commit the one updating openssl to v1.0.2.d ?

 AFAICT the build isn't exactly one revision; it's r46163 + r46286 (the
 OpenSSL update to 1.0.2d), but none of the fixes between them.

 the feed revisions are:

 luci cf2e3f6c20dbdfdc3d8c4d4115cf9c533444e61f
 packages 7551321fab9b5676ae7824b18a51d53be2a48cb0
 mangement ab76d576a5cbcb01075757d5d8c6e1d83f1e9ffc
 routing f5eab926d75396d5e95d7b7eebcac34aab30f6f7
 telephony 6375e2a4aaba77aacc9b2cdea18e29fafe4cd2d5


 Could the feeds and the repo maybe get tagged? you can put tag names in
 feeds.conf with url;tag_name that would make some of this a little
 easier?

 You can also define specific commits with url^revision ;)

What I don't understand is why there is so much interest in
replicating RC3. It makes sense to have a RC3 so there are binaries
and more people test it. But if you are going to build it yourself,
shouldn't you just use whatever is the latest commit in
git://git.openwrt.org/15.05/openwrt.git? That already has the tags for
the feeds 
(http://git.openwrt.org/?p=15.05/openwrt.git;a=blob_plain;f=feeds.conf.default;hb=HEAD).

Why to build a RC3 with the bugs that have already been solved and
will not be there in RC4/final?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] ramips and mips16

2015-07-02 Thread Cristian Morales Vega
I don't really know the details of this, but I see that in

target/linux/ramips/patches-3.18/100-mt7621-add-cpu-feature-overrides.patch

there is a #define cpu_has_mips16  1.

but in target/linux/ramips/Makefile

mips16 is not one of the FEATURES.

Should it be added?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Combine CA-certificates in one file

2015-06-12 Thread Cristian Morales Vega
On 12 June 2015 at 08:30,  micke.p...@telldus.se wrote:
 Some packages or libraries cannot use split ca cetificates in a folder. This
 adds a config to combine all certificates into one file.

I have nothing against this patch. But do you have a list of such
packages? I may be interested in patching them.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2] ralink: add support for ap699ge8c2

2015-06-01 Thread Cristian Morales Vega
Actually ignore this patch. After querying a bit more about the device
it seems it's not going to be released to the public in its current
form.

Sorry about the noise.


On 26 May 2015 at 08:45, Cristian Morales Vega crist...@samknows.com wrote:
 I can't find any reference online. It's similar (the case looks the
 same, but white, different uC) to this one:
 http://twsz.com/en/product/109/409.html. TWSZ could obviously use some
 help with the names.

 Not sure about TWSZ plans. We got it directly from them (I wasn't
 involved). But if it's not already, I guess it will appear in the wild
 soon. On the worst case people may be interested if only to convert
 one of our Whiteboxes into a free router ;-) (please, don't).


 On 22 May 2015 at 14:49, John Crispin blo...@openwrt.org wrote:
 Hi,

 what board is this ? the name looks weird.

 John

 On 14/05/2015 15:17, Cristian Morales Vega wrote:
 Signed-off-by: Cristian Morales Vega crist...@samknows.com
 ---
  .../linux/ramips/base-files/etc/board.d/02_network |   5 +
  target/linux/ramips/base-files/lib/ramips.sh   |   3 +
  .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
  target/linux/ramips/dts/AP699GE8C2.dts | 112 
 +
  target/linux/ramips/image/Makefile |   6 +-
  target/linux/ramips/mt7621/profiles/ap699ge8c2.mk  |  18 
  6 files changed, 144 insertions(+), 1 deletion(-)
  create mode 100644 target/linux/ramips/dts/AP699GE8C2.dts
  create mode 100644 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk

 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 24e1ba8..ee6aab0 100755
 --- a/target/linux/ramips/base-files/etc/board.d/02_network
 +++ b/target/linux/ramips/base-files/etc/board.d/02_network
 @@ -116,6 +116,7 @@ ramips_setup_interfaces()
   ;;

   3g-6200n | \
 + ap699ge8c2 | \
   ai-br100 | \
   dir-610-a1 | \
   dir-300-b7 | \
 @@ -268,6 +269,10 @@ ramips_setup_macs()
   local wan_mac=

   case $board in
 + ap699ge8c2)
 + wan_mac=$(mtd_get_mac_binary factory 57350)
 + ;;
 +
   br-6475nd)
   lan_mac=$(cat /sys/class/net/eth0/address)
   wan_mac=$(mtd_get_mac_binary devdata 7)
 diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
 b/target/linux/ramips/base-files/lib/ramips.sh
 index 616f4a1..c1b7898 100755
 --- a/target/linux/ramips/base-files/lib/ramips.sh
 +++ b/target/linux/ramips/base-files/lib/ramips.sh
 @@ -397,6 +397,9 @@ ramips_board_detect() {
   *Mediatek MT7628AN evaluation board)
   name=mt7628
   ;;
 + *TWSZ AP699GE8C2)
 + name=ap699ge8c2
 + ;;
   *)
   name=generic
   ;;
 diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
 b/target/linux/ramips/base-files/lib/upgrade/platform.sh
 index 17b456b..b79cca8 100755
 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
 @@ -25,6 +25,7 @@ platform_check_image() {
   all0256n | \
   all5002 | \
   all5003 | \
 + ap699ge8c2 | \
   ar725w | \
   asl26555 | \
   awapn2403 | \
 diff --git a/target/linux/ramips/dts/AP699GE8C2.dts 
 b/target/linux/ramips/dts/AP699GE8C2.dts
 new file mode 100644
 index 000..7157962
 --- /dev/null
 +++ b/target/linux/ramips/dts/AP699GE8C2.dts
 @@ -0,0 +1,112 @@
 +/dts-v1/;
 +
 +/include/ mt7621.dtsi
 +
 +/ {
 + compatible = mediatek,mt7621-eval-board, mediatek,mt7621-soc;
 + model = TWSZ AP699GE8C2;
 +
 + memory@0 {
 + device_type = memory;
 + reg = 0x0 0x400;
 + };
 +
 + chosen {
 + bootargs = console=ttyS0,57600;
 + };
 +
 + palmbus@1E00 {
 + spi@b00 {
 + status = okay;
 +
 + m25p80@0 {
 + #address-cells = 1;
 + #size-cells = 1;
 + compatible = mx25l6405d;
 + reg = 0 0;
 + linux,modalias = m25p80;
 + spi-max-frequency = 1000;
 +
 + partition@0 {
 + label = u-boot;
 + reg = 0x0 0x3;
 + read-only;
 + };
 +
 + partition@3 {
 + label = u-boot-env;
 + reg = 0x3 0x1;
 + read-only;
 + };
 +
 + factory: partition@4 {
 + label = factory;
 + reg = 0x4 0x1

[OpenWrt-Devel] [PATCHv2] ralink: add support for mt7621 switch counters

2015-05-27 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 .../files/drivers/net/ethernet/ralink/mt7530.c | 194 -
 1 file changed, 191 insertions(+), 3 deletions(-)

diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c 
b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
index 1352b25..b4b74d4 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
@@ -63,6 +63,107 @@ enum {
 
 #define REG_HWTRAP 0x7804
 
+#define MIB_DESC(_s , _o, _n)   \
+   {   \
+   .size = (_s),   \
+   .offset = (_o), \
+   .name = (_n),   \
+   }
+
+struct mt7xxx_mib_desc {
+   unsigned int size;
+   unsigned int offset;
+   const char *name;
+};
+
+#define MT7621_MIB_COUNTER_BASE0x4000
+#define MT7621_MIB_COUNTER_PORT_OFFSET 0x100
+#define MT7621_STATS_TDPC  0x00
+#define MT7621_STATS_TCRC  0x04
+#define MT7621_STATS_TUPC  0x08
+#define MT7621_STATS_TMPC  0x0C
+#define MT7621_STATS_TBPC  0x10
+#define MT7621_STATS_TCEC  0x14
+#define MT7621_STATS_TSCEC 0x18
+#define MT7621_STATS_TMCEC 0x1C
+#define MT7621_STATS_TDEC  0x20
+#define MT7621_STATS_TLCEC 0x24
+#define MT7621_STATS_TXCEC 0x28
+#define MT7621_STATS_TPPC  0x2C
+#define MT7621_STATS_TL64PC0x30
+#define MT7621_STATS_TL65PC0x34
+#define MT7621_STATS_TL128PC   0x38
+#define MT7621_STATS_TL256PC   0x3C
+#define MT7621_STATS_TL512PC   0x40
+#define MT7621_STATS_TL1024PC  0x44
+#define MT7621_STATS_TOC   0x48
+#define MT7621_STATS_RDPC  0x60
+#define MT7621_STATS_RFPC  0x64
+#define MT7621_STATS_RUPC  0x68
+#define MT7621_STATS_RMPC  0x6C
+#define MT7621_STATS_RBPC  0x70
+#define MT7621_STATS_RAEPC 0x74
+#define MT7621_STATS_RCEPC 0x78
+#define MT7621_STATS_RUSPC 0x7C
+#define MT7621_STATS_RFEPC 0x80
+#define MT7621_STATS_ROSPC 0x84
+#define MT7621_STATS_RJEPC 0x88
+#define MT7621_STATS_RPPC  0x8C
+#define MT7621_STATS_RL64PC0x90
+#define MT7621_STATS_RL65PC0x94
+#define MT7621_STATS_RL128PC   0x98
+#define MT7621_STATS_RL256PC   0x9C
+#define MT7621_STATS_RL512PC   0xA0
+#define MT7621_STATS_RL1024PC  0xA4
+#define MT7621_STATS_ROC   0xA8
+#define MT7621_STATS_RDPC_CTRL 0xB0
+#define MT7621_STATS_RDPC_ING  0xB4
+#define MT7621_STATS_RDPC_ARL  0xB8
+
+static const struct mt7xxx_mib_desc mt7621_mibs[] = {
+   MIB_DESC(1, MT7621_STATS_TDPC, TxDrop),
+   MIB_DESC(1, MT7621_STATS_TCRC, TxCRC),
+   MIB_DESC(1, MT7621_STATS_TUPC, TxUni),
+   MIB_DESC(1, MT7621_STATS_TMPC, TxMulti),
+   MIB_DESC(1, MT7621_STATS_TBPC, TxBroad),
+   MIB_DESC(1, MT7621_STATS_TCEC, TxCollision),
+   MIB_DESC(1, MT7621_STATS_TSCEC, TxSingleCol),
+   MIB_DESC(1, MT7621_STATS_TMCEC, TxMultiCol),
+   MIB_DESC(1, MT7621_STATS_TDEC, TxDefer),
+   MIB_DESC(1, MT7621_STATS_TLCEC, TxLateCol),
+   MIB_DESC(1, MT7621_STATS_TXCEC, TxExcCol),
+   MIB_DESC(1, MT7621_STATS_TPPC, TxPause),
+   MIB_DESC(1, MT7621_STATS_TL64PC, Tx64Byte),
+   MIB_DESC(1, MT7621_STATS_TL65PC, Tx65Byte),
+   MIB_DESC(1, MT7621_STATS_TL128PC, Tx128Byte),
+   MIB_DESC(1, MT7621_STATS_TL256PC, Tx256Byte),
+   MIB_DESC(1, MT7621_STATS_TL512PC, Tx512Byte),
+   MIB_DESC(1, MT7621_STATS_TL1024PC, Tx1024Byte),
+   MIB_DESC(2, MT7621_STATS_TOC, TxByte),
+   MIB_DESC(1, MT7621_STATS_RDPC, RxDrop),
+   MIB_DESC(1, MT7621_STATS_RFPC, RxFiltered),
+   MIB_DESC(1, MT7621_STATS_RUPC, RxUni),
+   MIB_DESC(1, MT7621_STATS_RMPC, RxMulti),
+   MIB_DESC(1, MT7621_STATS_RBPC, RxBroad),
+   MIB_DESC(1, MT7621_STATS_RAEPC, RxAlignErr),
+   MIB_DESC(1, MT7621_STATS_RCEPC, RxCRC),
+   MIB_DESC(1, MT7621_STATS_RUSPC, RxUnderSize),
+   MIB_DESC(1, MT7621_STATS_RFEPC, RxFragment),
+   MIB_DESC(1, MT7621_STATS_ROSPC, RxOverSize),
+   MIB_DESC(1, MT7621_STATS_RJEPC, RxJabber),
+   MIB_DESC(1, MT7621_STATS_RPPC, RxPause),
+   MIB_DESC(1, MT7621_STATS_RL64PC, Rx64Byte),
+   MIB_DESC(1, MT7621_STATS_RL65PC, Rx65Byte),
+   MIB_DESC(1, MT7621_STATS_RL128PC, Rx128Byte),
+   MIB_DESC(1, MT7621_STATS_RL256PC, Rx256Byte),
+   MIB_DESC(1, MT7621_STATS_RL512PC, Rx512Byte),
+   MIB_DESC(1, MT7621_STATS_RL1024PC, Rx1024Byte),
+   MIB_DESC(2, MT7621_STATS_ROC, RxByte),
+   MIB_DESC(1, MT7621_STATS_RDPC_CTRL, RxCtrlDrop),
+   MIB_DESC(1, MT7621_STATS_RDPC_ING, RxIngDrop),
+   MIB_DESC(1, MT7621_STATS_RDPC_ARL, RxARLDrop)
+};
+
 enum {
/* Global attributes. */
MT7530_ATTR_ENABLE_VLAN,
@@ -500,6 +601,63 @@ static const struct switch_attr mt7530_global[] = {
},
 };
 
+static u64 get_mib_counter(struct mt7530_priv *priv, int i, int port)
+{
+   unsigned int port_base;
+   u64 t;
+
+   port_base = MT7621_MIB_COUNTER_BASE

Re: [OpenWrt-Devel] [PATCHv2] ralink: add support for ap699ge8c2

2015-05-26 Thread Cristian Morales Vega
I can't find any reference online. It's similar (the case looks the
same, but white, different uC) to this one:
http://twsz.com/en/product/109/409.html. TWSZ could obviously use some
help with the names.

Not sure about TWSZ plans. We got it directly from them (I wasn't
involved). But if it's not already, I guess it will appear in the wild
soon. On the worst case people may be interested if only to convert
one of our Whiteboxes into a free router ;-) (please, don't).


On 22 May 2015 at 14:49, John Crispin blo...@openwrt.org wrote:
 Hi,

 what board is this ? the name looks weird.

 John

 On 14/05/2015 15:17, Cristian Morales Vega wrote:
 Signed-off-by: Cristian Morales Vega crist...@samknows.com
 ---
  .../linux/ramips/base-files/etc/board.d/02_network |   5 +
  target/linux/ramips/base-files/lib/ramips.sh   |   3 +
  .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
  target/linux/ramips/dts/AP699GE8C2.dts | 112 
 +
  target/linux/ramips/image/Makefile |   6 +-
  target/linux/ramips/mt7621/profiles/ap699ge8c2.mk  |  18 
  6 files changed, 144 insertions(+), 1 deletion(-)
  create mode 100644 target/linux/ramips/dts/AP699GE8C2.dts
  create mode 100644 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk

 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 24e1ba8..ee6aab0 100755
 --- a/target/linux/ramips/base-files/etc/board.d/02_network
 +++ b/target/linux/ramips/base-files/etc/board.d/02_network
 @@ -116,6 +116,7 @@ ramips_setup_interfaces()
   ;;

   3g-6200n | \
 + ap699ge8c2 | \
   ai-br100 | \
   dir-610-a1 | \
   dir-300-b7 | \
 @@ -268,6 +269,10 @@ ramips_setup_macs()
   local wan_mac=

   case $board in
 + ap699ge8c2)
 + wan_mac=$(mtd_get_mac_binary factory 57350)
 + ;;
 +
   br-6475nd)
   lan_mac=$(cat /sys/class/net/eth0/address)
   wan_mac=$(mtd_get_mac_binary devdata 7)
 diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
 b/target/linux/ramips/base-files/lib/ramips.sh
 index 616f4a1..c1b7898 100755
 --- a/target/linux/ramips/base-files/lib/ramips.sh
 +++ b/target/linux/ramips/base-files/lib/ramips.sh
 @@ -397,6 +397,9 @@ ramips_board_detect() {
   *Mediatek MT7628AN evaluation board)
   name=mt7628
   ;;
 + *TWSZ AP699GE8C2)
 + name=ap699ge8c2
 + ;;
   *)
   name=generic
   ;;
 diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
 b/target/linux/ramips/base-files/lib/upgrade/platform.sh
 index 17b456b..b79cca8 100755
 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
 +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
 @@ -25,6 +25,7 @@ platform_check_image() {
   all0256n | \
   all5002 | \
   all5003 | \
 + ap699ge8c2 | \
   ar725w | \
   asl26555 | \
   awapn2403 | \
 diff --git a/target/linux/ramips/dts/AP699GE8C2.dts 
 b/target/linux/ramips/dts/AP699GE8C2.dts
 new file mode 100644
 index 000..7157962
 --- /dev/null
 +++ b/target/linux/ramips/dts/AP699GE8C2.dts
 @@ -0,0 +1,112 @@
 +/dts-v1/;
 +
 +/include/ mt7621.dtsi
 +
 +/ {
 + compatible = mediatek,mt7621-eval-board, mediatek,mt7621-soc;
 + model = TWSZ AP699GE8C2;
 +
 + memory@0 {
 + device_type = memory;
 + reg = 0x0 0x400;
 + };
 +
 + chosen {
 + bootargs = console=ttyS0,57600;
 + };
 +
 + palmbus@1E00 {
 + spi@b00 {
 + status = okay;
 +
 + m25p80@0 {
 + #address-cells = 1;
 + #size-cells = 1;
 + compatible = mx25l6405d;
 + reg = 0 0;
 + linux,modalias = m25p80;
 + spi-max-frequency = 1000;
 +
 + partition@0 {
 + label = u-boot;
 + reg = 0x0 0x3;
 + read-only;
 + };
 +
 + partition@3 {
 + label = u-boot-env;
 + reg = 0x3 0x1;
 + read-only;
 + };
 +
 + factory: partition@4 {
 + label = factory;
 + reg = 0x4 0x1;
 + read-only;
 + };
 +
 + partition@5 {
 + label = firmware;
 + reg = 0x5 0x7b

Re: [OpenWrt-Devel] [PATCH] ralink: add support for mt7621 switch counters

2015-05-26 Thread Cristian Morales Vega
I don't really have any experience with kernel development. But
shouldn't IS_ENABLED(CONFIG_SOC_MT7621) be used only for
*additional* stuff? I mean, the driver built with CONFIG_SOC_MT7621
shouldn't continue working with a MT7620? (as stupid as that situation
would be).
From a quick look into the MT7620 datasheet (I don't have one to test)
at the very least it has the counters mapped to different addresses,
so it would break.

Anyway, I will submit a new patch later.


On 22 May 2015 at 15:02, John Crispin blo...@openwrt.org wrote:
 Hi,

 instead of adding an extra parameter to mt7530_probe() use this macro
 instead - IS_ENABLED(CONFIG_SOC_MT7621)

 John

 On 14/05/2015 17:14, Cristian Morales Vega wrote:
 Signed-off-by: Cristian Morales Vega crist...@samknows.com
 ---
  .../drivers/net/ethernet/ralink/gsw_mt7620a.c  |   8 +-
  .../files/drivers/net/ethernet/ralink/mt7530.c | 197 
 -
  .../files/drivers/net/ethernet/ralink/mt7530.h |   3 +-
  3 files changed, 199 insertions(+), 9 deletions(-)

 diff --git 
 a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c 
 b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
 index 8039704..257a9c5 100644
 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
 +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
 @@ -728,10 +728,10 @@ int mt7620_gsw_config(struct fe_priv *priv)

   /* is the mt7530 internal or external */
   if (priv-mii_bus  priv-mii_bus-phy_map[0x1f]) {
 - mt7530_probe(priv-device, gsw-base, NULL, 0);
 - mt7530_probe(priv-device, NULL, priv-mii_bus, 1);
 + mt7530_probe(priv-device, gsw-base, NULL, 0, 0);
 + mt7530_probe(priv-device, NULL, priv-mii_bus, 1, 0);
   } else {
 - mt7530_probe(priv-device, gsw-base, NULL, 1);
 + mt7530_probe(priv-device, gsw-base, NULL, 1, 0);
   }

   return 0;
 @@ -740,7 +740,7 @@ int mt7620_gsw_config(struct fe_priv *priv)
  int mt7621_gsw_config(struct fe_priv *priv)
  {
   if (priv-mii_bus  priv-mii_bus-phy_map[0x1f])
 - mt7530_probe(priv-device, NULL, priv-mii_bus, 1);
 + mt7530_probe(priv-device, NULL, priv-mii_bus, 1, 1);

   return 0;
  }
 diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c 
 b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
 index 1352b25..cacf19e 100644
 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
 +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
 @@ -63,6 +63,107 @@ enum {

  #define REG_HWTRAP   0x7804

 +#define MIB_DESC(_s , _o, _n)   \
 + {   \
 + .size = (_s),   \
 + .offset = (_o), \
 + .name = (_n),   \
 + }
 +
 +struct mt7xxx_mib_desc {
 + unsigned int size;
 + unsigned int offset;
 + const char *name;
 +};
 +
 +#define MT7621_MIB_COUNTER_BASE  0x4000
 +#define MT7621_MIB_COUNTER_PORT_OFFSET   0x100
 +#define MT7621_STATS_TDPC0x00
 +#define MT7621_STATS_TCRC0x04
 +#define MT7621_STATS_TUPC0x08
 +#define MT7621_STATS_TMPC0x0C
 +#define MT7621_STATS_TBPC0x10
 +#define MT7621_STATS_TCEC0x14
 +#define MT7621_STATS_TSCEC   0x18
 +#define MT7621_STATS_TMCEC   0x1C
 +#define MT7621_STATS_TDEC0x20
 +#define MT7621_STATS_TLCEC   0x24
 +#define MT7621_STATS_TXCEC   0x28
 +#define MT7621_STATS_TPPC0x2C
 +#define MT7621_STATS_TL64PC  0x30
 +#define MT7621_STATS_TL65PC  0x34
 +#define MT7621_STATS_TL128PC 0x38
 +#define MT7621_STATS_TL256PC 0x3C
 +#define MT7621_STATS_TL512PC 0x40
 +#define MT7621_STATS_TL1024PC0x44
 +#define MT7621_STATS_TOC 0x48
 +#define MT7621_STATS_RDPC0x60
 +#define MT7621_STATS_RFPC0x64
 +#define MT7621_STATS_RUPC0x68
 +#define MT7621_STATS_RMPC0x6C
 +#define MT7621_STATS_RBPC0x70
 +#define MT7621_STATS_RAEPC   0x74
 +#define MT7621_STATS_RCEPC   0x78
 +#define MT7621_STATS_RUSPC   0x7C
 +#define MT7621_STATS_RFEPC   0x80
 +#define MT7621_STATS_ROSPC   0x84
 +#define MT7621_STATS_RJEPC   0x88
 +#define MT7621_STATS_RPPC0x8C
 +#define MT7621_STATS_RL64PC  0x90
 +#define MT7621_STATS_RL65PC  0x94
 +#define MT7621_STATS_RL128PC 0x98
 +#define MT7621_STATS_RL256PC 0x9C
 +#define MT7621_STATS_RL512PC 0xA0
 +#define MT7621_STATS_RL1024PC0xA4
 +#define MT7621_STATS_ROC 0xA8
 +#define MT7621_STATS_RDPC_CTRL   0xB0
 +#define MT7621_STATS_RDPC_ING0xB4
 +#define MT7621_STATS_RDPC_ARL0xB8
 +
 +static const struct mt7xxx_mib_desc mt7621_mibs[] = {
 + MIB_DESC(1, MT7621_STATS_TDPC, TxDrop),
 + MIB_DESC(1, MT7621_STATS_TCRC, TxCRC),
 + MIB_DESC(1, MT7621_STATS_TUPC, TxUni),
 + MIB_DESC(1, MT7621_STATS_TMPC, TxMulti),
 + MIB_DESC(1, MT7621_STATS_TBPC, TxBroad),
 + MIB_DESC(1, MT7621_STATS_TCEC, TxCollision),
 + MIB_DESC(1, MT7621_STATS_TSCEC, TxSingleCol

[OpenWrt-Devel] [PATCH] ramips: check size after padding

2015-05-20 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 target/linux/ramips/image/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index e6b5112..13f7c66 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -35,7 +35,7 @@ define Device/Default
   KERNEL := $(KERNEL_DTB) | uImage lzma
   IMAGES := sysupgrade.bin
   IMAGE_SIZE := $(ralink_default_fw_size_8M)
-  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | check-size 
(IMAGE_SIZE) | pad-rootfs
+  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | 
check-size (IMAGE_SIZE)
 endef
 
 define Build/patch-dtb
-- 
2.1.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Managed WiFi and IPv4/IPv6

2015-05-18 Thread Cristian Morales Vega
On 15 May 2015 at 20:25, Felix Fietkau n...@openwrt.org wrote:
 On 2015-05-15 17:28, Cristian Morales Vega wrote:
 Since a wifi-iface can only have one network, how are you supposed
 to link it to both the wan and wan6 interfaces?
 It can have multiple networks. Use 'list' instead of 'option'.

And it's actually documented in the wiki, my bad.
Thanks.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Managed WiFi and IPv4/IPv6

2015-05-15 Thread Cristian Morales Vega
Since a wifi-iface can only have one network, how are you supposed
to link it to both the wan and wan6 interfaces?

The closest I have achieved is creating 2 wifi-iface for 1
wifi-device. Both udhcpc and odhcp6c start, but I get 2 wpa_supplicant
processes.


-- 
Cristian Morales Vega

Email crist...@samknows.com
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] ralink: add support for ap699ge8c2

2015-05-14 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 .../linux/ramips/base-files/etc/board.d/02_network |   5 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/AP699GE8C2.dts | 112 +
 target/linux/ramips/image/Makefile |   6 +-
 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk  |  18 
 6 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ramips/dts/AP699GE8C2.dts
 create mode 100644 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk

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 24e1ba8..ee6aab0 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -116,6 +116,7 @@ ramips_setup_interfaces()
;;
 
3g-6200n | \
+   ap699ge8c2 | \
ai-br100 | \
dir-610-a1 | \
dir-300-b7 | \
@@ -268,6 +269,10 @@ ramips_setup_macs()
local wan_mac=
 
case $board in
+   ap699ge8c2)
+   wan_mac=$(mtd_get_mac_binary factory 57350)
+   ;;
+
br-6475nd)
lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(mtd_get_mac_binary devdata 7)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 616f4a1..c1b7898 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -397,6 +397,9 @@ ramips_board_detect() {
*Mediatek MT7628AN evaluation board)
name=mt7628
;;
+   *TWSZ AP699GE8C2)
+   name=ap699ge8c2
+   ;;
*)
name=generic
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 17b456b..b79cca8 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -25,6 +25,7 @@ platform_check_image() {
all0256n | \
all5002 | \
all5003 | \
+   ap699ge8c2 | \
ar725w | \
asl26555 | \
awapn2403 | \
diff --git a/target/linux/ramips/dts/AP699GE8C2.dts 
b/target/linux/ramips/dts/AP699GE8C2.dts
new file mode 100644
index 000..7157962
--- /dev/null
+++ b/target/linux/ramips/dts/AP699GE8C2.dts
@@ -0,0 +1,112 @@
+/dts-v1/;
+
+/include/ mt7621.dtsi
+
+/ {
+   compatible = mediatek,mt7621-eval-board, mediatek,mt7621-soc;
+   model = TWSZ AP699GE8C2;
+
+   memory@0 {
+   device_type = memory;
+   reg = 0x0 0x400;
+   };
+
+   chosen {
+   bootargs = console=ttyS0,57600;
+   };
+
+   palmbus@1E00 {
+   spi@b00 {
+   status = okay;
+
+   m25p80@0 {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = mx25l6405d;
+   reg = 0 0;
+   linux,modalias = m25p80;
+   spi-max-frequency = 1000;
+
+   partition@0 {
+   label = u-boot;
+   reg = 0x0 0x3;
+   read-only;
+   };
+
+   partition@3 {
+   label = u-boot-env;
+   reg = 0x3 0x1;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = factory;
+   reg = 0x4 0x1;
+   read-only;
+   };
+
+   partition@5 {
+   label = firmware;
+   reg = 0x5 0x7b;
+   };
+
+   };
+   };
+   };
+
+   pcie@1e14 {
+   status = okay;
+
+   pcie0 {
+   mt76@0,0 {
+   reg = 0x 0 0 0 0;
+   device_type = pci;
+   mediatek,mtd-eeprom = factory 0x8000;
+   mediatek,2ghz = 0;
+   };
+   };
+
+   pcie1 {
+   mt76@1,0 {
+   reg = 0x 0 0 0 0;
+   device_type = pci

[OpenWrt-Devel] [PATCH] ralink: add support for mt7621 switch counters

2015-05-14 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 .../drivers/net/ethernet/ralink/gsw_mt7620a.c  |   8 +-
 .../files/drivers/net/ethernet/ralink/mt7530.c | 197 -
 .../files/drivers/net/ethernet/ralink/mt7530.h |   3 +-
 3 files changed, 199 insertions(+), 9 deletions(-)

diff --git 
a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c 
b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
index 8039704..257a9c5 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
@@ -728,10 +728,10 @@ int mt7620_gsw_config(struct fe_priv *priv)
 
/* is the mt7530 internal or external */
if (priv-mii_bus  priv-mii_bus-phy_map[0x1f]) {
-   mt7530_probe(priv-device, gsw-base, NULL, 0);
-   mt7530_probe(priv-device, NULL, priv-mii_bus, 1);
+   mt7530_probe(priv-device, gsw-base, NULL, 0, 0);
+   mt7530_probe(priv-device, NULL, priv-mii_bus, 1, 0);
} else {
-   mt7530_probe(priv-device, gsw-base, NULL, 1);
+   mt7530_probe(priv-device, gsw-base, NULL, 1, 0);
}
 
return 0;
@@ -740,7 +740,7 @@ int mt7620_gsw_config(struct fe_priv *priv)
 int mt7621_gsw_config(struct fe_priv *priv)
 {
if (priv-mii_bus  priv-mii_bus-phy_map[0x1f])
-   mt7530_probe(priv-device, NULL, priv-mii_bus, 1);
+   mt7530_probe(priv-device, NULL, priv-mii_bus, 1, 1);
 
return 0;
 }
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c 
b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
index 1352b25..cacf19e 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
@@ -63,6 +63,107 @@ enum {
 
 #define REG_HWTRAP 0x7804
 
+#define MIB_DESC(_s , _o, _n)   \
+   {   \
+   .size = (_s),   \
+   .offset = (_o), \
+   .name = (_n),   \
+   }
+
+struct mt7xxx_mib_desc {
+   unsigned int size;
+   unsigned int offset;
+   const char *name;
+};
+
+#define MT7621_MIB_COUNTER_BASE0x4000
+#define MT7621_MIB_COUNTER_PORT_OFFSET 0x100
+#define MT7621_STATS_TDPC  0x00
+#define MT7621_STATS_TCRC  0x04
+#define MT7621_STATS_TUPC  0x08
+#define MT7621_STATS_TMPC  0x0C
+#define MT7621_STATS_TBPC  0x10
+#define MT7621_STATS_TCEC  0x14
+#define MT7621_STATS_TSCEC 0x18
+#define MT7621_STATS_TMCEC 0x1C
+#define MT7621_STATS_TDEC  0x20
+#define MT7621_STATS_TLCEC 0x24
+#define MT7621_STATS_TXCEC 0x28
+#define MT7621_STATS_TPPC  0x2C
+#define MT7621_STATS_TL64PC0x30
+#define MT7621_STATS_TL65PC0x34
+#define MT7621_STATS_TL128PC   0x38
+#define MT7621_STATS_TL256PC   0x3C
+#define MT7621_STATS_TL512PC   0x40
+#define MT7621_STATS_TL1024PC  0x44
+#define MT7621_STATS_TOC   0x48
+#define MT7621_STATS_RDPC  0x60
+#define MT7621_STATS_RFPC  0x64
+#define MT7621_STATS_RUPC  0x68
+#define MT7621_STATS_RMPC  0x6C
+#define MT7621_STATS_RBPC  0x70
+#define MT7621_STATS_RAEPC 0x74
+#define MT7621_STATS_RCEPC 0x78
+#define MT7621_STATS_RUSPC 0x7C
+#define MT7621_STATS_RFEPC 0x80
+#define MT7621_STATS_ROSPC 0x84
+#define MT7621_STATS_RJEPC 0x88
+#define MT7621_STATS_RPPC  0x8C
+#define MT7621_STATS_RL64PC0x90
+#define MT7621_STATS_RL65PC0x94
+#define MT7621_STATS_RL128PC   0x98
+#define MT7621_STATS_RL256PC   0x9C
+#define MT7621_STATS_RL512PC   0xA0
+#define MT7621_STATS_RL1024PC  0xA4
+#define MT7621_STATS_ROC   0xA8
+#define MT7621_STATS_RDPC_CTRL 0xB0
+#define MT7621_STATS_RDPC_ING  0xB4
+#define MT7621_STATS_RDPC_ARL  0xB8
+
+static const struct mt7xxx_mib_desc mt7621_mibs[] = {
+   MIB_DESC(1, MT7621_STATS_TDPC, TxDrop),
+   MIB_DESC(1, MT7621_STATS_TCRC, TxCRC),
+   MIB_DESC(1, MT7621_STATS_TUPC, TxUni),
+   MIB_DESC(1, MT7621_STATS_TMPC, TxMulti),
+   MIB_DESC(1, MT7621_STATS_TBPC, TxBroad),
+   MIB_DESC(1, MT7621_STATS_TCEC, TxCollision),
+   MIB_DESC(1, MT7621_STATS_TSCEC, TxSingleCol),
+   MIB_DESC(1, MT7621_STATS_TMCEC, TxMultiCol),
+   MIB_DESC(1, MT7621_STATS_TDEC, TxDefer),
+   MIB_DESC(1, MT7621_STATS_TLCEC, TxLateCol),
+   MIB_DESC(1, MT7621_STATS_TXCEC, TxExcCol),
+   MIB_DESC(1, MT7621_STATS_TPPC, TxPause),
+   MIB_DESC(1, MT7621_STATS_TL64PC, Tx64Byte),
+   MIB_DESC(1, MT7621_STATS_TL65PC, Tx65Byte),
+   MIB_DESC(1, MT7621_STATS_TL128PC, Tx128Byte),
+   MIB_DESC(1, MT7621_STATS_TL256PC, Tx256Byte),
+   MIB_DESC(1, MT7621_STATS_TL512PC, Tx512Byte),
+   MIB_DESC(1, MT7621_STATS_TL1024PC, Tx1024Byte),
+   MIB_DESC(2, MT7621_STATS_TOC, TxByte),
+   MIB_DESC(1, MT7621_STATS_RDPC, RxDrop),
+   MIB_DESC(1, MT7621_STATS_RFPC, RxFiltered

[OpenWrt-Devel] [PATCH] ralink: add support for ap699ge8c2

2015-05-13 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 .../linux/ramips/base-files/etc/board.d/02_network |   5 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/AP699GE8C2.dts | 112 +
 target/linux/ramips/image/Makefile |   6 +-
 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk  |  18 
 6 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ramips/dts/AP699GE8C2.dts
 create mode 100644 target/linux/ramips/mt7621/profiles/ap699ge8c2.mk

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 24e1ba8..ee6aab0 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -116,6 +116,7 @@ ramips_setup_interfaces()
;;
 
3g-6200n | \
+   ap699ge8c2 | \
ai-br100 | \
dir-610-a1 | \
dir-300-b7 | \
@@ -268,6 +269,10 @@ ramips_setup_macs()
local wan_mac=
 
case $board in
+   ap699ge8c2)
+   wan_mac=$(mtd_get_mac_binary factory 57350)
+   ;;
+
br-6475nd)
lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(mtd_get_mac_binary devdata 7)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 616f4a1..c1b7898 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -397,6 +397,9 @@ ramips_board_detect() {
*Mediatek MT7628AN evaluation board)
name=mt7628
;;
+   *TWSZ AP699GE8C2)
+   name=ap699ge8c2
+   ;;
*)
name=generic
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 17b456b..b79cca8 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -25,6 +25,7 @@ platform_check_image() {
all0256n | \
all5002 | \
all5003 | \
+   ap699ge8c2 | \
ar725w | \
asl26555 | \
awapn2403 | \
diff --git a/target/linux/ramips/dts/AP699GE8C2.dts 
b/target/linux/ramips/dts/AP699GE8C2.dts
new file mode 100644
index 000..c7266bb
--- /dev/null
+++ b/target/linux/ramips/dts/AP699GE8C2.dts
@@ -0,0 +1,112 @@
+/dts-v1/;
+
+/include/ mt7621.dtsi
+
+/ {
+   compatible = mediatek,mt7621-eval-board, mediatek,mt7621-soc;
+   model = TWSZ AP699GE8C2;
+
+   memory@0 {
+   device_type = memory;
+   reg = 0x0 0x400;
+   };
+
+   chosen {
+   bootargs = console=ttyS0,57600;
+   };
+
+   palmbus@1E00 {
+   spi@b00 {
+   status = okay;
+
+   m25p80@0 {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = mx25l6405d;
+   reg = 0 0;
+   linux,modalias = m25p80;
+   spi-max-frequency = 1000;
+
+   partition@0 {
+   label = u-boot;
+   reg = 0x0 0x3;
+   read-only;
+   };
+
+   partition@3 {
+   label = u-boot-env;
+   reg = 0x3 0x1;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = factory;
+   reg = 0x4 0x1;
+   read-only;
+   };
+
+   partition@5 {
+   label = firmware;
+   reg = 0x5 0x7b;
+   };
+
+   };
+   };
+   };
+
+   pcie@1e14 {
+   status = okay;
+
+   pcie0 {
+   mt76@0,0 {
+   reg = 0x 0 0 0 0;
+   device_type = pci;
+   mediatek,mtd-eeprom = factory 0x8000;
+   mediatek,2ghz = 0;
+   };
+   };
+
+   pcie1 {
+   mt76@1,0 {
+   reg = 0x 0 0 0 0;
+   device_type = pci

Re: [OpenWrt-Devel] [PATCH] ar8216: Use IGMP Join and Fast Leave functions

2014-12-15 Thread Cristian Morales Vega
On 12 December 2014 at 16:16, Felix Fietkau n...@openwrt.org wrote:

 On 2014-12-05 15:36, Cristian Morales Vega wrote:
  Avoids flooding the network with multicast data.
 
  Signed-off-by: Cristian Morales Vega crist...@samknows.com
  ---
  Since I guess not all the switches support this... Good idea? Is some
 OpenWRT
  package expecting to receive the multicast packages?
  At the very least you lose the capacity of using iptables to play with
 the packets.
 I think this needs to be optional (and preferably disabled by default
 initially, until it has received more testing).


Sure. I will send another patch.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar8216: Use IGMP Join and Fast Leave functions

2014-12-05 Thread Cristian Morales Vega
Avoids flooding the network with multicast data.

Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
Since I guess not all the switches support this... Good idea? Is some OpenWRT
package expecting to receive the multicast packages?
At the very least you lose the capacity of using iptables to play with the 
packets.

 target/linux/generic/files/drivers/net/phy/ar8216.c | 13 -
 target/linux/generic/files/drivers/net/phy/ar8216.h | 11 +++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c 
b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 558b9f7..6583d8d 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -1690,7 +1690,6 @@ ar8327_init_globals(struct ar8xxx_priv *priv)
 
/* forward multicast and broadcast frames to CPU */
t = (AR8327_PORTS_ALL  AR8327_FWD_CTRL1_UC_FLOOD_S) |
-   (AR8327_PORTS_ALL  AR8327_FWD_CTRL1_MC_FLOOD_S) |
(AR8327_PORTS_ALL  AR8327_FWD_CTRL1_BC_FLOOD_S);
priv-write(priv, AR8327_REG_FWD_CTRL1, t);
 
@@ -1710,6 +1709,18 @@ ar8327_init_globals(struct ar8xxx_priv *priv)
 AR8327_EEE_CTRL_DISABLE_PHY(3) |
 AR8327_EEE_CTRL_DISABLE_PHY(4);
priv-write(priv, AR8327_REG_EEE_CTRL, t);
+
+   /* Enable IGMP Join/Leave */
+   t = AR8327_IGMP_JOIN_LEAVE0 |
+   AR8327_IGMP_JOIN_LEAVE1 |
+   AR8327_IGMP_JOIN_LEAVE2 |
+   AR8327_IGMP_JOIN_LEAVE3;
+   priv-write(priv, AR8327_REG_FRAM_ACK_CTRL0, t);
+   t = AR8327_IGMP_JOIN_LEAVE4 |
+   AR8327_IGMP_JOIN_LEAVE5 |
+   AR8327_IGMP_JOIN_LEAVE6;
+   t |= AR8327_IGMP_V3; /* Look _also_ for IGMPv3 */
+   priv-write(priv, AR8327_REG_FRAM_ACK_CTRL1, t);
 }
 
 static void
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.h 
b/target/linux/generic/files/drivers/net/phy/ar8216.h
index f6df7c8..871134d 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.h
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.h
@@ -364,6 +364,17 @@
 #define AR8327_REG_EEE_CTRL0x100
 #define   AR8327_EEE_CTRL_DISABLE_PHY(_i)  BIT(4 + (_i) * 2)
 
+#define AR8327_REG_FRAM_ACK_CTRL0  0x210
+#define   AR8327_IGMP_JOIN_LEAVE0  BITS(1, 2)
+#define   AR8327_IGMP_JOIN_LEAVE1  BITS(9, 2)
+#define   AR8327_IGMP_JOIN_LEAVE2  BITS(17, 2)
+#define   AR8327_IGMP_JOIN_LEAVE3  BITS(25, 2)
+#define AR8327_REG_FRAM_ACK_CTRL1  0x214
+#define   AR8327_IGMP_JOIN_LEAVE4  BITS(1, 2)
+#define   AR8327_IGMP_JOIN_LEAVE5  BITS(9, 2)
+#define   AR8327_IGMP_JOIN_LEAVE6  BITS(17, 2)
+#define   AR8327_IGMP_V3   BIT(24)
+
 #define AR8327_REG_PORT_VLAN0(_i)  (0x420 + (_i) * 0x8)
 #define   AR8327_PORT_VLAN0_DEF_SVID   BITS(0, 12)
 #define   AR8327_PORT_VLAN0_DEF_SVID_S 0
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Offsets in TP-Link squashfs firmware images

2014-11-21 Thread Cristian Morales Vega
Most TP-Link squashfs images are created using mktplinkfw -a 0x4

The Rootfs data offset in the header of those images is 0x0010. But
the rootfs actually starts at Kernel data offset + Kernel data length.
As a result when extracting the rootfs with mktplinkfw -x -i the result
is broken.

Bug or feature? Maybe the firmware header is checked by something that
expects the Rootfs data offset value to be wrong? If so, could the real
offset be stored somewhere else so mktplinkfw -x -i can do its work?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] ca-certificates in Barrier Breaker

2014-10-20 Thread Cristian Morales Vega
ca-certificates in Barrier Breaker fails to build because it wants to
download the tarball for version 20140325 from a Debian FTP which
doesn't contain it anymore.

What's the right fix? To update the package (it's going to need
updating continuously), or mirror the file in OpenWRT? If it's the
latter, who I have to ask to get the file mirrored (supposing I can
still get a copy somewhere)?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 3/4] Run c_hash on the certificates

2014-09-25 Thread Cristian Morales Vega
OK, I found your patch. Sorry, I just registered in the list and
didn't look as far back as July.
I also see that openssl is supposed to be installed, so there is not
need to build it for the host.

The extension thing was only because of the c_rehash script. If you
crate the hashes manually there is indeed no need to change them.

I will take your patch, thanks!


On 24 September 2014 21:40, Christian Schoenebeck
christian.schoeneb...@gmail.com wrote:
 Am 24.09.2014 um 16:15 schrieb Cristian Morales Vega:
 It's needed for OpenSSL to find them.

 Signed-off-by: Cristian Morales Vega crist...@samknows.com
 ---
  package/system/ca-certificates/Makefile | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/package/system/ca-certificates/Makefile 
 b/package/system/ca-certificates/Makefile
 index cd29c0a..492cbb5 100644
 --- a/package/system/ca-certificates/Makefile
 +++ b/package/system/ca-certificates/Makefile
 @@ -14,6 +14,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
  PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates
  PKG_MD5SUM:=0436aba482091da310bd762e1deca8b4

 +PKG_BUILD_DEPENDS:=openssl-util/host
 +
  PKG_INSTALL:=1

  include $(INCLUDE_DIR)/package.mk
 @@ -34,6 +36,7 @@ endef
  define Package/ca-certificates/install
   $(INSTALL_DIR) $(1)/etc/ssl/certs
   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.pem 
 $(1)/etc/ssl/certs/
 + c_rehash $(1)/etc/ssl/certs/
  endef

  $(eval $(call BuildPackage,ca-certificates))

 Hi Cristian,

 I already offered attached patch to build hashes during build of 
 ca-certificate package.
 I'm using this patch for my own because it's not part of trunk.
 curl and wget works fine with this as long as they have hashes to look at.
 I'm not sure, but it makes no diff if file extension is pem or cer.

 Christian

 Date: Sun, 20 Jul 2014 10:48:50 +0200
 Subject: [PATCH] [package] ca-certificates: create symbolic link for 
 certificate hashes

 Implementing add-cert.sh functionality described at
 http://wiki.openwrt.org/doc/howto/wget-ssl-certs into Makefile
 otherwise you need to create symbolic links for certificate hashes
 yourself.

 Signed-off-by: Christian Schoenebeck christian.schoeneb...@gmail.com
 ---
  package/system/ca-certificates/Makefile | 9 +
  1 file changed, 9 insertions(+)

 diff --git a/package/system/ca-certificates/Makefile 
 b/package/system/ca-certificates/Makefile
 index 7f38c86..08a853f 100644
 --- a/package/system/ca-certificates/Makefile
 +++ b/package/system/ca-certificates/Makefile
 @@ -34,6 +34,15 @@ endef
  define Package/ca-certificates/install
 $(INSTALL_DIR) $(1)/etc/ssl/certs
 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.crt 
 $(1)/etc/ssl/certs/
 +
 +   for CERTFILE in `ls -1 $(1)/etc/ssl/certs`; do \
 +   HASH=`openssl x509 -hash -noout -in 
 $(1)/etc/ssl/certs/CERTFILE` ; \
 +   SUFFIX=0 ; \
 +   while [ -h $(1)/etc/ssl/certs/HASH.SUFFIX ]; do \
 +   let SUFFIX += 1 ; \
 +   done ; \
 +   ln -s CERTFILE $(1)/etc/ssl/certs/HASH.SUFFIX 
 ; \
 +   done
  endef

  $(eval $(call BuildPackage,ca-certificates))





-- 
Cristian Morales Vega

Email crist...@samknows.com
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 4/4] Make curl use the system certificates

2014-09-25 Thread Cristian Morales Vega
On 25 September 2014 11:38, Felix Fietkau n...@openwrt.org wrote:
 On 2014-09-24 16:15, Cristian Morales Vega wrote:
 Signed-off-by: Cristian Morales Vega crist...@samknows.com
 Committed in r42661, thanks.

 - Felix

Ups, no!
I wanted Christian Schoenebeck confirmation first. But I was supposed
to do a second version of this patch.
That option only works when curl uses OpenSSL. Since now it uses
PolarSSL by default it will break most builds.
The option should go inside $(if $(CONFIG_LIBCURL_OPENSSL)...

Sorry!

-- 
Cristian Morales Vega

Email crist...@samknows.com
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/4] Change certificates extension to .pem

2014-09-24 Thread Cristian Morales Vega
.crt is a generic extension that doesn't specify the encoding.
OpenSSL's c_rehash expects the .pem extension.

Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 package/system/ca-certificates/Makefile|  2 +-
 .../patches/010-pem_extension.patch| 41 ++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 
package/system/ca-certificates/patches/010-pem_extension.patch

diff --git a/package/system/ca-certificates/Makefile 
b/package/system/ca-certificates/Makefile
index 7f38c86..cd29c0a 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -33,7 +33,7 @@ endef
 
 define Package/ca-certificates/install
$(INSTALL_DIR) $(1)/etc/ssl/certs
-   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.crt 
$(1)/etc/ssl/certs/
+   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.pem 
$(1)/etc/ssl/certs/
 endef
 
 $(eval $(call BuildPackage,ca-certificates))
diff --git a/package/system/ca-certificates/patches/010-pem_extension.patch 
b/package/system/ca-certificates/patches/010-pem_extension.patch
new file mode 100644
index 000..6eb88f5
--- /dev/null
+++ b/package/system/ca-certificates/patches/010-pem_extension.patch
@@ -0,0 +1,41 @@
+--- a/mozilla/certdata2pem.py
 b/mozilla/certdata2pem.py
+@@ -122,10 +122,10 @@ for obj in objects:
+   .replace(')', '=')\
+   .replace(',', '_')
+ bname = bname.decode('string_escape')
+-fname = bname + '.crt'
++fname = bname + '.pem'
+ if os.path.exists(fname):
+ print Found duplicate certificate name %s, renaming. % bname
+-fname = bname + '_2.crt'
++fname = bname + '_2.pem'
+ f = open(fname, 'w')
+ f.write(-BEGIN CERTIFICATE-\n)
+ f.write(\n.join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 
64)))
+--- a/mozilla/Makefile
 b/mozilla/Makefile
+@@ -6,9 +6,9 @@ all:
+   python certdata2pem.py
+ 
+ clean:
+-  -rm -f *.crt
++  -rm -f *.pem
+ 
+ install:
+-  for p in *.crt; do \
++  for p in *.pem; do \
+install -m 644 $$p $(CERTSDIR)/$$p ; \
+   done
+--- a/spi-inc.org/Makefile
 b/spi-inc.org/Makefile
+@@ -7,7 +7,8 @@ all:
+ clean:
+ 
+ install:
+-  for p in *.crt; do \
++  mv spi-cacert-2008.crt spi-cacert-2008.pem
++  for p in *.pem; do \
+install -m 644 $$p $(CERTSDIR)/$$p ; \
+   done
+ 
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/4] Build OpenSSL for the host

2014-09-24 Thread Cristian Morales Vega
It gives us the tools to work with certificates.

Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 package/libs/openssl/Makefile | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 4b386ab..df962fc 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -26,6 +26,7 @@ PKG_BUILD_DEPENDS:=ocf-crypto-headers
 PKG_CONFIG_DEPENDS:=CONFIG_OPENSSL_ENGINE_CRYPTO CONFIG_OPENSSL_ENGINE_DIGEST \
CONFIG_OPENSSL_WITH_EC CONFIG_OPENSSL_WITH_EC2M
 
+include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 
 define Package/openssl/Default
@@ -138,6 +139,17 @@ define Build/Configure
depend
 endef
 
+define Host/Configure
+   (cd $(HOST_BUILD_DIR); \
+   RELEASE=; \
+   ./config \
+   --prefix=/usr \
+   --openssldir=/etc/ssl \
+   $(OPENSSL_NO_CIPHERS) \
+   $(OPENSSL_OPTIONS) \
+   )
+endef
+
 TARGET_CFLAGS += $(FPIC)
 
 define Build/Compile
@@ -181,6 +193,12 @@ define Build/InstallDev
[ -n $(TARGET_LDFLAGS) ]  $(SED) 's#$(TARGET_LDFLAGS)##g' 
$(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc || true
 endef
 
+define Host/Install
+   $(_SINGLE)$(MAKE) -C $(HOST_BUILD_DIR) 
INSTALL_PREFIX=$(STAGING_DIR_HOST) install
+   $(CP) $(HOST_BUILD_DIR)/tools/c_rehash $(STAGING_DIR_HOST)/bin/
+   chmod +x $(STAGING_DIR_HOST)/bin/c_rehash
+endef
+
 define Package/libopenssl/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
@@ -197,5 +215,6 @@ define Package/openssl-util/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
 endef
 
+$(eval $(call HostBuild))
 $(eval $(call BuildPackage,libopenssl))
 $(eval $(call BuildPackage,openssl-util))
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/4] Run c_hash on the certificates

2014-09-24 Thread Cristian Morales Vega
It's needed for OpenSSL to find them.

Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 package/system/ca-certificates/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/system/ca-certificates/Makefile 
b/package/system/ca-certificates/Makefile
index cd29c0a..492cbb5 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -14,6 +14,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates
 PKG_MD5SUM:=0436aba482091da310bd762e1deca8b4
 
+PKG_BUILD_DEPENDS:=openssl-util/host
+
 PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -34,6 +36,7 @@ endef
 define Package/ca-certificates/install
$(INSTALL_DIR) $(1)/etc/ssl/certs
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.pem 
$(1)/etc/ssl/certs/
+   c_rehash $(1)/etc/ssl/certs/
 endef
 
 $(eval $(call BuildPackage,ca-certificates))
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/4] Make curl use the system certificates

2014-09-24 Thread Cristian Morales Vega
Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 package/network/utils/curl/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/utils/curl/Makefile 
b/package/network/utils/curl/Makefile
index 0bb8323..2c6e6ea 100644
--- a/package/network/utils/curl/Makefile
+++ b/package/network/utils/curl/Makefile
@@ -97,6 +97,7 @@ CONFIGURE_ARGS += \
--disable-manual \
--disable-verbose \
--without-ca-bundle \
+   --with-ca-path=/etc/ssl/certs/ \
--without-krb4 \
--without-libidn \
--without-nss \
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] Build OpenSSL for the host

2014-09-24 Thread Cristian Morales Vega
On 24 September 2014 15:15, Cristian Morales Vega crist...@samknows.com wrote:
 It gives us the tools to work with certificates.

Ignore it, has some problems. It worked on my machine because it was
using my system copy of openSSL.
I will send new patches.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Do not define functions which are not implemented

2014-09-23 Thread Cristian Morales Vega
e.g. fminf() is not implemented by uClibc, only fmin(), but both are defined.

Signed-off-by: Cristian Morales Vega crist...@samknows.com
---
 .../995-no_implemenation_no_define.patch   | 96 ++
 1 file changed, 96 insertions(+)
 create mode 100644 
toolchain/uClibc/patches-0.9.33.2/995-no_implemenation_no_define.patch

diff --git 
a/toolchain/uClibc/patches-0.9.33.2/995-no_implemenation_no_define.patch 
b/toolchain/uClibc/patches-0.9.33.2/995-no_implemenation_no_define.patch
new file mode 100644
index 000..07e8ef8
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/995-no_implemenation_no_define.patch
@@ -0,0 +1,96 @@
+--- a/include/math.h
 b/include/math.h
+@@ -119,6 +119,7 @@ __BEGIN_DECLS
+ #  define _Mfloat_float
+ # endif
+ # define _Mdouble__Mfloat_
++# define _Mdouble_is_float_
+ # ifdef __STDC__
+ #  define __MATH_PRECNAME(name,r) name##f##r
+ # else
+@@ -127,6 +128,7 @@ __BEGIN_DECLS
+ # define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
+ # define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
+ # include bits/mathcalls.h
++# undef _Mdouble_is_float_
+ # undef   _Mdouble_
+ # undef _Mdouble_BEGIN_NAMESPACE
+ # undef _Mdouble_END_NAMESPACE
+--- a/libc/sysdeps/linux/common/bits/mathcalls.h
 b/libc/sysdeps/linux/common/bits/mathcalls.h
+@@ -272,7 +272,9 @@ __END_NAMESPACE_C99
+ #ifdef __USE_ISOC99
+ __BEGIN_NAMESPACE_C99
+ /* True gamma function.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (tgamma,, (_Mdouble_))
++# endif
+ __END_NAMESPACE_C99
+ #endif
+ 
+@@ -298,7 +300,9 @@ __MATHCALLI (rint,, (_Mdouble_ __x))
+ /* Return X + epsilon if X  Y, X - epsilon if X  Y.  */
+ __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
+ # if defined __USE_ISOC99  !defined __LDBL_COMPAT
++#  ifndef _Mdouble_is_float_
+ __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
++#  endif
+ # endif
+ 
+ /* Return the remainder of integer divison X / Y with infinite precision.  */
+@@ -315,11 +319,15 @@ __MATHDECLI (int,ilogb,, (_Mdouble_ __x)
+ 
+ #ifdef __USE_ISOC99
+ /* Return X times (2 to the Nth power).  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (scalbln,, (_Mdouble_ __x, long int __n))
++# endif
+ 
+ /* Round X to integral value in floating-point format using current
+rounding direction, but do not raise inexact exception.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (nearbyint,, (_Mdouble_ __x))
++# endif
+ 
+ /* Round X to nearest integral value, rounding halfway cases away from
+zero.  */
+@@ -332,7 +340,9 @@ __MATHCALLX (trunc,, (_Mdouble_ __x), (_
+ /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
+and magnitude congruent `mod 2^n' to the magnitude of the integral
+quotient x/y, with n = 3.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo))
++# endif
+ 
+ 
+ /* Conversion functions.  */
+@@ -349,13 +359,19 @@ __MATHDECLI (long long int,llround,, (_M
+ 
+ 
+ /* Return positive difference between X and Y.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (fdim,, (_Mdouble_ __x, _Mdouble_ __y))
++# endif
+ 
+ /* Return maximum numeric value from X and Y.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (fmax,, (_Mdouble_ __x, _Mdouble_ __y))
++# endif
+ 
+ /* Return minimum numeric value from X and Y.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (fmin,, (_Mdouble_ __x, _Mdouble_ __y))
++# endif
+ 
+ 
+ /* Classify given number.  */
+@@ -366,7 +382,9 @@ __MATHDECL_PRIV (int, signbit,, (_Mdoubl
+ 
+ 
+ /* Multiply-add function computed as a ternary operation.  */
++# ifndef _Mdouble_is_float_
+ __MATHCALLI (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z))
++# endif
+ #endif /* Use ISO C99.  */
+ 
+ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-- 
1.9.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel