Re: [OpenWrt-Devel] [PATCH v2] ramips: EX2700: remove unused kernel modules

2016-03-10 Thread Joseph C. Lehner
Just a quick followup, this applies to other devices as well: the
profile for the Ubiquity EdgeRouter X (mt7621, ubnt-erx) for example uses

PACKAGES:=-kmod-mt76 -wpad-mini -kmod-cfg80211

but all these packages are in fact included in the snapshot images created
by the OpenWrt buildbot.

Joseph

On 2016-03-10 17:22, Joseph C. Lehner wrote:
> Okay thanks, I'll keep that in mind. But the second issue still remains:
> 
> I was referring to the latest snapshot build for the ex2700 from
> downloads.openwrt.org, which come with all kmod-usb* stuff included,
> even though these modules should have been removed by the PACKAGES
> specification even before this patch, and I'm assuming that the same
> thing will happen to kmod-mt76.
> 
> Doesn't this indicate another issue somewhere, since I'd assume that
> the buildhosts always start from a clean build directory?
> 
> Joseph
> 
> 
> On 2016-03-10 17:07, John Crispin wrote:
>>
>>
>> On 10/03/2016 14:01, Joseph C. Lehner wrote:
>>> This patch has been merged in Chaos Calmer 6 days ago,
>>> but it also applies to trunk!
>>>
>>> Also, checking the most recent trunk images (2016-03-10),
>>> I've noticed that the image for the EX2700 also includes
>>> kmod-usb-core, kmod-usb-ohci, kmod-ledtrig-usbdev and
>>> kmod-usb2 (another whopping 118k), even though they
>>> shoudln't be, according to the PACKAGES specification.
>>> I encountered a similar issue while building on my machine,
>>> where I had to clean the whole build environment before
>>> a package was actually unselected.
>>>
>>> Could this be a bug in the build process somewhere?
>>>
>>> Regards
>>> Joseph
>>
>>
>>
>> rm -rf tmp/
>>
>> you target folder gets scanned and the result gets put into tmp/ if you
>> then run git pull it wont rescan target/* automagically. i would assume
>> that you ran into this issue
>>
>> i'll pull this into trunk aswell. i had it on my list and forgot. that
>> is why we ask to have 2 patches sent, 1 for trunk and one prefixed with "CC"
>>
>>  John
>>
>>
>>>
>>> On 2016-03-01 17:04, Joseph C. Lehner wrote:
>>>> Remove the kmod-mt76 package from the EX2700 profile to free up
>>>> around 100 KiB of space on the root filesystem.
>>>>
>>>> This patch applies to both trunk and Chaos Calmer.
>>>>
>>>> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
>>>>
>>>> ---
>>>>
>>>> Changes in v2:
>>>> * Don't remove kmod-rt2800-pci
>>>>
>>>>
>>>> diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
>>>> b/target/linux/ramips/mt7620/profiles/netgear.mk
>>>> index d1b073a..9631537 100644
>>>> --- a/target/linux/ramips/mt7620/profiles/netgear.mk
>>>> +++ b/target/linux/ramips/mt7620/profiles/netgear.mk
>>>> @@ -7,7 +7,8 @@
>>>>
>>>>  define Profile/EX2700
>>>>NAME:=Netgear EX2700
>>>> -  PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
>>>> +  PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
>>>> \
>>>> +  -kmod-mt76
>>>>  endef
>>>>
>>>>  define Profile/EX2700/Description
>>>>
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] ramips: EX2700: remove unused kernel modules

2016-03-10 Thread Joseph C. Lehner
Okay thanks, I'll keep that in mind. But the second issue still remains:

I was referring to the latest snapshot build for the ex2700 from
downloads.openwrt.org, which come with all kmod-usb* stuff included,
even though these modules should have been removed by the PACKAGES
specification even before this patch, and I'm assuming that the same
thing will happen to kmod-mt76.

Doesn't this indicate another issue somewhere, since I'd assume that
the buildhosts always start from a clean build directory?

Joseph


On 2016-03-10 17:07, John Crispin wrote:
> 
> 
> On 10/03/2016 14:01, Joseph C. Lehner wrote:
>> This patch has been merged in Chaos Calmer 6 days ago,
>> but it also applies to trunk!
>>
>> Also, checking the most recent trunk images (2016-03-10),
>> I've noticed that the image for the EX2700 also includes
>> kmod-usb-core, kmod-usb-ohci, kmod-ledtrig-usbdev and
>> kmod-usb2 (another whopping 118k), even though they
>> shoudln't be, according to the PACKAGES specification.
>> I encountered a similar issue while building on my machine,
>> where I had to clean the whole build environment before
>> a package was actually unselected.
>>
>> Could this be a bug in the build process somewhere?
>>
>> Regards
>> Joseph
> 
> 
> 
> rm -rf tmp/
> 
> you target folder gets scanned and the result gets put into tmp/ if you
> then run git pull it wont rescan target/* automagically. i would assume
> that you ran into this issue
> 
> i'll pull this into trunk aswell. i had it on my list and forgot. that
> is why we ask to have 2 patches sent, 1 for trunk and one prefixed with "CC"
> 
>   John
> 
> 
>>
>> On 2016-03-01 17:04, Joseph C. Lehner wrote:
>>> Remove the kmod-mt76 package from the EX2700 profile to free up
>>> around 100 KiB of space on the root filesystem.
>>>
>>> This patch applies to both trunk and Chaos Calmer.
>>>
>>> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
>>>
>>> ---
>>>
>>> Changes in v2:
>>> * Don't remove kmod-rt2800-pci
>>>
>>>
>>> diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
>>> b/target/linux/ramips/mt7620/profiles/netgear.mk
>>> index d1b073a..9631537 100644
>>> --- a/target/linux/ramips/mt7620/profiles/netgear.mk
>>> +++ b/target/linux/ramips/mt7620/profiles/netgear.mk
>>> @@ -7,7 +7,8 @@
>>>
>>>  define Profile/EX2700
>>> NAME:=Netgear EX2700
>>> -   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
>>> +   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
>>> \
>>> +   -kmod-mt76
>>>  endef
>>>
>>>  define Profile/EX2700/Description
>>>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] ramips: EX2700: remove unused kernel modules

2016-03-10 Thread Joseph C. Lehner
This patch has been merged in Chaos Calmer 6 days ago,
but it also applies to trunk!

Also, checking the most recent trunk images (2016-03-10),
I've noticed that the image for the EX2700 also includes
kmod-usb-core, kmod-usb-ohci, kmod-ledtrig-usbdev and
kmod-usb2 (another whopping 118k), even though they
shoudln't be, according to the PACKAGES specification.
I encountered a similar issue while building on my machine,
where I had to clean the whole build environment before
a package was actually unselected.

Could this be a bug in the build process somewhere?

Regards
Joseph

On 2016-03-01 17:04, Joseph C. Lehner wrote:
> Remove the kmod-mt76 package from the EX2700 profile to free up
> around 100 KiB of space on the root filesystem.
> 
> This patch applies to both trunk and Chaos Calmer.
> 
> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
> 
> ---
> 
> Changes in v2:
> * Don't remove kmod-rt2800-pci
> 
> 
> diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
> b/target/linux/ramips/mt7620/profiles/netgear.mk
> index d1b073a..9631537 100644
> --- a/target/linux/ramips/mt7620/profiles/netgear.mk
> +++ b/target/linux/ramips/mt7620/profiles/netgear.mk
> @@ -7,7 +7,8 @@
> 
>  define Profile/EX2700
>   NAME:=Netgear EX2700
> - PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
> + PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
> \
> + -kmod-mt76
>  endef
> 
>  define Profile/EX2700/Description
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: mt7620: fix failsafe switch config

2016-03-01 Thread Joseph C. Lehner
I see that the patch has been merged in trunk, however the same
issue exists in Chaos Calmer (and this patch applies to the CC
branch as well).

Regards,
Joseph


On 2016-02-17 17:58, Joseph C. Lehner wrote:
> As indicated in the bug tracker[1], failsafe mode is broken on at least some
> devices using the mt7620 switch (and possibly mt7621). The thread explicitly
> mentions the Xiaomi MiWifi, and the Nexx WT3020, and an unspecified device
> using the mt7621 switch; the issue also applies to the Netgear EX2700.
> 
> The problem is that failsafe mode uses eth0, but enable_vlan is always set to 
> 1
> by the switch driver. Connecting to and/or pinging the device fails. This 
> patch 
> fixes the failsafe preinit config, by making sure that vlan support is 
> disabled. 
> It currently only fixes the switch config on mt7620, but might apply to the 
> mt7621 as well, so the patch has been designed with this in mind.
> 
> A similar (line wrapped) patch was submitted in December by Simon Peter, but 
> never
> accepted and/or discussed.
> 
> This patch applies to both Chaos Calmer and trunk.
> 
> [1] https://dev.openwrt.org/ticket/18768
> 
> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
> 
> ---
> 
> diff --git 
> a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips 
> b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> index 3dce1b6..6948851 100644
> --- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> +++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
> @@ -7,8 +7,22 @@
>  
>  ramips_set_preinit_iface() {
>   RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688)"`
> + MT762X=`cat /proc/cpuinfo | egrep "MT7620"`
> +
>   if [ -n "${RT3X5X}" ]; then
>   swconfig dev rt305x set reset 1
> + elif [ -n "${MT762X}" ]; then
> + # The mt7530 switch driver enables VLAN by default, but
> + # failsafe uses eth0, making the device unreachable:
> + # https://dev.openwrt.org/ticket/18768
> + case "${MT762X}" in
> + *MT7620*)
> + mt762x_switchdev=mt7620
> + ;;
> + esac
> + swconfig dev $mt762x_switchdev set reset 1
> + swconfig dev $mt762x_switchdev set enable_vlan 0
> + swconfig dev $mt762x_switchdev set apply 1
>   fi
>  
>   if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] ramips: EX2700: remove unused kernel modules

2016-03-01 Thread Joseph C. Lehner
Remove the kmod-mt76 package from the EX2700 profile to free up
around 100 KiB of space on the root filesystem.

This patch applies to both trunk and Chaos Calmer.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes in v2:
* Don't remove kmod-rt2800-pci


diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
b/target/linux/ramips/mt7620/profiles/netgear.mk
index d1b073a..9631537 100644
--- a/target/linux/ramips/mt7620/profiles/netgear.mk
+++ b/target/linux/ramips/mt7620/profiles/netgear.mk
@@ -7,7 +7,8 @@

 define Profile/EX2700
NAME:=Netgear EX2700
-   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
+   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
\
+   -kmod-mt76
 endef

 define Profile/EX2700/Description
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: EX2700: remove unused kernel modules

2016-02-26 Thread Joseph C. Lehner
Remove the kmod-mt76 and kmod-rt2800-pci packages from the EX2700
profile to free up around 100 KiB of space on the root filesystem.

This patch applies to both trunk and Chaos Calmer.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git a/target/linux/ramips/mt7620/profiles/netgear.mk
b/target/linux/ramips/mt7620/profiles/netgear.mk
index d1b073a..9631537 100644
--- a/target/linux/ramips/mt7620/profiles/netgear.mk
+++ b/target/linux/ramips/mt7620/profiles/netgear.mk
@@ -7,7 +7,8 @@

 define Profile/EX2700
NAME:=Netgear EX2700
-   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev
+   PACKAGES:=-kmod-usb-core -kmod-usb2 -kmod-usb-ohci -kmod-ledtrig-usbdev 
\
+   -kmod-mt76 -kmod-rt2800-pci
 endef

 define Profile/EX2700/Description
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] CC: ramips: Backport support for Netgear EX2700

2016-02-18 Thread Joseph C. Lehner
This patch adds support for the Netgear EX2700 in Chaos Calmer and
builds approriate -sysupgrade and -factory images.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes in v2:
* Build -factory and -sysupgrade images


diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 5946f98..5327d00 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -114,6 +114,10 @@ case $board in
esr-9753)
set_wifi_led "rt2800pci-phy0::radio"
;;
+   ex2700)
+   ucidef_set_led_default "power_r" "POWER (red)" 
"ex2700:red:power" "0"
+   set_wifi_led "ex2700:green:router"
+   ;;
f5d8235-v1)
set_usb_led "f5d8235-v1:blue:storage"
;;
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 d7d016b..a78912d 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -113,7 +113,8 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
;;
 
-   cf-wr800n)
+   cf-wr800n|\
+   ex2700)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "4 6t"
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index a7e2501..6474ebd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -63,6 +63,9 @@ get_status_led() {
esr-9753)
status_led="esr-9753:orange:power"
;;
+   ex2700)
+   status_led="ex2700:red:power"
+   ;;
f5d8235-v2)
status_led="f5d8235v2:blue:router"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 4141ddd..8dc05b0 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -223,6 +223,9 @@ ramips_board_detect() {
*"Netgear WNCE2001")
name="wnce2001"
;;
+   *"Netgear EX2700")
+   name="ex2700"
+   ;;
*"NexAira BC2")
name="bc2"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 2f64d8c..a3d0175 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -49,6 +49,7 @@ platform_check_image() {
dir-620-d1 | \
dir-810l | \
e1700 | \
+   ex2700 |\
esr-9753 | \
f7c027 | \
fonera20n | \
diff --git a/target/linux/ramips/dts/EX2700.dts 
b/target/linux/ramips/dts/EX2700.dts
new file mode 100644
index 000..da98bd8
--- /dev/null
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -0,0 +1,148 @@
+/*
+ * Device Tree file for the Netgear EX2700
+ *
+ * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear EX2700";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "mx25l3205d";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "mx25l3205d";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg =

Re: [OpenWrt-Devel] [PATCH v8] ramips: build factory images for Netgear EX2700

2016-02-18 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.
 
The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).
 
Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes for v8:
* Fix dd invocation

Changes for v7:
* Word wrap, again.

Changes for v6:
* Forgot to add backslash (sorry)

Changes for v5:
* Don't break if the kernel directory was cleaned using
`make target/linux/clean` (due to eval usage).

Changes for v4
* Fix word wrap

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file


diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..463f89b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,34 @@ endif
 # MT7620A Profiles
 #
 
+# $(1): (ignored)
+# $(2): lowercase board name
+# $(3): uppercase board name (must match DTS filename w/o extension)
+# $(4): erase block size
+# $(5): hardware id for mkdniimg
+# $(6): maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   # Pad kernel to eraseblock boundary, minus 2 uImage headers (=128 
bytes):
+   # bs = (eraseblock * (1 + (128 + kernelsize)/eraseblock)) - 128
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=`expr \( $(4) \* \( 1 + \( 128 + \`wc -c < 
$(KDIR)/vmlinux-$(2).bin.lzma\` \) / $(4) \) \) - 128` \
+   count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call 
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage 
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

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


[OpenWrt-Devel] [PATCH] ramips: mt7620: fix failsafe switch config

2016-02-17 Thread Joseph C. Lehner
As indicated in the bug tracker[1], failsafe mode is broken on at least some
devices using the mt7620 switch (and possibly mt7621). The thread explicitly
mentions the Xiaomi MiWifi, and the Nexx WT3020, and an unspecified device
using the mt7621 switch; the issue also applies to the Netgear EX2700.

The problem is that failsafe mode uses eth0, but enable_vlan is always set to 1
by the switch driver. Connecting to and/or pinging the device fails. This patch 
fixes the failsafe preinit config, by making sure that vlan support is 
disabled. 
It currently only fixes the switch config on mt7620, but might apply to the 
mt7621 as well, so the patch has been designed with this in mind.

A similar (line wrapped) patch was submitted in December by Simon Peter, but 
never
accepted and/or discussed.

This patch applies to both Chaos Calmer and trunk.

[1] https://dev.openwrt.org/ticket/18768

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git 
a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips 
b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
index 3dce1b6..6948851 100644
--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -7,8 +7,22 @@
 
 ramips_set_preinit_iface() {
RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688)"`
+   MT762X=`cat /proc/cpuinfo | egrep "MT7620"`
+
if [ -n "${RT3X5X}" ]; then
swconfig dev rt305x set reset 1
+   elif [ -n "${MT762X}" ]; then
+   # The mt7530 switch driver enables VLAN by default, but
+   # failsafe uses eth0, making the device unreachable:
+   # https://dev.openwrt.org/ticket/18768
+   case "${MT762X}" in
+   *MT7620*)
+   mt762x_switchdev=mt7620
+   ;;
+   esac
+   swconfig dev $mt762x_switchdev set reset 1
+   swconfig dev $mt762x_switchdev set enable_vlan 0
+   swconfig dev $mt762x_switchdev set apply 1
fi
 
if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v7] ramips: build factory images for Netgear EX2700

2016-02-17 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.
 
The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).
 
Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes for v7:
* Word wrap, again.

Changes for v6:
* Forgot to add backslash (sorry)

Changes for v5:
* Don't break if the kernel directory was cleaned using
`make target/linux/clean` (due to eval usage).

Changes for v4
* Fix word wrap

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..463f89b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,34 @@ endif
 # MT7620A Profiles
 #
 
+# $(1): (ignored)
+# $(2): lowercase board name
+# $(3): uppercase board name (must match DTS filename w/o extension)
+# $(4): erase block size
+# $(5): hardware id for mkdniimg
+# $(6): maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   # Pad kernel to eraseblock boundary, minus 2 uImage headers (=128 
bytes):
+   # bs = (eraseblock * (1 + (128 + kernelsize)/eraseblock)) - 128
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=`expr \( $(4) \* \( 1 + \( 128 + \`wc -c < 
$(KDIR)/vmlinux-$(2).bin.lzma\` \) / $(4) \) \) - 128`
+   count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call 
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage 
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

-- 
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 v6] ramips: build factory images for Netgear EX2700

2016-02-17 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.

The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes for v6:
* Forgot to add backslash (sorry)

Changes for v5:
* Don't break if the kernel directory was cleaned using
`make target/linux/clean` (due to eval usage).

Changes for v4
* Fix word wrap

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..463f89b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,34 @@ endif
 # MT7620A Profiles
 #

+# $(1): (ignored)
+# $(2): lowercase board name
+# $(3): uppercase board name (must match DTS filename w/o extension)
+# $(4): erase block size
+# $(5): hardware id for mkdniimg
+# $(6): maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   # Pad kernel to eraseblock boundary, minus 2 uImage headers (=128 
bytes):
+   # bs = (eraseblock * (1 + (128 + kernelsize)/eraseblock)) - 128
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=`expr \( $(4) \* \( 1 + \( 128 + \`wc -c < 
$(KDIR)/vmlinux-$(2).bin.lzma\` \)
/ $(4) \) \) - 128`
+   count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

-- 
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 v5] ramips: build factory images for Netgear EX2700

2016-02-17 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.
 
The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).
 
Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes for v5:
* Don't break if the kernel directory was cleaned using
`make target/linux/clean` (due to eval usage).

Changes for v4
* Fix word wrap

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..463f89b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,34 @@ endif
 # MT7620A Profiles
 #
 
+# $(1): (ignored)
+# $(2): lowercase board name
+# $(3): uppercase board name (must match DTS filename w/o extension)
+# $(4): erase block size
+# $(5): hardware id for mkdniimg
+# $(6): maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   # Pad kernel to eraseblock boundary, minus 2 uImage headers (=128 
bytes):
+   # bs = (eraseblock * (1 + (128 + kernelsize)/eraseblock)) - 128
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=`expr \( $(4) \* \( 1 + \( 128 + \`wc -c < 
$(KDIR)/vmlinux-$(2).bin.lzma\` \) / $(4) \) \) - 128`
+   count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call 
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage 
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

-- 
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 v4] ramips: build factory images for Netgear EX2700

2016-02-17 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.

The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---
Changes for v4
* Fix word wrap

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..c43bde3 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,36 @@ endif
 # MT7620A Profiles
 #
 
+# $(1): (ignored)
+# $(2): Board name (small caps)
+# $(3): DTS file name without extension
+# $(4): Erase block size
+# $(5): DNI hardware id
+# $(6): Maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   $(eval kernelsize=$(shell wc -c < $(KDIR)/vmlinux-$(2).bin.lzma))
+   # Round (kernelsize + 2*64) to erase blocks, avoiding parens
+   $(eval kernelsize=$(shell expr 2 \* 64 + $(kernelsize)))
+   $(eval kernelsize=$(shell expr 1 + $(kernelsize) / $(4)))
+   $(eval kernelsize=$(shell expr $(4) \* $(kernelsize)))
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=(($(kernelsize)-2*64)) count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call 
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage 
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3] ramips: build factory images for Netgear EX2700

2016-02-16 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.

The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

Changes for v3:
* Fix maximum image size

Changes for v2:
* Move fakeroot uImage header to separate file

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index a42f8b9..c65cb27 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,36 @@ endif
 # MT7620A Profiles
 #

+# $(1): (ignored)
+# $(2): Board name (small caps)
+# $(3): DTS file name without extension
+# $(4): Erase block size
+# $(5): DNI hardware id
+# $(6): Maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   $(eval kernelsize=$(shell wc -c < $(KDIR)/vmlinux-$(2).bin.lzma))
+   # Round (kernelsize + 2*64) to erase blocks, avoiding parens
+   $(eval kernelsize=$(shell expr 2 \* 64 + $(kernelsize)))
+   $(eval kernelsize=$(shell expr 1 + $(kernelsize) / $(4)))
+   $(eval kernelsize=$(shell expr $(4) \* $(kernelsize)))
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=(($(kernelsize)-2*64)) count=1 conv=sync
+
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3866624
+Image/Build/Profile/EX2700=$(call
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

-- 
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 v2] ramips: build factory images for Netgear EX2700

2016-02-16 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.

The bootloader on this device expects the kernel partition to end
on a 64k block boundary. The last 64 byte of the kernel partition
must contain a valid uImage header - in the stock firmware, this is
the uImage header of the root filesystem. For this patch, we're using
the uImage header of a 0 byte partition (ex2700-fakeroot.uImage).

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index a42f8b9..3ce4d91 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,37 @@ endif
 # MT7620A Profiles
 #

+# $(1): (ignored)
+# $(2): Board name (small caps)
+# $(3): DTS file name without extension
+# $(4): Erase block size
+# $(5): DNI hardware id
+# $(6): Maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   $(eval kernelsize=$(shell wc -c < $(KDIR)/vmlinux-$(2).bin.lzma))
+   # Round (kernelsize + 2*64) to erase blocks, avoiding parens
+   $(eval kernelsize=$(shell expr 2 \* 64 + $(kernelsize)))
+   $(eval kernelsize=$(shell expr 1 + $(kernelsize) / $(4)))
+   $(eval kernelsize=$(shell expr $(4) \* $(kernelsize)))
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=(($(kernelsize)-2*64)) count=1 conv=sync
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+
+   cat ex2700-fakeroot.uImage >> $(KDIR)/vmlinux-$(2).uImage
+
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3604480
+Image/Build/Profile/EX2700=$(call
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
diff --git a/target/linux/ramips/image/ex2700-fakeroot.uImage
b/target/linux/ramips/image/ex2700-fakeroot.uImage
new file mode 100644
index 
..340f736141e84e425fe66b372eef80b217146df5
GIT binary patch
literal 64
ocmY#ql?+qLV?W4%1+cQRGx!=7krPD5NE3rxxYsm!K;H01lrBPXGV_

literal 0
HcmV?d1

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


[OpenWrt-Devel] [PATCH] ramips: build factory images for Netgear EX2700

2016-02-16 Thread Joseph C. Lehner
This patch adds support for building factory and sysupgrade images
for the Netgear EX2700 that don't require modification of u-boot
environment variables.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 8bdd76a..68580ad 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -912,8 +912,65 @@ endif
 # MT7620A Profiles
 #
 
+# $(1): (ignored)
+# $(2): Board name (small caps)
+# $(3): DTS file name without extension
+# $(4): Erase block size
+# $(5): DNI hardware id
+# $(6): Maximum image size
+define BuildFirmware/Netgear/squashfs
+   $(call PatchKernelLzmaDtb,$(2),$(3))
+   $(eval kernelsize=$(shell wc -c < $(KDIR)/vmlinux-$(2).bin.lzma))
+   # Round (kernelsize + 2*64) to erase blocks, avoiding parens
+   $(eval kernelsize=$(shell expr 2 \* 64 + $(kernelsize)))
+   $(eval kernelsize=$(shell expr 1 + $(kernelsize) / $(4)))
+   $(eval kernelsize=$(shell expr $(4) \* $(kernelsize)))
+   dd if=$(KDIR)/vmlinux-$(2).bin.lzma \
+   of=$(KDIR)/vmlinux-$(2).bin.lzma.tmp \
+   bs=(($(kernelsize)-2*64)) count=1 conv=sync
+   $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.tmp,$(KDIR)/vmlinux-$(2).uImage)
+
+   # Manually create the header of a 0 byte uImage. We can't use
+   # mkimage because it wont let us use an empty source file.
+   $(eval fakeroot=$(KDIR)/fakeroot-$(2).uImage)
+
+   # ih_magic:
+   echo -ne '\x27\x05\x19\x56' > $(fakeroot)
+   # ih_hcrc:
+   echo -ne '\x22\x6e\x07\xc1' >> $(fakeroot)
+   # ih_time:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   # ih_size:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   # ih_load:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   # ih_ep:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   # ih_dcrc:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   # ih_os, ih_arch, ih_type, ih_comp:
+   echo -ne '\x05\x05\x07\x00' >> $(fakeroot)
+   # ih_name:
+   echo -n 'OpenWrt fakeroot' >> $(fakeroot)
+   # padding:
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+   echo -ne '\x00\x00\x00\x00' >> $(fakeroot)
+
+   cat $(fakeroot) >> $(KDIR)/vmlinux-$(2).uImage
+
+   $(call MkImageSysupgrade/squashfs,squashfs,$(2),$(6))
+
+   $(STAGING_DIR_HOST)/bin/mkdniimg \
+   -B $(3) -H $(5) -v OpenWrt \
+   -i $(call imgname,squashfs,$(2))-sysupgrade.bin \
+   -o $(call imgname,squashfs,$(2))-factory.bin
+endef
+
 Image/Build/Profile/E1700=$(call 
BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
-Image/Build/Profile/EX2700=$(call 
BuildFirmware/Default4M/$(1),$(1),ex2700,EX2700)
+ex2700_mtd_size=3604480
+Image/Build/Profile/EX2700=$(call 
BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
 Image/Build/Profile/MT7620a=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
 Image/Build/Profile/MT7620a_MT7610e=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
 Image/Build/Profile/MT7620a_MT7530=$(call 
BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v4] ramips: Add support for Netgear EX2700

2016-02-16 Thread Joseph C. Lehner
Sorry, yeah, must have missed that! Thanks!

On 2016-02-16 16:24, John Crispin wrote:
> 
> 
> 
> 
> 
> 
> 
> On 16/02/2016 16:00, Joseph C. Lehner wrote:
>> I've received a notification from patchwork that the patch status has
>> been changed to "Accepted" 9 days ago, but it hasn't been merged yet.
>>
>> Since I have another patch depending on v4, should I submit v5, or wait
>> until v4 has been merged and then submit a new patch?
>>
>> Regards
>> Joseph
>>
> 
> 
> 
> this one ?
> 
> commit 8f9e1937a3c716f0da1a2ec22e26e18e4ec338f4
> Author: blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
> Date: Fri Feb 12 08:29:33 2016 +
> 
> ramips: Add support for Netgear EX2700
> 
> This patch adds support for the Netgear EX2700 and builds an approriate
> sysupgrade image.
> 
> What's missing is the option to build a factory image flashable via the
> router's stock web interface, but this approach is hindered by the fact
> that u-boot operforms an additional integrity check, which expects a
> uImage header in the last 64 bytes of the "kernel" partition, which
> the bootloader expects to be 960k, a size exceeded by the standard
> OpenWrt kernel.
> 
> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
> 
> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48698
> 3c298f89-4303-0410-b956-a3cf2f4a3e73
> 
> i pushed it earlier today already by the look of things
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v4] ramips: Add support for Netgear EX2700

2016-02-16 Thread Joseph C. Lehner
I've received a notification from patchwork that the patch status has
been changed to "Accepted" 9 days ago, but it hasn't been merged yet.

Since I have another patch depending on v4, should I submit v5, or wait
until v4 has been merged and then submit a new patch?

Regards
Joseph

On 2016-02-08 22:29, Joseph C. Lehner wrote:
> This patch adds support for the Netgear EX2700 and builds an approriate
> sysupgrade image.
> 
> What's missing is the option to build a factory image flashable via the
> router's stock web interface, but this approach is hindered by the fact
> that u-boot operforms an additional integrity check, which expects a
> uImage header in the last 64 bytes of the "kernel" partition, which
> the bootloader expects to be 960k, a size exceeded by the standard
> OpenWrt kernel.
> 
> Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
> 
> ---
> Changes for v4:
> * Fix whitespace errors in netgear.mk
> 
> Changes for v3:
> * Fix led name in /etc/board.d/01_leds
> * Cleanup device tree
> 
> Changes for v2:
> * Fix alphabetical ordering (image/Makefile is not really sorted, so I've
>   put the EX2700 immediately below the E1700).
> 
> diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
> b/target/linux/ramips/base-files/etc/board.d/01_leds
> index c3a81a4..b10f5f1 100755
> --- a/target/linux/ramips/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds
> @@ -125,6 +125,10 @@ dir-810l|\
>  mzk-dp150n)
>   ucidef_set_led_default "power" "power" "$board:green:power" "1"
>   ;;
> +ex2700)
> + ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
> + set_wifi_led "$board:green:router"
> + ;;
>  f5d8235-v1|\
>  f5d8235-v2)
>   set_usb_led "$board:blue:storage"
> 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 dafa3e9..9853729 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -141,7 +141,8 @@ ramips_setup_interfaces()
>   ucidef_add_switch "switch0" \
>   "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
>   ;;
> - cf-wr800n)
> + cf-wr800n|\
> + ex2700)
>   ucidef_add_switch "switch0" \
>   "4:lan" "6t@eth0"
>   ;;
> diff --git a/target/linux/ramips/base-files/etc/diag.sh 
> b/target/linux/ramips/base-files/etc/diag.sh
> index acc500b..59c5965 100644
> --- a/target/linux/ramips/base-files/etc/diag.sh
> +++ b/target/linux/ramips/base-files/etc/diag.sh
> @@ -34,6 +34,7 @@ get_status_led() {
>   a5-v11|\
>   d105|\
>   dcs-930l-b1|\
> + ex2700|\
>   hlk-rm04|\
>   mpr-a1|\
>   mpr-a2)
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
> b/target/linux/ramips/base-files/lib/ramips.sh
> index 8025a40..aed8350 100755
> --- a/target/linux/ramips/base-files/lib/ramips.sh
> +++ b/target/linux/ramips/base-files/lib/ramips.sh
> @@ -154,6 +154,9 @@ ramips_board_detect() {
>   *"ESR-9753")
>   name="esr-9753"
>   ;;
> + *"EX2700")
> + name="ex2700";
> + ;;
>   *"F5D8235 v1")
>   name="f5d8235-v1"
>   ;;
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
> b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index 39b5f94..78edd22 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -51,6 +51,7 @@ platform_check_image() {
>   dir-810l|\
>   e1700|\
>   esr-9753|\
> + ex2700|\
>   f7c027|\
>   firewrt|\
>   fonera20n|\
> diff --git a/target/linux/ramips/dts/EX2700.dts 
> b/target/linux/ramips/dts/EX2700.dts
> new file mode 100644
> index 000..4b5a01a
> --- /dev/null
> +++ b/target/linux/ramips/dts/EX2700.dts
> @@ -0,0 +1,148 @@
> +/*
> + * Device Tree file for the Netgear EX2700
> + *
> + * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
&g

[OpenWrt-Devel] ramips: Failsafe switch config broken on (some?) mt7620/mt7621 devices

2016-02-12 Thread Joseph C. Lehner
As indicated in the bug tracker[1], failsafe mode is broken on at least some
devices using the mt7620 switch (and possibly mt7621). The thread explicitly
mentions the Xiaomi MiWifi, and the Nexx WT3020, and an unspecified device
using the mt7621 switch; I can confirm the issue on a Netgear EX2700 (mt7620).
This applies to both Chaos Calmer and trunk!

The problem is that failsafe mode uses eth0, but VLANs are enabled by the switch
driver:

# swconfig dev mt7620 show
Global attributes:
enable_vlan: 1
Port 0:
pvid: 0
link: port:0 link:down
Port 1:
pvid: 0
link: port:1 link:down
Port 2:
pvid: 0
link: port:2 link:down
Port 3:
pvid: 0
link: port:3 link:down
Port 4:
pvid: 0
link: port:4 link:up speed:100baseT full-duplex
Port 5:
pvid: 0
link: port:5 link:down
Port 6:
pvid: 0
link: port:6 link:up speed:1000baseT full-duplex
Port 7:
pvid: 0
link: port:7 link:down

In the patch adding support for the Netgear EX2700 (which has only one LAN port 
-
switch port 4), I've omitted the "mediatek,portmap" property in the device tree,
but the same happens if specifying either "w" or "w", obviously.

I'd submit a patch, but I'd like to some input on this matter first. I'm 
proposing
the following changes:

1. Patch /lib/preinit/07_set_preinit_iface_ramips, to disable VLANs on the 
switch
   (the bug tracker contains an example).

2. Patch the mt7530 switch driver to disable VLANs if no mediatek,portmap 
property
   was specified, similar to the attached patch (I'll submit a proper patch if 
this
   is accepted).

The second approach works perfectly on my EX2700, plus it allows for a simpler 
entry
in /etc/board.d/02_network (`ucidef_set_interface_lan "eth0"`). The first 
approach
also fixes failsafe on devices that DO have more than one ethernet port (i.e. 
those
that make use of the "mediatek,portmap" property).


Any thoughts on this? Regards,
Joseph


[1] https://dev.openwrt.org/ticket/18768

---

--- a/drivers/net/ethernet/mediatek/mt7530.c2016-02-11 23:26:38.407412647 
+0100
+++ a/drivers/net/ethernet/mediatek/mt7530.c2016-02-11 23:21:59.911481188 
+0100
@@ -760,7 +760,6 @@
 
mt7530->base = base;
mt7530->bus = bus;
-   mt7530->global_vlan_enable = vlan;
 
swdev = >swdev;
if (bus) {
@@ -789,8 +788,13 @@
 
 
map = mt7530_find_mapping(dev->of_node);
-   if (map)
+   if (map) {
+   mt7530->global_vlan_enable = vlan;
mt7530_apply_mapping(mt7530, map);
+   } else {
+   mt7530->global_vlan_enable = 0;
+   dev_info(dev, "mediatek,portmap not specified - disabling VLAN\n")
+   }
mt7530_apply_config(swdev);
 
/* magic vodoo */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] CC: ramips: Backport support for Netgear EX2700

