<div dir="ltr"><p dir="ltr">I have just found out that I need to perform this additional step on this SamKnows Whitebox 8 every boot:</p><p dir="ltr">/usr/sbin/fw_setenv bootcount 0</p><p>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 <span style="font-size:12.8px">START=99 (this is how SamKnows does it) and add a check against $(ramips_board_name).</span></p>Without this, SamKnows' custom u-boot will attempt to boot from a backup partition after bootcount exceeds 3 (3 "failed" boots).<div><br></div><div>For an end-user without TTL serial access, it would be a soft brick.<br><p>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.</p>
<div class="gmail_quote">On 25 Apr 2016 20:58, "John Crispin" <<a href="mailto:john@phrozen.org" target="_blank">john@phrozen.org</a>> wrote:<br type="attribution"><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
few comments inline. apart from those 2 nitpicks the patch looks good.<br>
<br>
John<br>
<div><br>
On 25/04/2016 03:05, Andrew Yong wrote:<br>
> This patch adds support for the SamKnows version 8.0 Whitebox, built<br>
> around the MT7621 platform. 2.4GHz appears to be working, albeit<br>
> poorly; 5GHz not working yet.<br>
><br>
> Fixed in v4:<br>
> - I didn't commit some fixes in PATCHv3, that's fixed now<br>
> - DTS: Syntax error fixed, LEDs and buttons mapped correctly now<br>
> - diag.sh updated to blink WPS LED on boot<br>
> - 2.4GHz wifi is working but txpower is stuck at 0, DTS ROM offset<br>
> matches SamKnows firmware<br>
> - 5GHz wifi not working, DTS pcie1,0 matches SamKnows firmware<br>
><br>
> Initial support for SamKnows SK-WB8<br>
><br>
> Signed-off-by: Andrew Yong <<a href="mailto:me@ndoo.sg" target="_blank">me@ndoo.sg</a>><br>
><br>
> diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds<br>
> b/target/linux/ramips/base-files/etc/board.d/01_leds<br>
> index e3b8500..df30085 100755<br>
> --- a/target/linux/ramips/base-files/etc/board.d/01_leds<br>
> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds<br>
> @@ -241,6 +241,9 @@ rt-n14u)<br>
> set_wifi_led "$board:blue:air"<br>
> set_usb_led "$board:blue:usb"<br>
> ;;<br>
> +sk-wb8)<br>
> + set_usb_led "$board:green:usb"<br>
> + ;;<br>
> tiny-ac)<br>
> set_wifi_led "$board:orange:wifi"<br>
> set_usb_led "$board:green:usb"<br>
> diff --git a/target/linux/ramips/base-files/etc/board.d/02_network<br>
> b/target/linux/ramips/base-files/etc/board.d/02_network<br>
> index 3c958ae..3e876d2 100755<br>
> --- a/target/linux/ramips/base-files/etc/board.d/02_network<br>
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network<br>
> @@ -77,6 +77,7 @@ ramips_setup_interfaces()<br>
> pbr-m1|\<br>
> psg1208|\<br>
> sap-g3200u3|\<br>
> + sk-wb8|\<br>
> wf-2881|\<br>
> whr-300hp2|\<br>
> whr-600d|\<br>
> @@ -310,6 +311,9 @@ ramips_setup_macs()<br>
> lan_mac=$(macaddr_setbit_la "$lan_mac")<br>
> wan_mac=$(mtd_get_mac_binary factory 32772)<br>
> ;;<br>
> + sk-wb8)<br>
> + wan_mac=$(mtd_get_mac_binary factory 57350)<br>
> + ;;<br>
> tew-691gr)<br>
> lan_mac=$(cat /sys/class/net/eth0/address)<br>
> wan_mac=$(macaddr_add "$lan_mac" 3)<br>
> diff --git a/target/linux/ramips/base-files/etc/diag.sh<br>
> b/target/linux/ramips/base-files/etc/diag.sh<br>
> index bd0ff05..a941fca 100644<br>
> --- a/target/linux/ramips/base-files/etc/diag.sh<br>
> +++ b/target/linux/ramips/base-files/etc/diag.sh<br>
> @@ -76,7 +76,8 @@ get_status_led() {<br>
> ;;<br>
> awapn2403|\<br>
> dir-645|\<br>
> - wrh-300cr)<br>
> + wrh-300cr|\<br>
> + sk-wb8)<br>
<br>
</div>alphabetic ordering please<br>
<div><br>
> status_led="$board:green:wps"<br>
> ;;<br>
> cf-wr800n|\<br>
> diff --git a/target/linux/ramips/base-files/lib/ramips.sh<br>
> b/target/linux/ramips/base-files/lib/ramips.sh<br>
> index 550ec55..4f1bd41 100755<br>
> --- a/target/linux/ramips/base-files/lib/ramips.sh<br>
> +++ b/target/linux/ramips/base-files/lib/ramips.sh<br>
> @@ -370,6 +370,9 @@ ramips_board_detect() {<br>
> *"SAP-G3200U3")<br>
> name="sap-g3200u3"<br>
> ;;<br>
> + *"SamKnows Whitebox 8")<br>
> + name="sk-wb8"<br>
> + ;;<br>
<br>
</div>alphabetic ordering please<br>
<div><br>
> *"SL-R7205"*)<br>
> name="sl-r7205"<br>
> ;;<br>
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh<br>
> b/target/linux/ramips/base-files/lib/upgrade/platform.sh<br>
> index 73ba6e6..fcc1b79 100755<br>
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh<br>
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh<br>
> @@ -109,6 +109,7 @@ platform_check_image() {<br>
> rt-n56u|\<br>
> rut5xx|\<br>
> sap-g3200u3|\<br>
> + sk-wb8|\<br>
> sl-r7205|\<br>
> tew-691gr|\<br>
> tew-692gr|\<br>
> diff --git a/target/linux/ramips/dts/SK-WB8.dts<br>
> b/target/linux/ramips/dts/SK-WB8.dts<br>
> new file mode 100644<br>
> index 0000000..3292194<br>
> --- /dev/null<br>
> +++ b/target/linux/ramips/dts/SK-WB8.dts<br>
> @@ -0,0 +1,122 @@<br>
> +/dts-v1/;<br>
> +<br>
> +#include "mt7621.dtsi"<br>
> +<br>
> +/ {<br>
> + compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc";<br>
> + model = "SamKnows SK-WB8";<br>
> +<br>
> + memory@0 {<br>
> + device_type = "memory";<br>
> + reg = <0x0 0x4000000>;<br>
> + };<br>
> +<br>
> + chosen {<br>
> + bootargs = "console=ttyS0,57600";<br>
> + };<br>
> +<br>
> + palmbus@1E000000 {<br>
> + spi@b00 {<br>
> + status = "okay";<br>
> +<br>
> + m25p80@0 {<br>
> + #address-cells = <1>;<br>
> + #size-cells = <1>;<br>
> + compatible = "mx25l6405d";<br>
> + reg = <0 0>;<br>
> + linux,modalias = "m25p80";<br>
> + spi-max-frequency = <10000000>;<br>
> +<br>
> + partition@0 {<br>
> + label = "u-boot";<br>
> + reg = <0x0 0x30000>;<br>
> + read-only;<br>
> + };<br>
> +<br>
> + partition@30000 {<br>
> + label = "u-boot-env";<br>
> + reg = <0x30000 0x10000>;<br>
> + read-only;<br>
> + };<br>
> +<br>
> + factory: partition@40000 {<br>
> + label = "factory";<br>
> + reg = <0x40000 0x10000>;<br>
> + read-only;<br>
> + };<br>
> +<br>
> + partition@50000 {<br>
> + label = "firmware";<br>
> + reg = <0x50000 0x7b0000>;<br>
> + };<br>
> +<br>
> + };<br>
> + };<br>
> + };<br>
> +<br>
> + pcie@1e140000 {<br>
> + status = "okay";<br>
> +<br>
> + pcie0 {<br>
> + mt76@0,0 {<br>
> + reg = <0x0000 0 0 0 0>;<br>
> + device_type = "pci";<br>
> + mediatek,mtd-eeprom = <&factory 0x8000>;<br>
> + mediatek,2ghz = <0>;<br>
> + };<br>
> + };<br>
> +<br>
> + pcie1 {<br>
> + mt76@1,0 {<br>
> + reg = <0x0000 0 0 0 0>;<br>
> + device_type = "pci";<br>
> + mediatek,mtd-eeprom = <&factory 0x0000>;<br>
> + mediatek,5ghz = <0>;<br>
> + };<br>
> + };<br>
> + };<br>
> +<br>
> + ethernet@1e100000 {<br>
> + mtd-mac-address = <&factory 0xe000>;<br>
> + };<br>
> +<br>
> + gpio-leds {<br>
> + compatible = "gpio-leds";<br>
> +<br>
> + wps {<br>
> + label = "sk-wb8:green:wps";<br>
> + gpios = <&gpio1 14 1>;<br>
> + };<br>
> +<br>
> + usb {<br>
> + label = "sk-wb8:green:usb";<br>
> + gpios = <&gpio1 15 1>;<br>
> + };<br>
> + };<br>
> +<br>
> + gpio-keys-polled {<br>
> + compatible = "gpio-keys-polled";<br>
> + #address-cells = <1>;<br>
> + #size-cells = <0>;<br>
> + poll-interval = <20>;<br>
> + wps {<br>
> + label = "wps";<br>
> + gpios = <&gpio1 11 1>;<br>
> + linux,code = <0x211>;<br>
> + };<br>
> + reset {<br>
> + label = "reset";<br>
> + gpios = <&gpio1 9 1>;<br>
> + linux,code = <0x198>;<br>
> + };<br>
> + };<br>
> +<br>
> + pinctrl {<br>
> + state_default: pinctrl0 {<br>
> + gpio {<br>
> + ralink,group = "i2c", "uart2",<br>
> "uart3", "rgmii2", "sdhci";<br>
> + ralink,function = "gpio";<br>
> + };<br>
> + };<br>
> + };<br>
> +};<br>
> diff --git a/target/linux/ramips/image/<a href="http://mt7621.mk" rel="noreferrer" target="_blank">mt7621.mk</a><br>
> b/target/linux/ramips/image/<a href="http://mt7621.mk" rel="noreferrer" target="_blank">mt7621.mk</a><br>
> index 0af9596..3e2f7eb 100644<br>
> --- a/target/linux/ramips/image/<a href="http://mt7621.mk" rel="noreferrer" target="_blank">mt7621.mk</a><br>
> +++ b/target/linux/ramips/image/<a href="http://mt7621.mk" rel="noreferrer" target="_blank">mt7621.mk</a><br>
> @@ -132,6 +132,12 @@ define Device/ubnt-erx<br>
> endef<br>
> TARGET_DEVICES += ubnt-erx<br>
><br>
> +define Device/sk-wb8<br>
> + DTS := SK-WB8<br>
> + IMAGE_SIZE := $(ralink_default_fw_size_16M)<br>
> +endef<br>
> +TARGET_DEVICES += sk-wb8<br>
> +<br>
> # FIXME: is this still needed?<br>
> define Image/Prepare<br>
> #define Build/Compile<br>
> diff --git a/target/linux/ramips/mt7621/profiles/<a href="http://sk-wb8.mk" rel="noreferrer" target="_blank">sk-wb8.mk</a><br>
> b/target/linux/ramips/mt7621/profiles/<a href="http://sk-wb8.mk" rel="noreferrer" target="_blank">sk-wb8.mk</a><br>
> new file mode 100644<br>
> index 0000000..efa4858<br>
> --- /dev/null<br>
> +++ b/target/linux/ramips/mt7621/profiles/<a href="http://sk-wb8.mk" rel="noreferrer" target="_blank">sk-wb8.mk</a><br>
> @@ -0,0 +1,18 @@<br>
> +#<br>
> +# Copyright (C) 2015 OpenWrt.org<br>
> +#<br>
> +# This is free software, licensed under the GNU General Public License v2.<br>
> +# See /LICENSE for more information.<br>
> +#<br>
> +<br>
> +define Profile/SK-WB8<br>
> + NAME:=SK-WB8 Profile<br>
> + PACKAGES:=\<br>
> + kmod-usb-core kmod-usb3 \<br>
> + kmod-ledtrig-usbdev<br>
> +endef<br>
> +<br>
> +define Profile/SK-WB8/Description<br>
> + Package set optimized for the SamKnows SK-WB8.<br>
> +endef<br>
> +$(eval $(call Profile,SK-WB8))<br>
</div><div>> _______________________________________________<br>
> openwrt-devel mailing list<br>
> <a href="mailto:openwrt-devel@lists.openwrt.org" target="_blank">openwrt-devel@lists.openwrt.org</a><br>
> <a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
><br>
</div></blockquote></div>
</div></div>