Re: [OpenWrt-Devel] How to check if its the first boot ever?
You could customize the files that sysupgrade retains, that should be the easiest way. On Thu, Jul 14, 2016 at 4:27 AM, Ronaldo Afonsowrote: > Hi all, > > I'm doing a customized OpenWrt firmware and I need to know at boot time if > its the first time my OpenWrt firmware has been booted. > > More specifically, my scripts at "/etc/uci-defaults" need to know if they > are being executed by flashing over a "router original firmware" > (factory.bin) or a previews OpenWrt firmware (sysupgrade.bin). > > For example: > > I need to set the network.lan.ipaddr to the IP address "192.168.120.1" if > it is the first time I'm flashing my router, otherwise I need to preserve > the IP address the was configured before. > > Any help would be appreciated. > > Thanks in advance ... > > -- > Ronaldo Afonso > 11 9 5252 0484 > www.ronaldoafonso.com.br > > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCHv10] ramips: Add support for SamKnows Whitebox 8
Noted. Would I need to re-send the same v10? On 29 Apr 2016 20:30, "Piotr Dymacz" <pep...@gmail.com> wrote: > Hello Andrew, > > Just two comments. > > Your patch changelog should go below "---" after the Signed-off-by > line, so that it won't get included in commit message. > It's common to include just a small description about the hardware the > patch adds support for, examples: [1], [2], [3]. > > Cheers, > Piotr > > [1] https://dev.openwrt.org/changeset/44238 > [2] https://dev.openwrt.org/changeset/41939 > [3] https://dev.openwrt.org/changeset/46454 > > > 2016-04-29 14:03 GMT+02:00 Andrew Yong <m...@ndoo.sg>: > > PATCHv1: > > This patch adds support for the SamKnows version 8.0 Whitebox, built > > around the MT7621 platform. 2.4GHz appears to be working, albeit > > poorly; 5GHz not working yet. > > > > PATCHv2: > > - Fixed LED name in DTS. > > > > PATCHv3: > > DTS: Syntax error fixed, LEDs and buttons mapped correctly now > > - diag.sh updated to blink WPS LED on boot > > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset > > matches SamKnows firmware > > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware > > > > PATCHv4: > > - I didn't commit some fixes in PATCHv3, that's fixed now > > > > PATCHv5: > > - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter > > to prevent soft brick by booting into nonexistent backup partition > > - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, > > needs further investigation, effective txpower is still 0) > > - Experimenting on wifi but that'll be a future patch, board boots fine > now. > > > > PATCHv6: > > - Used init script to reset bootcount, preinit is too early to use > fw-setenv > > > > PATCHv7: > > - Added model to sysupgrade. Tested thoroughly in general and I'm happy > with this. Sorry for the many revisions. > > > > PATCHv8: > > - Added SamKnows recovery partition to partition table, in case someone > specifically wants to send their bootloader to it > > - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into > mt76 kernel module (verified that signal strength on both bands is good, > tested AP and STA modes > > > > PATCHv9: > > - Fixed LAN MAC address EEPROM offset > > - Fixed mt76 patch whitespace issues > > - Renamed mt76 patch to mt7602en to accurately reflect the physical chip > it's supporting > > > > PATCHv10: > > - Removed mt76 patch in favor of upstream patch > > - I solemnly swear not to have to revision my patch >5 times every again > > > > Initial support for SamKnows Whitebox 8 > > > > Signed-off-by: Andrew Yong <m...@ndoo.sg> > > > > diff --git a/package/boot/uboot-envtools/files/ramips > b/package/boot/uboot-envtools/files/ramips > > index a759bcc..9ad5974 100644 > > --- a/package/boot/uboot-envtools/files/ramips > > +++ b/package/boot/uboot-envtools/files/ramips > > @@ -24,7 +24,8 @@ linkits7688d | \ > > wsr-600 | \ > > wsr-1166 | \ > > br6425 | \ > > -miwifi-nano) > > +miwifi-nano | \ > > +sk-wb8) > > ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" > > ;; > > esac > > 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 47e1e6a..28db48f 100755 > > --- a/target/linux/ramips/base-files/etc/board.d/01_leds > > +++ b/target/linux/ramips/base-files/etc/board.d/01_leds > > @@ -247,6 +247,9 @@ rt-n14u) > > set_wifi_led "$board:blue:air" > > set_usb_led "$board:blue:usb" > > ;; > > +sk-wb8) > > + set_usb_led "$board:green:usb" > > + ;; > > tiny-ac) > > set_wifi_led "$board:orange:wifi" > > set_usb_led "$board:green:usb" > > 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 ee690f6..3cbf577 100755 > > --- a/target/linux/ramips/base-files/etc/board.d/02_network > > +++ b/target/linux/ramips/base-files/etc/board.d/02_network > > @@ -77,6 +77,7 @@ ramips_setup_interfaces() > > pbr-m1|\ > > psg1208|\ > > sap-g3200u3|\ > > + sk-wb8|\ > > wf-2881|\ > > whr-300hp2|\ > > whr-600d|\ > > @@ -314,6 +315,9 @@ ramips_setup_macs() > >
[OpenWrt-Devel] [PATCHv10] ramips: Add support for SamKnows Whitebox 8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: - Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. PATCHv6: - Used init script to reset bootcount, preinit is too early to use fw-setenv PATCHv7: - Added model to sysupgrade. Tested thoroughly in general and I'm happy with this. Sorry for the many revisions. PATCHv8: - Added SamKnows recovery partition to partition table, in case someone specifically wants to send their bootloader to it - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into mt76 kernel module (verified that signal strength on both bands is good, tested AP and STA modes PATCHv9: - Fixed LAN MAC address EEPROM offset - Fixed mt76 patch whitespace issues - Renamed mt76 patch to mt7602en to accurately reflect the physical chip it's supporting PATCHv10: - Removed mt76 patch in favor of upstream patch - I solemnly swear not to have to revision my patch >5 times every again Initial support for SamKnows Whitebox 8 Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 47e1e6a..28db48f 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -247,6 +247,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 ee690f6..3cbf577 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -314,6 +315,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index c638d16..e432fa6 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -79,6 +79,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 000..b93e3c9 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +. /lib/ramips.sh + +START=99 + +start() { + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 0ac0f68..9d5421b 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -376,6 +376,9 @@ ramips_board_detect() { *"RUT5XX") name="rut5xx"
Re: [OpenWrt-Devel] [PATCHv9] ramips: Add support for SamKnows Whitebox 8
Will do. Awesome. On 29 Apr 2016 19:30, "John Crispin" <j...@phrozen.org> wrote: > Hi, > > please drop the mt76 part from the patch it is already merged in the > mt76 tree on github and will hit trunk soon. > > also patch does not apply as shown below. > > John > > ../patchwork 615343 > --2016-04-28 09:07:34-- http://patchwork.ozlabs.org/patch/615343/mbox/ > Resolving patchwork.ozlabs.org (patchwork.ozlabs.org)... 103.22.144.67 > Connecting to patchwork.ozlabs.org > (patchwork.ozlabs.org)|103.22.144.67|:80... connected. > HTTP request sent, awaiting response... 200 OK > Length: unspecified [text/plain] > Saving to: `615343.patch' > > [ <=> > ] 14,542 31.0K/s in 0.5s > > 2016-04-28 09:07:36 (31.0 KB/s) - `615343.patch' saved [14542] > > Applying: ramips: Add support for SamKnows Whitebox 8 > fatal: corrupt patch at line 22 > Repository lacks necessary blobs to fall back on 3-way merge. > Cannot fall back to three-way merge. > Patch failed at 0001 ramips: Add support for SamKnows Whitebox 8 > When you have resolved this problem run "git am --resolved". > If you would prefer to skip this patch, instead run "git am --skip". > To restore the original branch and stop patching run "git am --abort". > applying 615343 FAILED > > > > > On 26/04/2016 23:47, Andrew Yong wrote: > > PATCHv1: > > This patch adds support for the SamKnows version 8.0 Whitebox, built > > around the MT7621 platform. 2.4GHz appears to be working, albeit > > poorly; 5GHz not working yet. > > > > PATCHv2: > > - Fixed LED name in DTS. > > > > PATCHv3: > > DTS: Syntax error fixed, LEDs and buttons mapped correctly now > > - diag.sh updated to blink WPS LED on boot > > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset > > matches SamKnows firmware > > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware > > > > PATCHv4: > > - I didn't commit some fixes in PATCHv3, that's fixed now > > > > PATCHv5: > > - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter > > to prevent soft brick by booting into nonexistent backup partition > > - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, > > needs further investigation, effective txpower is still 0) > > - Experimenting on wifi but that'll be a future patch, board boots fine > now. > > > > PATCHv6: > > - Used init script to reset bootcount, preinit is too early to use > fw-setenv > > > > PATCHv7: > > - Added model to sysupgrade. Tested thoroughly in general and I'm happy > with this. Sorry for the many revisions. > > > > PATCHv8: > > - Added SamKnows recovery partition to partition table, in case someone > specifically wants to send their bootloader to it > > - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into > mt76 kernel module (verified that signal strength on both bands is good, > tested AP and STA modes > > > > PATCHv9: > > - Fixed LAN MAC address EEPROM offset > > - Fixed mt76 patch whitespace issues > > - Renamed mt76 patch to mt7602en to accurately reflect the physical chip > it's supporting > > > > Author: Andrew Yong <m...@ndoo.sg> > > Date: Wed Apr 27 05:40:26 2016 +0800 > > > > Initial support for SamKnows Whitebox 8 > > > > Signed-off-by: Andrew Yong <m...@ndoo.sg> > > > > diff --git a/000-mt7602en.patch b/000-mt7602en.patch > > new file mode 100644 > > index 000..e357bbb > > --- /dev/null > > +++ b/000-mt7602en.patch > > @@ -0,0 +1,10 @@ > > +--- a/mt76x2_pci.c > > b/mt76x2_pci.c > > +@@ -20,6 +20,7 @@ > > + > > + static const struct pci_device_id mt76pci_device_table[] = { > > + { PCI_DEVICE(0x14c3, 0x7662) }, > > ++ { PCI_DEVICE(0x14c3, 0x7612) }, > > + { }, > > + }; > > + > > diff --git a/package/boot/uboot-envtools/files/ramips > b/package/boot/uboot-envtools/files/ramips > > index a759bcc..9ad5974 100644 > > --- a/package/boot/uboot-envtools/files/ramips > > +++ b/package/boot/uboot-envtools/files/ramips > > @@ -24,7 +24,8 @@ linkits7688d | \ > > wsr-600 | \ > > wsr-1166 | \ > > br6425 | \ > > -miwifi-nano) > > +miwifi-nano | \ > > +sk-wb8) > > ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" > > ;; > > esac > > diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds > b/target/linux/ramips/base-files
Re: [OpenWrt-Devel] [PATCH] ramips: add support for Planex MZK-EX750NP.
I'll take a look at what can be done with the `wifi` script. I think it's pretty long overdue with IoT modules being huge now. On 28 Apr 2016 20:23, "Piotr Dymacz" <pep...@gmail.com> wrote: > Hello, > > 2016-04-28 13:12 GMT+02:00 Andrew Yong <m...@ndoo.sg>: > [...] > > > Many SOM modules and mini routers (and the Zsun card reader > > https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader) don't have > > Ethernet ports and manufacturers ship custom OpenWrt with preconfigured > WiFi > > for this, and probably will never be supported by OpenWrt releases > because > > of how wifi-detect disables WiFi by default. > > Fully agree. > There are other interesting devices, like D-Link DCH-M225 (MT7620A + > audio) [1]. > > I know only one way how to use such devices with OpenWrt: define > hardware button as rfkill and use it after flash. > > Cheers, > Piotr > > [1] https://wikidevi.com/wiki/D-Link_DCH-M225_rev_A1 > > > > > On 28 Apr 2016 18:48, "@SRCHACK.ORG" <tochiro.srch...@gmail.com> wrote: > >> > >> Hi, Dear Piotr. > >> > >> Status quo, is the only way there is access in the UART. > >> Looking for a good way. I'm thinking. > >> > >> > >> On 2016/04/28 19:24, Piotr Dymacz wrote: > >>> > >>> Hello YuheiOKAWA, > >>> > >>> Just small question. > >>> How the user can access the device if it doesn't have Ethernet and the > >>> WiFi is disabled by default in OpenWrt? > >>> > >>> Cheers, > >>> Piotr > >>> > >>> > >>> 2016-04-28 11:49 GMT+02:00 YuheiOKAWA <tochiro.srch...@gmail.com>: > >>>> > >>>> add support for Planex MZK-EX750NP. > >>>> MZK-EX750NP is MT7620A and MT7610E based 11ac wifi repeater. > >>>> Built-in power supply. > >>>> 64MiB RAM, 8MiB SPI Flash, non Wired Ethernet. > >>>> > >>>> Signed-off-by: YuheiOKAWA <tochiro.srch...@gmail.com> > >>>> --- > >>>> target/linux/ramips/base-files/etc/board.d/01_leds | 4 + > >>>> .../linux/ramips/base-files/etc/board.d/02_network | 1 + > >>>> target/linux/ramips/base-files/etc/diag.sh | 3 +- > >>>> target/linux/ramips/base-files/lib/ramips.sh | 3 + > >>>> .../ramips/base-files/lib/upgrade/platform.sh | 1 + > >>>> target/linux/ramips/dts/MZK-EX750NP.dts| 150 > >>>> + > >>>> target/linux/ramips/image/mt7620.mk| 2 + > >>>> target/linux/ramips/mt7620/profiles/planex.mk | 11 ++ > >>>> 8 files changed, 174 insertions(+), 1 deletion(-) > >>>> create mode 100644 target/linux/ramips/dts/MZK-EX750NP.dts > >>>> > >>>> 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 aeaab33..47e1e6a 100755 > >>>> --- a/target/linux/ramips/base-files/etc/board.d/01_leds > >>>> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds > >>>> @@ -206,6 +206,10 @@ mr-102n) > >>>> set_wifi_led "$board:green:wlan" > >>>> set_usb_led "$board:green:usb" > >>>> ;; > >>>> +mzk-ex750np) > >>>> + ucidef_set_led_default "power" "power" "$board:red:power" "1" > >>>> + set_wifi_led "$board:red:wifi" > >>>> + ;; > >>>> na930) > >>>> set_usb_led "$board:blue:status" > >>>> ;; > >>>> 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 c6c740f..ee690f6 100755 > >>>> --- a/target/linux/ramips/base-files/etc/board.d/02_network > >>>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network > >>>> @@ -165,6 +165,7 @@ ramips_setup_interfaces() > >>>> d105|\ > >>>> hpm|\ > >>>> mzk-ex300np|\ > >>>> + mzk-ex750np|\ > >>>> na930|\ > >>>> wli-tx4-ag300n|\ > >>>> wrh-300cr) > >>>> diff --git a/target/linux/ramips/base-files/etc/diag.sh > >>>> b/targ
Re: [OpenWrt-Devel] [PATCH] ramips: add support for Planex MZK-EX750NP.
@openwrt devs: Is there an upstream-approved way to remove "option disabled 1" from default WiFi config for devices with no Ethernet port? Many SOM modules and mini routers (and the Zsun card reader https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader) don't have Ethernet ports and manufacturers ship custom OpenWrt with preconfigured WiFi for this, and probably will never be supported by OpenWrt releases because of how wifi-detect disables WiFi by default. On 28 Apr 2016 18:48, "@SRCHACK.ORG"wrote: > Hi, Dear Piotr. > > Status quo, is the only way there is access in the UART. > Looking for a good way. I'm thinking. > > > On 2016/04/28 19:24, Piotr Dymacz wrote: > >> Hello YuheiOKAWA, >> >> Just small question. >> How the user can access the device if it doesn't have Ethernet and the >> WiFi is disabled by default in OpenWrt? >> >> Cheers, >> Piotr >> >> >> 2016-04-28 11:49 GMT+02:00 YuheiOKAWA : >> >>> add support for Planex MZK-EX750NP. >>> MZK-EX750NP is MT7620A and MT7610E based 11ac wifi repeater. >>> Built-in power supply. >>> 64MiB RAM, 8MiB SPI Flash, non Wired Ethernet. >>> >>> Signed-off-by: YuheiOKAWA >>> --- >>> target/linux/ramips/base-files/etc/board.d/01_leds | 4 + >>> .../linux/ramips/base-files/etc/board.d/02_network | 1 + >>> target/linux/ramips/base-files/etc/diag.sh | 3 +- >>> target/linux/ramips/base-files/lib/ramips.sh | 3 + >>> .../ramips/base-files/lib/upgrade/platform.sh | 1 + >>> target/linux/ramips/dts/MZK-EX750NP.dts| 150 >>> + >>> target/linux/ramips/image/mt7620.mk| 2 + >>> target/linux/ramips/mt7620/profiles/planex.mk | 11 ++ >>> 8 files changed, 174 insertions(+), 1 deletion(-) >>> create mode 100644 target/linux/ramips/dts/MZK-EX750NP.dts >>> >>> 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 aeaab33..47e1e6a 100755 >>> --- a/target/linux/ramips/base-files/etc/board.d/01_leds >>> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds >>> @@ -206,6 +206,10 @@ mr-102n) >>> set_wifi_led "$board:green:wlan" >>> set_usb_led "$board:green:usb" >>> ;; >>> +mzk-ex750np) >>> + ucidef_set_led_default "power" "power" "$board:red:power" "1" >>> + set_wifi_led "$board:red:wifi" >>> + ;; >>> na930) >>> set_usb_led "$board:blue:status" >>> ;; >>> 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 c6c740f..ee690f6 100755 >>> --- a/target/linux/ramips/base-files/etc/board.d/02_network >>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network >>> @@ -165,6 +165,7 @@ ramips_setup_interfaces() >>> d105|\ >>> hpm|\ >>> mzk-ex300np|\ >>> + mzk-ex750np|\ >>> na930|\ >>> wli-tx4-ag300n|\ >>> wrh-300cr) >>> diff --git a/target/linux/ramips/base-files/etc/diag.sh >>> b/target/linux/ramips/base-files/etc/diag.sh >>> index 20ff8ff..c638d16 100644 >>> --- a/target/linux/ramips/base-files/etc/diag.sh >>> +++ b/target/linux/ramips/base-files/etc/diag.sh >>> @@ -41,7 +41,8 @@ get_status_led() { >>> hlk-rm04|\ >>> jhr-n825r|\ >>> mpr-a1|\ >>> - mpr-a2) >>> + mpr-a2|\ >>> + mzk-ex750np) >>> status_led="$board:red:power" >>> ;; >>> ai-br100|\ >>> diff --git a/target/linux/ramips/base-files/lib/ramips.sh >>> b/target/linux/ramips/base-files/lib/ramips.sh >>> index 2c669c5..0ac0f68 100755 >>> --- a/target/linux/ramips/base-files/lib/ramips.sh >>> +++ b/target/linux/ramips/base-files/lib/ramips.sh >>> @@ -298,6 +298,9 @@ ramips_board_detect() { >>> *"MZK-EX300NP") >>> name="mzk-ex300np" >>> ;; >>> + *"MZK-EX750NP") >>> + name="mzk-ex750np" >>> + ;; >>> *"MZK-W300NH2"*) >>> name="mzk-w300nh2" >>> ;; >>> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh >>> b/target/linux/ramips/base-files/lib/upgrade/platform.sh >>> index 2b24030..86ea4a3 100755 >>> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh >>> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh >>> @@ -90,6 +90,7 @@ platform_check_image() { >>> mzk-750dhp|\ >>> mzk-dp150n|\ >>> mzk-ex300np|\ >>> + mzk-ex750np|\ >>> mzk-w300nh2|\ >>> mzk-wdpr|\ >>> nbg-419n|\ >>> diff --git a/target/linux/ramips/dts/MZK-EX750NP.dts >>> b/target/linux/ramips/dts/MZK-EX750NP.dts >>> new file mode 100644 >>> index 000..9b5b418 >>> --- /dev/null >>> +++ b/target/linux/ramips/dts/MZK-EX750NP.dts >>> @@ -0,0 +1,150 @@ >>> +/dts-v1/; >>> + >>> +/include/ "mt7620a.dtsi" >>> + >>> +/ { >>> + compatible =
[OpenWrt-Devel] [PATCHv9] ramips: Add support for SamKnows Whitebox 8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: - Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. PATCHv6: - Used init script to reset bootcount, preinit is too early to use fw-setenv PATCHv7: - Added model to sysupgrade. Tested thoroughly in general and I'm happy with this. Sorry for the many revisions. PATCHv8: - Added SamKnows recovery partition to partition table, in case someone specifically wants to send their bootloader to it - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into mt76 kernel module (verified that signal strength on both bands is good, tested AP and STA modes PATCHv9: - Fixed LAN MAC address EEPROM offset - Fixed mt76 patch whitespace issues - Renamed mt76 patch to mt7602en to accurately reflect the physical chip it's supporting Author: Andrew Yong <m...@ndoo.sg> Date: Wed Apr 27 05:40:26 2016 +0800 Initial support for SamKnows Whitebox 8 Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/000-mt7602en.patch b/000-mt7602en.patch new file mode 100644 index 000..e357bbb --- /dev/null +++ b/000-mt7602en.patch @@ -0,0 +1,10 @@ +--- a/mt76x2_pci.c b/mt76x2_pci.c +@@ -20,6 +20,7 @@ + + static const struct pci_device_id mt76pci_device_table[] = { + { PCI_DEVICE(0x14c3, 0x7662) }, ++ { PCI_DEVICE(0x14c3, 0x7612) }, + { }, + }; + diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 aeaab33..a47eacf 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -243,6 +243,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 c6c740f..4bc1d6e 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -313,6 +314,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57344) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 20ff8ff..e98226d 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -78,6 +78,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 000..b93e3c9 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +. /lib/ramips.sh + +START=99 + +start() { + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/b
Re: [OpenWrt-Devel] [PATCHv8] ramips: Add support for SamKnows Whitebox 8
Documented everything that led to this here: https://wiki.openwrt.org/inbox/samknows/samknows_sk-wb8 On Wed, Apr 27, 2016 at 1:59 AM, Andrew Yong <m...@ndoo.sg> wrote: > PATCHv1: > This patch adds support for the SamKnows version 8.0 Whitebox, built > around the MT7621 platform. 2.4GHz appears to be working, albeit > poorly; 5GHz not working yet. > > PATCHv2: > - Fixed LED name in DTS. > > PATCHv3: > DTS: Syntax error fixed, LEDs and buttons mapped correctly now > - diag.sh updated to blink WPS LED on boot > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset > matches SamKnows firmware > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware > > PATCHv4: > - I didn't commit some fixes in PATCHv3, that's fixed now > > PATCHv5: > - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter > to prevent soft brick by booting into nonexistent backup partition > - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, > needs further investigation, effective txpower is still 0) > - Experimenting on wifi but that'll be a future patch, board boots fine now. > > PATCHv6: > - Used init script to reset bootcount, preinit is too early to use fw-setenv > > PATCHv7: > - Added model to sysupgrade. Tested thoroughly in general and I'm happy with > this. Sorry for the many revisions. > > PATCHv8: > - Added SamKnows recovery partition to partition table, in case someone > specifically wants to send their bootloader to it > - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into mt76 > kernel module (verified that signal strength on both bands is good, tested AP > and STA modes > > commit 200a485d324ba262daa7bed9b01c2a044f9be856 > Author: Andrew Yong <m...@ndoo.sg> > Date: Wed Apr 27 01:47:23 2016 +0800 > > Initial support for SamKnows Whitebox 8 > > Signed-off-by: Andrew Yong <m...@ndoo.sg> > > diff --git a/package/boot/uboot-envtools/files/ramips > b/package/boot/uboot-envtools/files/ramips > index a759bcc..9ad5974 100644 > --- a/package/boot/uboot-envtools/files/ramips > +++ b/package/boot/uboot-envtools/files/ramips > @@ -24,7 +24,8 @@ linkits7688d | \ > wsr-600 | \ > wsr-1166 | \ > br6425 | \ > -miwifi-nano) > +miwifi-nano | \ > +sk-wb8) > ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" > ;; > esac > diff --git a/package/kernel/mt76/patches/000-mt7612.patch > b/package/kernel/mt76/patches/000-mt7612.patch > new file mode 100644 > index 000..3529e35 > --- /dev/null > +++ b/package/kernel/mt76/patches/000-mt7612.patch > @@ -0,0 +1,10 @@ > +--- a/mt76x2_pci.c > b/mt76x2_pci.c > +@@ -20,6 +20,7 @@ > + > + static const struct pci_device_id mt76pci_device_table[] = { > +{ PCI_DEVICE(0x14c3, 0x7662) }, > ++ { PCI_DEVICE(0x14c3, 0x7612) }, > +{ }, > + }; > + > 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 aeaab33..a47eacf 100755 > --- a/target/linux/ramips/base-files/etc/board.d/01_leds > +++ b/target/linux/ramips/base-files/etc/board.d/01_leds > @@ -243,6 +243,9 @@ rt-n14u) > set_wifi_led "$board:blue:air" > set_usb_led "$board:blue:usb" > ;; > +sk-wb8) > + set_usb_led "$board:green:usb" > + ;; > tiny-ac) > set_wifi_led "$board:orange:wifi" > set_usb_led "$board:green:usb" > 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 c6c740f..b3740d5 100755 > --- a/target/linux/ramips/base-files/etc/board.d/02_network > +++ b/target/linux/ramips/base-files/etc/board.d/02_network > @@ -77,6 +77,7 @@ ramips_setup_interfaces() > pbr-m1|\ > psg1208|\ > sap-g3200u3|\ > + sk-wb8|\ > wf-2881|\ > whr-300hp2|\ > whr-600d|\ > @@ -313,6 +314,9 @@ ramips_setup_macs() > lan_mac=$(macaddr_setbit_la "$lan_mac") > wan_mac=$(mtd_get_mac_binary factory 32772) > ;; > + sk-wb8) > + wan_mac=$(mtd_get_mac_binary factory 57350) > + ;; > tew-691gr) > lan_mac=$(cat /sys/class/net/eth0/address) > wan_mac=$(macaddr_add "$lan_mac" 3) > diff --git a/target/linux/ramips/base-files/etc/diag.sh > b/target/linux/ramips/base-files/etc/diag.sh > index 20ff8ff..e98226d 100644 > --- a/target/linux/ramips/base-files/etc/diag.sh > +++ b/target/linux/ramips/bas
[OpenWrt-Devel] [PATCHv8] ramips: Add support for SamKnows Whitebox 8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: - Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. PATCHv6: - Used init script to reset bootcount, preinit is too early to use fw-setenv PATCHv7: - Added model to sysupgrade. Tested thoroughly in general and I'm happy with this. Sorry for the many revisions. PATCHv8: - Added SamKnows recovery partition to partition table, in case someone specifically wants to send their bootloader to it - Fixed Wi-Fi by patching MT7602EN device ID (shows up as 7612) into mt76 kernel module (verified that signal strength on both bands is good, tested AP and STA modes commit 200a485d324ba262daa7bed9b01c2a044f9be856 Author: Andrew Yong <m...@ndoo.sg> Date: Wed Apr 27 01:47:23 2016 +0800 Initial support for SamKnows Whitebox 8 Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac diff --git a/package/kernel/mt76/patches/000-mt7612.patch b/package/kernel/mt76/patches/000-mt7612.patch new file mode 100644 index 000..3529e35 --- /dev/null +++ b/package/kernel/mt76/patches/000-mt7612.patch @@ -0,0 +1,10 @@ +--- a/mt76x2_pci.c b/mt76x2_pci.c +@@ -20,6 +20,7 @@ + + static const struct pci_device_id mt76pci_device_table[] = { +{ PCI_DEVICE(0x14c3, 0x7662) }, ++ { PCI_DEVICE(0x14c3, 0x7612) }, +{ }, + }; + 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 aeaab33..a47eacf 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -243,6 +243,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 c6c740f..b3740d5 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -313,6 +314,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 20ff8ff..e98226d 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -78,6 +78,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 000..b93e3c9 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +. /lib/ramips.sh + +START=99 + +start() { + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base
[OpenWrt-Devel] [PATCHv7] ramips: add support for SamKnows SK-WB8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: - Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. PATCHv6: - Used init script to reset bootcount, preinit is too early to use fw-setenv PATCHv7: - Added model to sysupgrade. Tested thoroughly in general and I'm happy with this. Sorry for the many revisions. commit eeb292822edf50a6265a7cd9a6b5f920f693ada3 Author: Yong <andry...@a45e60beba81.ant.amazon.com> Date: Tue Apr 26 16:09:21 2016 +0800 Initial support for SamKnows Whitebox 8 Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index bd0ff05..534cc1c 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -76,6 +76,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 000..b93e3c9 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +. /lib/ramips.sh + +START=99 + +start() { + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..5c1715d 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -367,6 +367,9 @@ ramips_board_detect() { *"RUT5XX") name="rut5xx" ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; *"SAP-G3200U3") name="sap-g3200u3" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/
[OpenWrt-Devel] [PATCHv6] ramips: add support for SamKnows SK-WB8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: - Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. PATCHv6: - Used init script to reset bootcount, preinit is too early to use fw-setenv Initial support for SamKnows Whitebox 8 Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index bd0ff05..534cc1c 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -76,6 +76,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount new file mode 100755 index 000..b93e3c9 --- /dev/null +++ b/target/linux/ramips/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +. /lib/ramips.sh + +START=99 + +start() { + local board=$(ramips_board_name) + if [ $board = "sk-wb8" ]; then + fw_setenv bootcount 0 + fi +} diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..5c1715d 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -367,6 +367,9 @@ ramips_board_detect() { *"RUT5XX") name="rut5xx" ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; *"SAP-G3200U3") name="sap-g3200u3" ;; diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts new file mode 100644 index 000..356a2b9 --- /dev/null +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -0,0 +1,121 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +/ { + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc"; + model = "SamKnows Whitebox 8"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x400>; + }; +
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
Yeah I think that wants a RW filesystem, haha. My apologies in advance to all other ramips devices, then, I’ll add an init.d script for ./target/linux/ramips/base-files/etc/init.d/S99bootcount to do this. On Tue, Apr 26, 2016 at 2:35 PM, John Crispin <blo...@openwrt.org> wrote: > ok, this might not work, just move it to the init.d folder > > > On 26/04/2016 08:31, Andrew Yong wrote: >> Alright. >> >> Is it acceptable to call `. /lib/functions/uci-defaults.sh` in a preinit >> file? >> >> If it does not violate the sanctity of any OpenWrt init conventions, >> I’ll do that and test drive it. >> >> On Tue, Apr 26, 2016 at 2:06 PM, John Crispin <j...@phrozen.org> wrote: >>> >>> >>> On 26/04/2016 03:24, Andrew Yong wrote: >>>> "alternatively call uboot-env directly without the fw_* abstraction layer" >>>> >>>> Pardon the obtuse question but how would I go about doing this? It >>>> sounds like the cleanest way to do things. >>>> >>>> I'd like to avoid calling uci-default earlier than it needs to be, and >>>> potentially messing up other things in the init process. >>>> >>>> If there really isn't an OpenWrt-approved way to do this, I may just >>>> advocate replacing SamKnows' u-boot entirely (writing to the same >>>> partition every boot seems bad for flash memory anyway). >>> >>> >>> replacing uboot is not a good idea. you should try to make this work in >>> the prei8nit step. if the fw_setenv call fails then figure out why and >>> try to fix it. >>> >>> >>>> >>>> On Tue, Apr 26, 2016 at 12:32 AM, John Crispin <j...@phrozen.org> wrote: >>>>> >>>>> >>>>> On 25/04/2016 18:01, Andrew Yong wrote: >>>>>> diff --git >>>>>> a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>>>> b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>>>> new file mode 100644 >>>>>> index 000..570fe16 >>>>>> --- /dev/null >>>>>> +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>>>> @@ -0,0 +1,22 @@ >>>>>> +#!/bin/sh >>>>>> + >>>>>> +# SamKnows Whitebox 8 increments a bootcount variable every boot and >>>>>> attempts >>>>>> +# to boot a recovery partition when bootcount > 3. We need to ensure >>>>>> this is >>>>>> +# reset to 0 every boot >>>>>> + >>>>>> +do_bootcount_reset() { >>>>>> + . /lib/ramips.sh >>>>>> + >>>>>> + local board=$(ramips_board_name) >>>>>> + >>>>>> + case "$board" in >>>>>> + sk-wb8) >>>>>> + echo "Board is SamKnows Whitebox 8, resetting bootcount >>>>>> environment variable..." >>>>>> + fw_setenv bootcount 0 >>>>>> + ;; >>>>>> + esac >>>>>> + >>>>>> + return 0 >>>>>> +} >>>>>> + >>>>>> +boot_hook_add preinit_main do_bootcount_reset >>>>> >>>>> >>>>> does this actually work ? thinking about it, you might need to have >>>>> uci-default run for it to work properly or alternatively call uboot-env >>>>> directly without the fw_* abstraction layer >>>>> >>>>> John >> ___ >> openwrt-devel mailing list >> openwrt-devel@lists.openwrt.org >> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel >> > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
Alright. Is it acceptable to call `. /lib/functions/uci-defaults.sh` in a preinit file? If it does not violate the sanctity of any OpenWrt init conventions, I’ll do that and test drive it. On Tue, Apr 26, 2016 at 2:06 PM, John Crispin <j...@phrozen.org> wrote: > > > On 26/04/2016 03:24, Andrew Yong wrote: >> "alternatively call uboot-env directly without the fw_* abstraction layer" >> >> Pardon the obtuse question but how would I go about doing this? It >> sounds like the cleanest way to do things. >> >> I'd like to avoid calling uci-default earlier than it needs to be, and >> potentially messing up other things in the init process. >> >> If there really isn't an OpenWrt-approved way to do this, I may just >> advocate replacing SamKnows' u-boot entirely (writing to the same >> partition every boot seems bad for flash memory anyway). > > > replacing uboot is not a good idea. you should try to make this work in > the prei8nit step. if the fw_setenv call fails then figure out why and > try to fix it. > > >> >> On Tue, Apr 26, 2016 at 12:32 AM, John Crispin <j...@phrozen.org> wrote: >>> >>> >>> On 25/04/2016 18:01, Andrew Yong wrote: >>>> diff --git >>>> a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>> b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>> new file mode 100644 >>>> index 000..570fe16 >>>> --- /dev/null >>>> +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >>>> @@ -0,0 +1,22 @@ >>>> +#!/bin/sh >>>> + >>>> +# SamKnows Whitebox 8 increments a bootcount variable every boot and >>>> attempts >>>> +# to boot a recovery partition when bootcount > 3. We need to ensure this >>>> is >>>> +# reset to 0 every boot >>>> + >>>> +do_bootcount_reset() { >>>> + . /lib/ramips.sh >>>> + >>>> + local board=$(ramips_board_name) >>>> + >>>> + case "$board" in >>>> + sk-wb8) >>>> + echo "Board is SamKnows Whitebox 8, resetting bootcount >>>> environment variable..." >>>> + fw_setenv bootcount 0 >>>> + ;; >>>> + esac >>>> + >>>> + return 0 >>>> +} >>>> + >>>> +boot_hook_add preinit_main do_bootcount_reset >>> >>> >>> does this actually work ? thinking about it, you might need to have >>> uci-default run for it to work properly or alternatively call uboot-env >>> directly without the fw_* abstraction layer >>> >>> John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
"alternatively call uboot-env directly without the fw_* abstraction layer" Pardon the obtuse question but how would I go about doing this? It sounds like the cleanest way to do things. I'd like to avoid calling uci-default earlier than it needs to be, and potentially messing up other things in the init process. If there really isn't an OpenWrt-approved way to do this, I may just advocate replacing SamKnows' u-boot entirely (writing to the same partition every boot seems bad for flash memory anyway). On Tue, Apr 26, 2016 at 12:32 AM, John Crispin <j...@phrozen.org> wrote: > > > On 25/04/2016 18:01, Andrew Yong wrote: >> diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >> b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >> new file mode 100644 >> index 000..570fe16 >> --- /dev/null >> +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount >> @@ -0,0 +1,22 @@ >> +#!/bin/sh >> + >> +# SamKnows Whitebox 8 increments a bootcount variable every boot and >> attempts >> +# to boot a recovery partition when bootcount > 3. We need to ensure this is >> +# reset to 0 every boot >> + >> +do_bootcount_reset() { >> + . /lib/ramips.sh >> + >> + local board=$(ramips_board_name) >> + >> + case "$board" in >> + sk-wb8) >> + echo "Board is SamKnows Whitebox 8, resetting bootcount >> environment variable..." >> + fw_setenv bootcount 0 >> + ;; >> + esac >> + >> + return 0 >> +} >> + >> +boot_hook_add preinit_main do_bootcount_reset > > > does this actually work ? thinking about it, you might need to have > uci-default run for it to work properly or alternatively call uboot-env > directly without the fw_* abstraction layer > > John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
Hopefully third time's the charm: PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index bd0ff05..534cc1c 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -76,6 +76,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount new file mode 100644 index 000..570fe16 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount @@ -0,0 +1,22 @@ +#!/bin/sh + +# SamKnows Whitebox 8 increments a bootcount variable every boot and attempts +# to boot a recovery partition when bootcount > 3. We need to ensure this is +# reset to 0 every boot + +do_bootcount_reset() { + . /lib/ramips.sh + + local board=$(ramips_board_name) + + case "$board" in + sk-wb8) + echo "Board is SamKnows Whitebox 8, resetting bootcount environment variable..." + fw_setenv bootcount 0 + ;; + esac + + return 0 +} + +boot_hook_add preinit_main do_bootcount_reset diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..5c1715d 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -367,6 +367,9 @@ ramips_board_detect() { *"RUT5XX") name="rut5xx" ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; *"SAP-G3200U3") name="sap-g3200u3" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/t
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
Working on my email client choice. Anyway, preinit seems to be before fw_setenv gets its bearings: Board is SamKnows Whitebox 8, resetting bootcount environment variable... Cannot parse config file: No such file or directory Error: environment not initialized Router still soft bricks after 3 reboots because the counter doesn't get reset. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
+ + }; + }; + }; + + pcie@1e14 { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = < 0x>; + mediatek,5ghz = <0>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = < 0x8000>; + mediatek,2ghz = <0>; + }; + }; + }; + + ethernet@1e10 { + mtd-mac-address = < 0xe000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "sk-wb8:green:wps"; + gpios = < 14 1>; + }; + + usb { + label = "sk-wb8:green:usb"; + gpios = < 15 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + wps { + label = "wps"; + gpios = < 11 1>; + linux,code = <0x211>; + }; + reset { + label = "reset"; + gpios = < 9 1>; + linux,code = <0x198>; + }; + }; + + pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + ralink,function = "gpio"; + }; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 0af9596..3e2f7eb 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -132,6 +132,12 @@ define Device/ubnt-erx endef TARGET_DEVICES += ubnt-erx +define Device/sk-wb8 + DTS := SK-WB8 + IMAGE_SIZE := $(ralink_default_fw_size_16M) +endef +TARGET_DEVICES += sk-wb8 + # FIXME: is this still needed? define Image/Prepare #define Build/Compile diff --git a/target/linux/ramips/mt7621/profiles/sk-wb8.mk b/target/linux/ramips/mt7621/profiles/sk-wb8.mk new file mode 100644 index 000..4b22ef3 --- /dev/null +++ b/target/linux/ramips/mt7621/profiles/sk-wb8.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/SK-WB8 + NAME:=SK-WB8 Profile + PACKAGES:=\ + kmod-usb-core kmod-usb3 \ + kmod-ledtrig-usbdev uboot-envtools +endef + +define Profile/SK-WB8/Description + Package set optimized for the SamKnows SK-WB8. +endef +$(eval $(call Profile,SK-WB8)) On Mon, Apr 25, 2016 at 10:51 PM, Andrew Yong <m...@ndoo.sg> wrote: > PATCHv1: > This patch adds support for the SamKnows version 8.0 Whitebox, built > around the MT7621 platform. 2.4GHz appears to be working, albeit > poorly; 5GHz not working yet. > > PATCHv2: > Fixed LED name in DTS. > > PATCHv3: > DTS: Syntax error fixed, LEDs and buttons mapped correctly now > - diag.sh updated to blink WPS LED on boot > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset > matches SamKnows firmware > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware > > PATCHv4: > - I didn't commit some fixes in PATCHv3, that's fixed now > > PATCHv5: > - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter > to prevent soft brick by booting into nonexistent backup partition > - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, > needs further investigation, effective txpower is still 0) > - Experimenting on wifi but that'll be a future patch, board boots fine now. > > Signed-off-by: Andrew Yong <m...@ndoo.sg> > > diff --git a/package/boot/uboot-envtools/files/ramips > b/package/boot/uboot-envtools/files/ramips > index a759bcc..9ad5974 100644 > --- a/package/boot/uboot-envtools/files/ramips > +++ b/package/boot/uboot-envtools/files/ramips > @@ -24,7 +24,8 @@ linkits7688d | \ > wsr-600 | \ > wsr-1166 | \ > br6425 | \ > -miwifi-nano) > +miwifi-nano | \ > +sk-wb8) > ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" > ;; > esac > 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 e3b8500..df30085 100755 > --- a/target/linux/ramips/base-files/etc/board.d/01_leds > +++ b/target/linux/ramips/base-files/etc/board.d/01_leds > @@ -241,6 +241,9 @@ rt-n14u) > set_wifi_led "$board:blue:air" > set_usb_led "$board:blue:usb" > ;; > +sk-wb8) > + set_usb_led "$board:green:usb" > + ;; > tiny-ac) > set_wifi_led "$board:orange:wifi" > set_usb_led "$board:green:usb" > 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 3c958ae..3e876d2 100755 > --- a/target/linux/ramips/base-files/etc/board.d/02_network > +++ b/target/linux/ramip
[OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
PATCHv1: This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. PATCHv2: Fixed LED name in DTS. PATCHv3: DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware PATCHv4: - I didn't commit some fixes in PATCHv3, that's fixed now PATCHv5: - Added preinit hook to reset SamKnows Whitebox 8 u-boot boot counter to prevent soft brick by booting into nonexistent backup partition - Broke 2.4GHz WiFi but 5GHz sorta works (swapped pcie0/1 in DTS, needs further investigation, effective txpower is still 0) - Experimenting on wifi but that'll be a future patch, board boots fine now. Signed-off-by: Andrew Yong <m...@ndoo.sg> diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index a759bcc..9ad5974 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ linkits7688d | \ wsr-600 | \ wsr-1166 | \ br6425 | \ -miwifi-nano) +miwifi-nano | \ +sk-wb8) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1" ;; esac 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index bd0ff05..534cc1c 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -76,6 +76,7 @@ get_status_led() { ;; awapn2403|\ dir-645|\ + sk-wb8|\ wrh-300cr) status_led="$board:green:wps" ;; diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount new file mode 100644 index 000..570fe16 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount @@ -0,0 +1,22 @@ +#!/bin/sh + +# SamKnows Whitebox 8 increments a bootcount variable every boot and attempts +# to boot a recovery partition when bootcount > 3. We need to ensure this is +# reset to 0 every boot + +do_bootcount_reset() { + . /lib/ramips.sh + + local board=$(ramips_board_name) + + case "$board" in + sk-wb8) + echo "Board is SamKnows Whitebox 8, resetting bootcount environment variable..." + fw_setenv bootcount 0 + ;; + esac + + return 0 +} + +boot_hook_add preinit_main do_bootcount_reset diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..5c1715d 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -367,6 +367,9 @@ ramips_board_detect() { *"RUT5XX") name="rut5xx" ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; *"SAP-G3200U3") name="sap-g3200u3" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/
Re: [OpenWrt-Devel] [PATCHv4] ramips: add support for SamKnows SK-WB8
Stupid question - what calls these files? I assume I have to call my new function from somewhere. I'm working on it. On Mon, Apr 25, 2016 at 9:22 PM, John Crispin <j...@phrozen.org> wrote: > > > On 25/04/2016 15:18, Andrew Yong wrote: >> I have just found out that I need to perform this additional step on >> this SamKnows Whitebox 8 every boot: >> >> /usr/sbin/fw_setenv bootcount 0 >> >> Where would be an appropriate place to put this? I could add (yet >> another) init script in ./target/linux/ramips/base-files/etc/init.d >> with START=99 (this is how SamKnows does it) and add a check >> against $(ramips_board_name). > > look at > target/linux/ramips/base-files/lib/preinit/04_handle_checksumming and > add a target/linux/ramips/base-files/lib/preinit/04_handle_bootcount > using a similar pattern please > > John > > >> >> Without this, SamKnows' custom u-boot will attempt to boot from a backup >> partition after bootcount exceeds 3 (3 "failed" boots). >> >> For an end-user without TTL serial access, it would be a soft brick. >> >> I'm cleaning up the rest of the patches, fixed some minor gpio >> mis-definitions and testing out some wifi fixes before I do a v5. >> > > > >> On 25 Apr 2016 20:58, "John Crispin" <j...@phrozen.org >> <mailto:j...@phrozen.org>> wrote: >> >> Hi, >> >> few comments inline. apart from those 2 nitpicks the patch looks good. >> >> John >> >> On 25/04/2016 03:05, Andrew Yong wrote: >> > This patch adds support for the SamKnows version 8.0 Whitebox, built >> > around the MT7621 platform. 2.4GHz appears to be working, albeit >> > poorly; 5GHz not working yet. >> > >> > Fixed in v4: >> > - I didn't commit some fixes in PATCHv3, that's fixed now >> > - DTS: Syntax error fixed, LEDs and buttons mapped correctly now >> > - diag.sh updated to blink WPS LED on boot >> > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset >> > matches SamKnows firmware >> > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware >> > >> > Initial support for SamKnows SK-WB8 >> > >> > Signed-off-by: Andrew Yong <m...@ndoo.sg <mailto:m...@ndoo.sg>> >> > >> > 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 e3b8500..df30085 100755 >> > --- a/target/linux/ramips/base-files/etc/board.d/01_leds >> > +++ b/target/linux/ramips/base-files/etc/board.d/01_leds >> > @@ -241,6 +241,9 @@ rt-n14u) >> > set_wifi_led "$board:blue:air" >> > set_usb_led "$board:blue:usb" >> > ;; >> > +sk-wb8) >> > + set_usb_led "$board:green:usb" >> > + ;; >> > tiny-ac) >> > set_wifi_led "$board:orange:wifi" >> > set_usb_led "$board:green:usb" >> > 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 3c958ae..3e876d2 100755 >> > --- a/target/linux/ramips/base-files/etc/board.d/02_network >> > +++ b/target/linux/ramips/base-files/etc/board.d/02_network >> > @@ -77,6 +77,7 @@ ramips_setup_interfaces() >> > pbr-m1|\ >> > psg1208|\ >> > sap-g3200u3|\ >> > + sk-wb8|\ >> > wf-2881|\ >> > whr-300hp2|\ >> > whr-600d|\ >> > @@ -310,6 +311,9 @@ ramips_setup_macs() >> > lan_mac=$(macaddr_setbit_la "$lan_mac") >> > wan_mac=$(mtd_get_mac_binary factory 32772) >> > ;; >> > + sk-wb8) >> > + wan_mac=$(mtd_get_mac_binary factory 57350) >> > + ;; >> > tew-691gr) >> > lan_mac=$(cat /sys/class/net/eth0/address) >> > wan_mac=$(macaddr_add "$lan_mac" 3) >> > diff --git a/target/linux/ramips/base-files/etc/diag.sh >> > b/target/linux/ramips/base-files/etc/diag.sh >> > index bd0ff05..a941fca 100644 >> > --- a/target/linux/ramips/
Re: [OpenWrt-Devel] [PATCHv4] ramips: add support for SamKnows SK-WB8
I have just found out that I need to perform this additional step on this SamKnows Whitebox 8 every boot: /usr/sbin/fw_setenv bootcount 0 Where would be an appropriate place to put this? I could add (yet another) init script in ./target/linux/ramips/base-files/etc/init.d with START=99 (this is how SamKnows does it) and add a check against $(ramips_board_name). Without this, SamKnows' custom u-boot will attempt to boot from a backup partition after bootcount exceeds 3 (3 "failed" boots). For an end-user without TTL serial access, it would be a soft brick. I'm cleaning up the rest of the patches, fixed some minor gpio mis-definitions and testing out some wifi fixes before I do a v5. On 25 Apr 2016 20:58, "John Crispin" <j...@phrozen.org> wrote: Hi, few comments inline. apart from those 2 nitpicks the patch looks good. John On 25/04/2016 03:05, Andrew Yong wrote: > This patch adds support for the SamKnows version 8.0 Whitebox, built > around the MT7621 platform. 2.4GHz appears to be working, albeit > poorly; 5GHz not working yet. > > Fixed in v4: > - I didn't commit some fixes in PATCHv3, that's fixed now > - DTS: Syntax error fixed, LEDs and buttons mapped correctly now > - diag.sh updated to blink WPS LED on boot > - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset > matches SamKnows firmware > - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware > > Initial support for SamKnows SK-WB8 > > Signed-off-by: Andrew Yong <m...@ndoo.sg> > > 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 e3b8500..df30085 100755 > --- a/target/linux/ramips/base-files/etc/board.d/01_leds > +++ b/target/linux/ramips/base-files/etc/board.d/01_leds > @@ -241,6 +241,9 @@ rt-n14u) > set_wifi_led "$board:blue:air" > set_usb_led "$board:blue:usb" > ;; > +sk-wb8) > + set_usb_led "$board:green:usb" > + ;; > tiny-ac) > set_wifi_led "$board:orange:wifi" > set_usb_led "$board:green:usb" > 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 3c958ae..3e876d2 100755 > --- a/target/linux/ramips/base-files/etc/board.d/02_network > +++ b/target/linux/ramips/base-files/etc/board.d/02_network > @@ -77,6 +77,7 @@ ramips_setup_interfaces() > pbr-m1|\ > psg1208|\ > sap-g3200u3|\ > + sk-wb8|\ > wf-2881|\ > whr-300hp2|\ > whr-600d|\ > @@ -310,6 +311,9 @@ ramips_setup_macs() > lan_mac=$(macaddr_setbit_la "$lan_mac") > wan_mac=$(mtd_get_mac_binary factory 32772) > ;; > + sk-wb8) > + wan_mac=$(mtd_get_mac_binary factory 57350) > + ;; > tew-691gr) > lan_mac=$(cat /sys/class/net/eth0/address) > wan_mac=$(macaddr_add "$lan_mac" 3) > diff --git a/target/linux/ramips/base-files/etc/diag.sh > b/target/linux/ramips/base-files/etc/diag.sh > index bd0ff05..a941fca 100644 > --- a/target/linux/ramips/base-files/etc/diag.sh > +++ b/target/linux/ramips/base-files/etc/diag.sh > @@ -76,7 +76,8 @@ get_status_led() { > ;; > awapn2403|\ > dir-645|\ > - wrh-300cr) > + wrh-300cr|\ > + sk-wb8) alphabetic ordering please > status_led="$board:green:wps" > ;; > cf-wr800n|\ > diff --git a/target/linux/ramips/base-files/lib/ramips.sh > b/target/linux/ramips/base-files/lib/ramips.sh > index 550ec55..4f1bd41 100755 > --- a/target/linux/ramips/base-files/lib/ramips.sh > +++ b/target/linux/ramips/base-files/lib/ramips.sh > @@ -370,6 +370,9 @@ ramips_board_detect() { > *"SAP-G3200U3") > name="sap-g3200u3" > ;; > + *"SamKnows Whitebox 8") > + name="sk-wb8" > + ;; alphabetic ordering please > *"SL-R7205"*) > name="sl-r7205" > ;; > diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh > b/target/linux/ramips/base-files/lib/upgrade/platform.sh > index 73ba6e6..fcc1b79 100755 > --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh > +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh > @@ -109,6 +109,7 @@ platform_check_image() { > rt-n56u|\ > rut5xx|\ > sap-g3200u3|\ > + sk-wb8|\ > sl-r7205|\ > tew-691gr|\ >
[OpenWrt-Devel] [PATCHv4] ramips: add support for SamKnows SK-WB8
This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. Fixed in v4: - I didn't commit some fixes in PATCHv3, that's fixed now - DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware Initial support for SamKnows SK-WB8 Signed-off-by: Andrew Yong <m...@ndoo.sg> 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index bd0ff05..a941fca 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -76,7 +76,8 @@ get_status_led() { ;; awapn2403|\ dir-645|\ - wrh-300cr) + wrh-300cr|\ + sk-wb8) status_led="$board:green:wps" ;; cf-wr800n|\ diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..4f1bd41 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -370,6 +370,9 @@ ramips_board_detect() { *"SAP-G3200U3") name="sap-g3200u3" ;; + *"SamKnows Whitebox 8") + name="sk-wb8" + ;; *"SL-R7205"*) name="sl-r7205" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -109,6 +109,7 @@ platform_check_image() { rt-n56u|\ rut5xx|\ sap-g3200u3|\ + sk-wb8|\ sl-r7205|\ tew-691gr|\ tew-692gr|\ diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts new file mode 100644 index 000..3292194 --- /dev/null +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -0,0 +1,122 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +/ { + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc"; + model = "SamKnows SK-WB8"; + + 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; + }; + + partiti
[OpenWrt-Devel] [PATCHv3] ramips: add support for SamKnows SK-WB8
This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit > poorly; 5GHz not working yet. Fixed in v3: - DTS: Syntax error fixed, LEDs and buttons mapped correctly now - diag.sh updated to blink WPS LED on boot - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset matches SamKnows firmware - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware Initial support for SamKnows SK-WB8 Signed-off-by: Andrew Yong <m...@ndoo.sg> 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..0997cc8 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -370,6 +370,9 @@ ramips_board_detect() { *"SAP-G3200U3") name="sap-g3200u3" ;; + *"SK-WB8") + name="sk-wb8" + ;; *"SL-R7205"*) name="sl-r7205" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -109,6 +109,7 @@ platform_check_image() { rt-n56u|\ rut5xx|\ sap-g3200u3|\ + sk-wb8|\ sl-r7205|\ tew-691gr|\ tew-692gr|\ diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts new file mode 100644 index 000..ce25c7a --- /dev/null +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -0,0 +1,121 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +/ { + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc"; + model = "SamKnows SK-WB8"; + + 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; + }; + +
[OpenWrt-Devel] [PATCHv2] ramips: add support for SamKnows SK-WB8
This patch adds support for the SamKnows version 8.0 Whitebox, built around the MT7621 platform. 2.4GHz appears to be working, albeit poorly; 5GHz not working yet. Changes from v1: Fixed LED name in DTS. Initial support for SamKnows SK-WB8 Signed-off-by: Andrew Yong <m...@ndoo.sg> 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 e3b8500..df30085 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -241,6 +241,9 @@ rt-n14u) set_wifi_led "$board:blue:air" set_usb_led "$board:blue:usb" ;; +sk-wb8) + set_usb_led "$board:green:usb" + ;; tiny-ac) set_wifi_led "$board:orange:wifi" set_usb_led "$board:green:usb" 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 3c958ae..3e876d2 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ ramips_setup_interfaces() pbr-m1|\ psg1208|\ sap-g3200u3|\ + sk-wb8|\ wf-2881|\ whr-300hp2|\ whr-600d|\ @@ -310,6 +311,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; tew-691gr) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 3) diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 550ec55..0997cc8 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -370,6 +370,9 @@ ramips_board_detect() { *"SAP-G3200U3") name="sap-g3200u3" ;; + *"SK-WB8") + name="sk-wb8" + ;; *"SL-R7205"*) name="sl-r7205" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 73ba6e6..fcc1b79 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -109,6 +109,7 @@ platform_check_image() { rt-n56u|\ rut5xx|\ sap-g3200u3|\ + sk-wb8|\ sl-r7205|\ tew-691gr|\ tew-692gr|\ diff --git a/target/linux/ramips/dts/SK-WB8.dts b/target/linux/ramips/dts/SK-WB8.dts new file mode 100644 index 000..e783374 --- /dev/null +++ b/target/linux/ramips/dts/SK-WB8.dts @@ -0,0 +1,121 @@ +/dts-v1/; + +/include/ "mt7621.dtsi" + +/ { + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc"; + model = "SamKnows SK-WB8"; + + 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>; + }; + + }; +