2016-02-11 Thread Joseph C. Lehner
This patch adds support for the Netgear EX2700 in Chaos Calmer and
builds an approriate sysupgrade image (backported from my earlier
submission).

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index 5946f98..5327d00 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -114,6 +114,10 @@ case $board in
esr-9753)
set_wifi_led "rt2800pci-phy0::radio"
;;
+   ex2700)
+   ucidef_set_led_default "power_r" "POWER (red)" 
"ex2700:red:power" "0"
+   set_wifi_led "ex2700:green:router"
+   ;;
f5d8235-v1)
set_usb_led "f5d8235-v1:blue:storage"
;;
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 d7d016b..a78912d 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -113,7 +113,8 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
;;
 
-   cf-wr800n)
+   cf-wr800n|\
+   ex2700)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "4 6t"
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index a7e2501..6474ebd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -63,6 +63,9 @@ get_status_led() {
esr-9753)
status_led="esr-9753:orange:power"
;;
+   ex2700)
+   status_led="ex2700:red:power"
+   ;;
f5d8235-v2)
status_led="f5d8235v2:blue:router"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 4141ddd..8dc05b0 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -223,6 +223,9 @@ ramips_board_detect() {
*"Netgear WNCE2001")
name="wnce2001"
;;
+   *"Netgear EX2700")
+   name="ex2700"
+   ;;
*"NexAira BC2")
name="bc2"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 2f64d8c..a3d0175 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -49,6 +49,7 @@ platform_check_image() {
dir-620-d1 | \
dir-810l | \
e1700 | \
+   ex2700 |\
esr-9753 | \
f7c027 | \
fonera20n | \
diff --git a/target/linux/ramips/dts/EX2700.dts 
b/target/linux/ramips/dts/EX2700.dts
new file mode 100644
index 000..da98bd8
--- /dev/null
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -0,0 +1,148 @@
+/*
+ * Device Tree file for the Netgear EX2700
+ *
+ * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear EX2700";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "mx25l3205d";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "mx25l3205d";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg =

Re: [OpenWrt-Devel] [PATCH v4] ramips: Add support for Netgear EX2700

2016-02-08 Thread Joseph C. Lehner
This patch adds support for the Netgear EX2700 and builds an approriate
sysupgrade image.

What's missing is the option to build a factory image flashable via the
router's stock web interface, but this approach is hindered by the fact
that u-boot operforms an additional integrity check, which expects a
uImage header in the last 64 bytes of the "kernel" partition, which
the bootloader expects to be 960k, a size exceeded by the standard
OpenWrt kernel.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---
Changes for v4:
* Fix whitespace errors in netgear.mk

Changes for v3:
* Fix led name in /etc/board.d/01_leds
* Cleanup device tree

Changes for v2:
* Fix alphabetical ordering (image/Makefile is not really sorted, so I've
  put the EX2700 immediately below the E1700).

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index c3a81a4..b10f5f1 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -125,6 +125,10 @@ dir-810l|\
 mzk-dp150n)
ucidef_set_led_default "power" "power" "$board:green:power" "1"
;;
+ex2700)
+   ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
+   set_wifi_led "$board:green:router"
+   ;;
 f5d8235-v1|\
 f5d8235-v2)
set_usb_led "$board:blue:storage"
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 dafa3e9..9853729 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -141,7 +141,8 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
;;
-   cf-wr800n)
+   cf-wr800n|\
+   ex2700)
ucidef_add_switch "switch0" \
"4:lan" "6t@eth0"
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index acc500b..59c5965 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -34,6 +34,7 @@ get_status_led() {
a5-v11|\
d105|\
dcs-930l-b1|\
+   ex2700|\
hlk-rm04|\
mpr-a1|\
mpr-a2)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 8025a40..aed8350 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -154,6 +154,9 @@ ramips_board_detect() {
*"ESR-9753")
name="esr-9753"
;;
+   *"EX2700")
+   name="ex2700";
+   ;;
*"F5D8235 v1")
name="f5d8235-v1"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 39b5f94..78edd22 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -51,6 +51,7 @@ platform_check_image() {
dir-810l|\
e1700|\
esr-9753|\
+   ex2700|\
f7c027|\
firewrt|\
fonera20n|\
diff --git a/target/linux/ramips/dts/EX2700.dts 
b/target/linux/ramips/dts/EX2700.dts
new file mode 100644
index 000..4b5a01a
--- /dev/null
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -0,0 +1,148 @@
+/*
+ * Device Tree file for the Netgear EX2700
+ *
+ * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear EX2700";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+ 

[OpenWrt-Devel] [PATCH v2] ramips: Add support for Netgear EX2700

2016-01-21 Thread Joseph C. Lehner
This patch adds support for the Netgear EX2700 and builds an approriate 
sysupgrade image. 
 
What's missing is the option to build a factory image flashable via the 
router's stock web interface, but this approach is hindered by the fact 
that u-boot operforms an additional integrity check, which expects a 
uImage header in the last 64 bytes of the "kernel" partition, which
the bootloader expects to be 960k, a size exceeded by the standard 
OpenWrt kernel.
 
Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>
 
---

Changes for v2:
* Fix alphabetical ordering (image/Makefile is not really sorted, so I've
put the EX2700 immediately below the E1700).



diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index c3a81a4..e5a7db3 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -125,6 +125,10 @@ dir-810l|\
 mzk-dp150n)
ucidef_set_led_default "power" "power" "$board:green:power" "1"
;;
+ex2700)
+   ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
+   set_wifi_led "$board:router:green"
+   ;;
 f5d8235-v1|\
 f5d8235-v2)
set_usb_led "$board:blue:storage"
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 dafa3e9..9853729 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -141,7 +141,8 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
;;
-   cf-wr800n)
+   cf-wr800n|\
+   ex2700)
ucidef_add_switch "switch0" \
"4:lan" "6t@eth0"
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index acc500b..59c5965 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -34,6 +34,7 @@ get_status_led() {
a5-v11|\
d105|\
dcs-930l-b1|\
+   ex2700|\
hlk-rm04|\
mpr-a1|\
mpr-a2)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 8025a40..aed8350 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -154,6 +154,9 @@ ramips_board_detect() {
*"ESR-9753")
name="esr-9753"
;;
+   *"EX2700")
+   name="ex2700";
+   ;;
*"F5D8235 v1")
name="f5d8235-v1"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 39b5f94..78edd22 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -51,6 +51,7 @@ platform_check_image() {
dir-810l|\
e1700|\
esr-9753|\
+   ex2700|\
f7c027|\
firewrt|\
fonera20n|\
diff --git a/target/linux/ramips/dts/EX2700.dts 
b/target/linux/ramips/dts/EX2700.dts
new file mode 100644
index 000..b63949a
--- /dev/null
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -0,0 +1,153 @@
+/*
+ * Device Tree file for the Netgear EX2700
+ *
+ * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear EX2700";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "mx25l3205d";
+ 

[OpenWrt-Devel] [PATCH] ramips: Add support for Netgear EX2700

2016-01-19 Thread Joseph C. Lehner
This patch adds support for the Netgear EX2700 and builds an approriate 
sysupgrade image. 

What's missing is the option to build a factory image flashable via the 
router's stock web interface, but this approach is hindered by the fact 
that u-boot operforms an additional integrity check, which expects a 
uImage header in the last 64 bytes of the "kernel" partition, which
the bootloader expects to be 960k, a size exceeded by the standard 
OpenWrt kernel.

Signed-off-by: Joseph C. Lehner <joseph.c.leh...@gmail.com>

---

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index c3a81a4..62478f0 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -121,6 +121,10 @@ dir-615-h1)
 dir-620-d1)
set_wifi_led "$board:green:wifi"
;;
+ex2700)
+   ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
+   set_wifi_led "$board:router:green"
+   ;;
 dir-810l|\
 mzk-dp150n)
ucidef_set_led_default "power" "power" "$board:green:power" "1"
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 dafa3e9..9853729 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -141,7 +141,8 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
;;
-   cf-wr800n)
+   cf-wr800n|\
+   ex2700)
ucidef_add_switch "switch0" \
"4:lan" "6t@eth0"
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index acc500b..59c5965 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -34,6 +34,7 @@ get_status_led() {
a5-v11|\
d105|\
dcs-930l-b1|\
+   ex2700|\
hlk-rm04|\
mpr-a1|\
mpr-a2)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 8025a40..aed8350 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -154,6 +154,9 @@ ramips_board_detect() {
*"ESR-9753")
name="esr-9753"
;;
+   *"EX2700")
+   name="ex2700";
+   ;;
*"F5D8235 v1")
name="f5d8235-v1"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 39b5f94..78edd22 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -51,6 +51,7 @@ platform_check_image() {
dir-810l|\
e1700|\
esr-9753|\
+   ex2700|\
f7c027|\
firewrt|\
fonera20n|\
diff --git a/target/linux/ramips/dts/EX2700.dts 
b/target/linux/ramips/dts/EX2700.dts
new file mode 100644
index 000..b63949a
--- /dev/null
+++ b/target/linux/ramips/dts/EX2700.dts
@@ -0,0 +1,153 @@
+/*
+ * Device Tree file for the Netgear EX2700
+ *
+ * Copyright (C) 2016 Joseph C. Lehner <joseph.c.leh...@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Netgear EX2700";
+
+   chosen {
+   bootargs = "console=ttyS0,57600";
+   };
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "mx25l3205d";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+