[PATCH v6 2/2] [v6, 2/2] tools: addfwhrd Linksys E8350v1 FW header genarator

2021-01-24 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile   |   1 +
 tools/firmware-utils/src/addfwhdr.c | 233 
 2 files changed, 234 insertions(+)
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index e4a31b6fd0..34a857c6e5 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -25,6 +25,7 @@ endef
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
$(call cc,add_header)
+   $(call cc,addfwhdr cyg_crc32)
$(call cc,addpattern)
$(call cc,asustrx)
$(call cc,bcm4908asus,-Wall)
diff --git a/tools/firmware-utils/src/addfwhdr.c 
b/tools/firmware-utils/src/addfwhdr.c
new file mode 100644
index 00..ada56e6abf
--- /dev/null
+++ b/tools/firmware-utils/src/addfwhdr.c
@@ -0,0 +1,233 @@
+/*
+   Linksys e8350 v1 firmware header generator
+*/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyg_crc.h"
+#define AC2350  20
+#define USA 1
+
+#if LOCALE == USA
+   #define CYBERTAN_VERSION"v1.0.03"
+   #define SERIAL_NUMBER   "003"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#else   // ETSI
+   #define CYBERTAN_VERSION"v1.0.00"
+   #define SERIAL_NUMBER   "01"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#endif
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+   unsigned int magic; /* "CHDR" */
+   unsigned int len;   /* Length of file including header */
+   unsigned int crc32; /* 32-bit CRC */
+   unsigned int res;
+};
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char   uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short  uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned intuint32;
+#endif
+
+typedef uint32_t cyg_uint32;
+typedef uint16_t cyg_uint16;
+
+extern cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, 
int len);
+//extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+   int opt;
+   int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+   extern char *optarg;
+   extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+   static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+   fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input 

[PATCH v6 1/2] [v6,1/2] ipq806x: add support for Linksys E8350 v1

2021-01-24 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 284f9e2c1d..c196419eb9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -22,6 +22,9 @@ edgecore,ecw5410)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index ddef4b7ac6..036cba2de5 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -69,6 +69,7 @@ qcom,ipq8064-db149)
 ubnt,unifi-ac-hd)
ucidef_set_interface_lan "eth0 eth1"
;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 4dc612492c..7b319a5b7c 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -20,6 +20,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys E8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <&gcc EBI2_CLK>,
+   <&gcc EBI2_AON_CLK>;
+   clock-names = "core", "aon";
+   dmas = <&am

[PATCH v7 2/2] [v7, 2/2] tools: addfwhrd Linksys E8350v1 FW header genarator

2021-01-24 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile   |   1 +
 tools/firmware-utils/src/addfwhdr.c | 233 
 2 files changed, 234 insertions(+)
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index e4a31b6fd0..34a857c6e5 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -25,6 +25,7 @@ endef
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
$(call cc,add_header)
+   $(call cc,addfwhdr cyg_crc32)
$(call cc,addpattern)
$(call cc,asustrx)
$(call cc,bcm4908asus,-Wall)
diff --git a/tools/firmware-utils/src/addfwhdr.c 
b/tools/firmware-utils/src/addfwhdr.c
new file mode 100644
index 00..ada56e6abf
--- /dev/null
+++ b/tools/firmware-utils/src/addfwhdr.c
@@ -0,0 +1,233 @@
+/*
+   Linksys e8350 v1 firmware header generator
+*/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyg_crc.h"
+#define AC2350  20
+#define USA 1
+
+#if LOCALE == USA
+   #define CYBERTAN_VERSION"v1.0.03"
+   #define SERIAL_NUMBER   "003"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#else   // ETSI
+   #define CYBERTAN_VERSION"v1.0.00"
+   #define SERIAL_NUMBER   "01"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#endif
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+   unsigned int magic; /* "CHDR" */
+   unsigned int len;   /* Length of file including header */
+   unsigned int crc32; /* 32-bit CRC */
+   unsigned int res;
+};
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char   uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short  uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned intuint32;
+#endif
+
+typedef uint32_t cyg_uint32;
+typedef uint16_t cyg_uint16;
+
+extern cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, 
int len);
+//extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+   int opt;
+   int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+   extern char *optarg;
+   extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+   static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+   fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input 

[PATCH v7 1/2] [v7,1/2] ipq806x: add support for Linksys E8350 v1

2021-01-24 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 284f9e2c1d..33c7f80fb9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -22,6 +22,9 @@ edgecore,ecw5410)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index ddef4b7ac6..036cba2de5 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -69,6 +69,7 @@ qcom,ipq8064-db149)
 ubnt,unifi-ac-hd)
ucidef_set_interface_lan "eth0 eth1"
;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 4dc612492c..7b319a5b7c 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -20,6 +20,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..872deeb044
--- /dev/null
+++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys E8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <&gcc EBI2_CLK>,
+   <&gcc EBI2_AON_CLK>;
+   clock-names = "core", "aon";
+   dmas = <&adm_dma 3>;
+   dma-names = "rxtx"

[PATCH 0/1] Fix WiFi button off function - fix for bug report FS#3236

2020-07-19 Thread Todor Colov
https://bugs.openwrt.org/index.php?do=details&task_id=3236

Todor Colov (1):
  Fix Wifi Button - off function not working

 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0


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


[PATCH 1/1] Fix Wifi Button - off function not working

2020-07-19 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill 
b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.27.0


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


[PATCH 1/1] tools -> firmware-utils -> Add Linksys E8350 firmware header generator for native openwrt WEB factory image

2020-07-19 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile |   4 +-
 .../src/linksys/e8350/addfwhdr.c  | 195 
 .../src/linksys/e8350/bcmdefs.h   | 318 +
 .../src/linksys/e8350/code_pattern.h  | 396 
 tools/firmware-utils/src/linksys/e8350/crc.c  | 290 
 tools/firmware-utils/src/linksys/e8350/crc.h  |  69 +++
 .../src/linksys/e8350/cyutils.h   | 348 ++
 .../src/linksys/e8350/typedefs.h  | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/e8350/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/e8350/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/e8350/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 3dd9ac5c2c..14b47d1391 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -23,6 +23,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys/e8350
+   $(call cc,linksys/e8350/addfwhdr linksys/e8350/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -97,7 +99,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/e8350/addfwhdr.c 
b/tools/firmware-utils/src/linksys/e8350/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/e8350/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   printf("output file is [%s]\n",output_file); 
break;
+   case 'g' :
+   garbage = 1; break;
+

[PATCH 0/1] tools -> firmware-utils -> add FW header generator for Linksys E8350 native WEB factory image.

2020-07-19 Thread Todor Colov
Add firmware header generator for Linksys E8350 so that openwrt factory image 
can be flashed directly over the stock Linksys WEB interface.

Todor Colov (1):
  tools -> firmware-utils -> Add Linksys E8350 firmware header generator
for native openwrt WEB factory image

 tools/firmware-utils/Makefile |   4 +-
 .../src/linksys/e8350/addfwhdr.c  | 195 
 .../src/linksys/e8350/bcmdefs.h   | 318 +
 .../src/linksys/e8350/code_pattern.h  | 396 
 tools/firmware-utils/src/linksys/e8350/crc.c  | 290 
 tools/firmware-utils/src/linksys/e8350/crc.h  |  69 +++
 .../src/linksys/e8350/cyutils.h   | 348 ++
 .../src/linksys/e8350/typedefs.h  | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/e8350/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/e8350/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/e8350/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/e8350/typedefs.h

-- 
2.27.0


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


[PATCH 0/1] Add new device support under target ipq806x for Linksys E8350

2020-07-19 Thread Todor Colov
*** BLURB HERE ***

Todor Colov (1):
  TARGET: Add new device support under target IPQ806x for Linksys E8350

 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../ipq806x/base-files/etc/rc.button/reset|  44 +++
 .../ipq806x/base-files/lib/upgrade/fwtool.sh  |  67 +
 .../base-files/lib/upgrade/platform.sh|   5 +
 .../arch/arm/boot/dts/qcom-ipq8064-e8350.dts  | 265 ++
 target/linux/ipq806x/image/Makefile   |  31 ++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 8 files changed, 418 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ipq806x/base-files/etc/rc.button/reset
 create mode 100644 target/linux/ipq806x/base-files/lib/upgrade/fwtool.sh
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350.dts

-- 
2.27.0


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


[PATCH 1/1] TARGET: Add new device support under target IPQ806x for Linksys E8350

2020-07-19 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../ipq806x/base-files/etc/rc.button/reset|  44 +++
 .../ipq806x/base-files/lib/upgrade/fwtool.sh  |  67 +
 .../base-files/lib/upgrade/platform.sh|   5 +
 .../arch/arm/boot/dts/qcom-ipq8064-e8350.dts  | 265 ++
 target/linux/ipq806x/image/Makefile   |  31 ++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 8 files changed, 418 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ipq806x/base-files/etc/rc.button/reset
 create mode 100644 target/linux/ipq806x/base-files/lib/upgrade/fwtool.sh
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..892dab88c8 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -11,6 +11,9 @@ board=$(board_name)
 boardname="${board##*,}"
 
 case "$board" in
+linksys,e8350)
+   ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+   ;;
 buffalo,wxr-2533dhp)
ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:white:wireless" 
"phy0tpt"
ucidef_set_led_switch "wan" "WAN" "${boardname}:white:internet" 
"switch0" "0x20"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..60c68da020 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -18,6 +18,7 @@ netgear,d7800 |\
 netgear,r7500 |\
 netgear,r7500v2 |\
 qcom,ipq8064-ap148 |\
+linksys,e8350 |\
 tplink,vr2600v)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
diff --git a/target/linux/ipq806x/base-files/etc/rc.button/reset 
b/target/linux/ipq806x/base-files/etc/rc.button/reset
new file mode 100644
index 00..e6bdcb4cdc
--- /dev/null
+++ b/target/linux/ipq806x/base-files/etc/rc.button/reset
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+. /lib/functions/system.sh
+
+board_config_update
+board=$(board_name)
+
+
+OVERLAY="$( grep ' /overlay ' /proc/mounts )"
+
+case "$ACTION" in
+pressed)
+   [ -z "$OVERLAY" ] && return 0
+
+   return 5
+;;
+timeout)
+   . /etc/diag.sh
+   set_state failsafe
+;;
+released)
+   if [ "$SEEN" -lt 1 ]
+   then
+   echo "REBOOT" > /dev/console
+   sync
+   reboot
+   elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
+   then
+   echo "FACTORY RESET" > /dev/console
+   case "$board" in
+   linksys,e8350)
+   rm -f /etc/config/* ; cp -a /rom/etc/* /etc/. ; 
sync ; reboot
+   ;;
+   *)
+   jffs2reset -y && reboot &
+   ;;
+   esac
+   fi
+;;
+esac
+
+return 0
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/fwtool.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/fwtool.sh
new file mode 100644
index 00..6929518204
--- /dev/null
+++ b/target/linux/ipq806x/base-files/lib/upgrade/fwtool.sh
@@ -0,0 +1,67 @@
+fwtool_check_signature() {
+   [ $# -gt 1 ] && return 1
+
+   [ ! -x /usr/bin/ucert ] && {
+   if [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ]; then
+   return 1
+   else
+   return 0
+   fi
+   }
+
+   if ! fwtool -q -s /tmp/sysupgrade.ucert "$1"; then
+   echo "Image signature not found"
+   [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && {
+   echo "Use sysupgrade -F to override this check when 
downgrading or flashing to vendor firmware"
+   }
+   [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ] && return 1
+   return 0
+   fi
+
+   fwtool -q -T -s /dev/null "$1" | \
+   ucert -V -m - -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys
+
+   return $?
+}
+
+fwtool_check_image() {
+   [ $# -gt 1 ] && return 1
+
+   . /usr/share/libubox/jshn.sh
+
+   if ! fwtool -q -i /tmp/sysupgrade.meta "$1"; then
+   echo "

package-base-files-files-lib-upgrade-fwtool

2020-07-20 Thread Todor Colov
Todor Colov (1):
  sysupgrade need fwtool over the next stages to remove the metadata
info for UBI volumes. This patch creates copy of /usr/bin/fwtool to
/tmp directory to preserves it after the sysupgrade ramdisk switch.
Later fwtool is being referenced from platform.sh script for device
specific metadata removal

 package/base-files/files/lib/upgrade/fwtool.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.27.0


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


[PATCH 1/1] sysupgrade need fwtool over the next stages to remove the metadata info for UBI volumes. This patch creates copy of /usr/bin/fwtool to /tmp directory to preserves it after the sysupgrade r

2020-07-20 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/lib/upgrade/fwtool.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/upgrade/fwtool.sh 
b/package/base-files/files/lib/upgrade/fwtool.sh
index a0b3fb0a04..e4736c06f3 100644
--- a/package/base-files/files/lib/upgrade/fwtool.sh
+++ b/package/base-files/files/lib/upgrade/fwtool.sh
@@ -36,7 +36,9 @@ fwtool_check_image() {
}
[ "$REQUIRE_IMAGE_METADATA" = 1 ] && return 1
return 0
-   fi
+   fi  
+   # keep fwtool copy in /tmp for later reference from platform.sh for 
device specific metadata removal
+   cp /usr/bin/fwtool /tmp/.
 
json_load "$(cat /tmp/sysupgrade.meta)" || {
echo "Invalid image metadata"
-- 
2.27.0


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


[PATCH 1/1] update factory reset for generic handling of all type of devices(jffs2, ubi, etc)

2020-07-20 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/etc/rc.button/reset | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/reset 
b/package/base-files/files/etc/rc.button/reset
index 2403122ad2..0c11bfe462 100755
--- a/package/base-files/files/etc/rc.button/reset
+++ b/package/base-files/files/etc/rc.button/reset
@@ -23,7 +23,7 @@ released)
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
then
echo "FACTORY RESET" > /dev/console
-   jffs2reset -y && reboot &
+   rm -f /etc/config/* && cp -a /rom/etc/* /etc/. ; sync ; reboot
fi
 ;;
 esac
-- 
2.27.0


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


package-base-files-files-etc-rc.button-reset

2020-07-20 Thread Todor Colov
Todor Colov (1):
  update factory reset for generic handling of all type of
devices(jffs2,ubi,etc)

 package/base-files/files/etc/rc.button/reset | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0


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


tools/firmware-utils/src/linksys/addfwhdr - needed for WEB upgrade of openwrt-factory image over the Linksys stock firmware.

2020-07-20 Thread Todor Colov
The source files of addfwhdr are stuctured under separate manufacturer specific 
'linksys' directory

Todor Colov (1):
  tools firmware-utils add linksys addfwhdr tool for native WEB upgrade
of openwrt-factory over the stock WEB interface.

 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.27.0


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


[PATCH 1/1] tools firmware-utils add linksys addfwhdr tool for native WEB upgrade of openwrt-factory over the stock WEB interface.

2020-07-20 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 3dd9ac5c2c..0948e69013 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -23,6 +23,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -97,7 +99,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   printf("output file is [%s]\n",output_file); 
break;
+   case 'g' :
+   garbage = 1; break;
+   default :
+   usage();
+   

[PATCH 1/1] ipq806x: add support for Linksys e8350 v1

2020-07-22 Thread Todor Colov
Device specifications:

Device specifications:
* SoC:  Qualcomm dual-core IPQ8064 @ 1.4 GHz
* RAM: 512MiB
* Flash: 4MiB SPI-NOR + 128 Nand
* Wireless 2.4GHz (SoC): b/g/n, Qualcomm QCA9880
* Wireless 5Ghz (QCA9886): a/n/ac, Quantenna QSR1000
* Ethernet (QCA8337): 1× 1GbE WAN + 4 x 1GbE LAN
* 1 x USB3.0 + 1 x USB2.0
* 1 eSata up to 3.0 Gbps

Flashing instructions:
* Upgrade with factory image via web interface

Debricking:
*  Get the original firmware: 
https://downloads.linksys.com/downloads/firmware/FW_E8350_1.0.03.003_20180929.bin
1. power off the device and disconnect the WAN port. (Only LAN port to be 
connected)
2. press & hold the “Reset” button
3. power on the deiece & wait for 10 seconds with pressed “Reset” button
- the Router will open Firmware Recovery “http” server on IP: 192.168.1.1
4. set IP on your PC from 192.168.1.0/24 network ( Router is on IP 192.168.1.1 )
5. open in browser URL:
http://192.168.1.1/index.shtml

MAC addresses:
MAC address (as on device label) is stored in u-boot env
WLAN uses address incremented by 1.

Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   5 +
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" 
"usb2-port1"
ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" 
"usb3-port1"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..5e26fa2a8b 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -14,6 +14,7 @@ board=$(board_name)
 case "$board" in
 buffalo,wxr-2533dhp |\
 compex,wpq864 |\
+linksys,e8350-v1 |\
 netgear,d7800 |\
 netgear,r7500 |\
 netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..34b9da47af 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -27,6 +27,11 @@ platform_do_upgrade() {
zyxel,nbg6817)
zyxel_do_upgrade "$1"
;;
+   linksys,e8350-v1)
+   # KERNEL_IN_UBI first remove metadata trailer from the UBI 
volume
+   /tmp/fwtool -q -t -i /dev/null "$1"
+   nand_do_upgrade "$1"
+   ;;
linksys,ea7500-v1 |\
linksys,ea8500)
platform_do_upgrade_linksys "$1"
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..5b8cdd205d
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys EA8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = &qu

ipq806x: support for Linksys E8350 v1

2020-07-22 Thread Todor Colov
Todor Colov (1):
  ipq806x: add support for Linksys e8350 v1

 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   5 +
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

-- 
2.27.0


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


[PATCH 1/1] base-files: rfkill: fix wifi button "off" function

2020-07-24 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill 
b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.27.0


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


[PATCH 0/1] base-files: rfkill: fix wifi button "off" function

2020-07-24 Thread Todor Colov
On some of the devices pressing Wifi button does not disable the Wifi.
Current rfkill code execute "wifi up" command instead of only "wifi".
This patch fix it.

Todor Colov (1):
  Fix Wifi Button - off function not working

 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0


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


[PATCH 0/1] ipq806x: add support for Linksys E8350-v1

2020-07-25 Thread Todor Colov
Linksys E8350 is AC2350 (802.11ac Wave-2) router

Device specifications:
ArchitectureARM (armv7l cortex-a15+neon vfpv4)
Vendor  Linksys
Bootloader  U-Boot
System-On-Chip  Qualcomm IPQ8064 @ 1.4 GHz
CPU/Speed   2 x 1.4 GHz
Flash-Chips SPI MX25U3235F + NAND MT29F1G08ABBDAH4
Flash sizes 4 MiB SPI + 128 MiB NAND
RAM 512 MiB (491 MiB for the OS)
Wireless 1  Qualcomm QCA9880 2.4GHz 802.11bgn
Wireless 2  Quantenna QSR1000 5GHz 802.11ac ( driver not supported )
Ethernet4 x 10/100/1000 Mbit/s w/ vlan support
Switch  Qualcomm Atheros QCA8337
USB 1 x 3.0 + 1 x 2.0(combo with eSata port)
eSata   1 (combo with one of the USB ports)
Serial  Yes|Not populated
JTAGNot populated

https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1

Flashing instructions:
* Upgrade with factory image via web interface

Debricking:

Get the original firmware: 
https://downloads.linksys.com/downloads/firmware/FW_E8350_1.0.03.003_20180929.bin
1. power off the device and disconnect the WAN port. (Only LAN port to be 
connected)
2. press & hold the “Reset” button
3. power on the deiece & wait for 10 seconds with pressed “Reset” button
- the Router will open Firmware Recovery “http” server on IP: 192.168.1.1
4. set IP on your PC from 192.168.1.0/24 network ( Router is on IP 192.168.1.1 )
5. open in browser URL:
http://192.168.1.1/index.shtml 

MAC addresses:
MAC address (as on device label) is stored in u-boot env
WLAN uses address incremented by 1.

Todor Colov (1):
  ipq806x: Add support for Linksys E8350-v1

 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

-- 
2.27.0


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


[PATCH 1/1] ipq806x: Add support for Linksys E8350-v1

2020-07-25 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" 
"usb2-port1"
ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" 
"usb3-port1"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..5e26fa2a8b 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -14,6 +14,7 @@ board=$(board_name)
 case "$board" in
 buffalo,wxr-2533dhp |\
 compex,wpq864 |\
+linksys,e8350-v1 |\
 netgear,d7800 |\
 netgear,r7500 |\
 netgear,r7500v2 |\
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..4f4fb12ef0 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..5b8cdd205d
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys EA8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <&gcc EBI2_CLK>,
+   <&gcc EBI2_AON_CLK>;
+   clock-names = "core", "aon";
+   dmas = <&am

[PATCH 0/1] tools: add firmware util addfwhdr for linksys firmware header generation needed for Linksys E8350-v1.

2020-07-25 Thread Todor Colov
tools: add firmware utils for linksys-addfwhdr generation. Needed for 
openwrt-factory flashing over the stock WEB interface for Linksys E8350-v1(and 
other linksys devices) The tool source files for "addfwhdr" are placed in a 
separate sub-directory src/linksys - following naming convention for 
Manufacturer.


Todor Colov (1):
  tools: add firmware utils for linksys-addfwhdr generation. Needed for
openwrt-factory flashing over the stock WEB interface for Linksys
E8350-v1(and other linksys devices) The tool source files for
"addfwhdr" are placed in a separate sub-directory src/linksys -
following naming convention for Manufacturer.

 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.27.0


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


[PATCH 1/1] tools: add firmware utils for linksys-addfwhdr generation. Needed for openwrt-factory flashing over the stock WEB interface for Linksys E8350-v1(and other linksys devices) The tool source

2020-07-25 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 3dd9ac5c2c..0948e69013 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -23,6 +23,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -97,7 +99,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   printf("output file is [%s]\n",output_file); 
break;
+   case 'g' :
+   garbage = 1; break;
+   default :
+   usage();
+   

[PATCH 0/1] base-files: fix nand.sh to remove metadata before ubiformat command

2020-07-25 Thread Todor Colov
Required for sysupgrade with KERNEL_IN_UBI ubinized volumes

Todor Colov (1):
  base-files: fix nand.sh to remove metadata before ubiformat command

 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

-- 
2.27.0


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


[PATCH 1/1] base-files: fix nand.sh to remove metadata before ubiformat

2020-07-25 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh 
b/package/base-files/files/lib/upgrade/nand.sh
index e7d7bf8d13..923c01a72d 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
sync
+   fwtool -q -t -i /dev/null "$1"
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"
nand_do_upgrade_success
-- 
2.27.0


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


[PATCH 0/1] tools: add firmware util linksys-addfwhdr

2020-07-25 Thread Todor Colov
tools: add firmware utils for linksys-addfwhdr generation. Needed for 
openwrt-factory flashing over the stock WEB interface for Linksys E8350-v1(and 
other linksys devices) The tool source files for "addfwhdr" are placed in a 
separate sub-directory src/linksys - following naming convention for 
Manufacturer.


Todor Colov (1):
  tools: add firmware utils for linksys-addfwhdr generation. Needed for
openwrt-factory flashing over the stock WEB interface for Linksys
E8350-v1(and other linksys devices) The tool source files for
"addfwhdr" are placed in a separate sub-directory src/linksys -
following naming convention for Manufacturer.

 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.27.0


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


[PATCH 1/1] tools: add firmware utils for linksys-addfwhdr

2020-07-25 Thread Todor Colov
Needed for openwrt-factory flashing over the stock WEB interface for Linksys 
E8350-v1(and other linksys devices) The tool source files for "addfwhdr" are 
placed in a separate sub-directory src/linksys - following naming convention 
for Manufacturer.

Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 3dd9ac5c2c..0948e69013 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -23,6 +23,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -97,7 +99,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+

[PATCH v2] tools: firmware utils add: linksys addfwhdr

2020-07-28 Thread Todor Colov
Generator of firmware header for Linksys E8350 so that the openwrt-factory 
image can be flashed directly over the stock WEB interface.
>From Linksys GPL code:
https://downloads.linksys.com/support/assets/gpl/E8350_v1.0.03.003.tgz

Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 3dd9ac5c2c..0948e69013 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -23,6 +23,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -97,7 +99,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   

[PATCH v3 0/4] ipq806x: add support for Linksys E8350 - Cover letter

2020-08-31 Thread Todor Colov
bundle of 4 patches to add support for Linksys E8350 dual band wifi router type 
AC2350

FCC ID: Q87-E8350
- device specifications are already in place under the openwrt wiki 
URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
- successful test firmware has been confirmed by me and several users 
under developer forum: 
https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: 
+2 / +3
- WLAN ath10k 2Ghz: via 
/etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
- WLAN quantenna 5Ghz: set during quantenna firmware load - it 
has separate SPI flash not accessible via Openwrt OS

The device label lists only one mac address

Installation:
via stock WEB interface

Notes:
Quantenna 5Ghz Wifi requires separate packages for loading its firmware 
and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys FW header genarator   - needed for factory FW
updata over stock WEB interface

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 ++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 16 files changed, 2351 insertions(+), 4 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.28.0


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


[PATCH v3 3/4] package: fix wifi off/on functional button

2020-08-31 Thread Todor Colov
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill 
b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0


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


[PATCH v3 2/4] package: fix nand.sh fwtool trailer removal for UBIFS

2020-08-31 Thread Todor Colov
---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh 
b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
sync
+   fwtool -q -t -i /dev/null "$1"
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"
nand_do_upgrade_success
-- 
2.28.0


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


[PATCH v3 1/4] ipq806x: add support for Linksys E8350

2020-08-31 Thread Todor Colov
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" 
"usb2-port1"
ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" 
"usb3-port1"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..3dfad72232 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -55,6 +55,7 @@ qcom,ipq8064-db149)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..4f4fb12ef0 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys E8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <&gcc EBI2_CLK>,
+   <&gcc EBI2_AON_CLK>;
+   clock-names = "core", "aon";
+   dmas = <&adm_dma 3>;
+   dma-names = "rxtx";
+   qcom,cmd-crci = <15>;
+   qcom,data-crci = <3>;
+
+   nand@0 {
+   reg = <0>;
+
+   nand-ecc-strength = <4>;
+   nand-bus-width = <8>;
+
+   partitions {
+   compatible = "fixed-partitions";
+
+   partition@0 {
+ 

[PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator - needed for factory FW updata over stock WEB interface

2020-08-31 Thread Todor Colov
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..1dcbd0db77 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -24,6 +24,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -98,7 +100,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   printf("output file is [%s]\n",output_file); 
break;
+   case 'g' :
+   garbage = 1; break;
+   default :
+   usage();
+   }
+   }
+
+   if(!input_file || !output_file)
+   {
+   printf("You must specify the input and output file!\n");
+   usage();
+   }
+
+   
+   unlink(output_file);
+   if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREA

[PATCH v3 2/4] package: fix nand.sh fwtool trailer removal for UBIFS

2020-08-31 Thread Todor Colov
---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh 
b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
sync
+   fwtool -q -t -i /dev/null "$1"
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"
nand_do_upgrade_success
-- 
2.28.0


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


[PATCH v3 0/4] ipq806x: add support for Linksys E8350 - Cover letter

2020-08-31 Thread Todor Colov
bundle of 4 patches to add support for Linksys E8350 dual band wifi router type 
AC2350

FCC ID: Q87-E8350
- device specifications are already in place under the openwrt wiki 
URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
- successful test firmware has been confirmed by me and several users 
under developer forum: 
https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: 
+2 / +3
- WLAN ath10k 2Ghz: via 
/etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
- WLAN quantenna 5Ghz: set during quantenna firmware load - it 
has separate SPI flash not accessible via Openwrt OS

The device label lists only one mac address

Installation:
via stock WEB interface

Notes:
Quantenna 5Ghz Wifi requires separate packages for loading its firmware 
and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys FW header genarator   - needed for factory FW
updata over stock WEB interface

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 ++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 16 files changed, 2351 insertions(+), 4 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

-- 
2.28.0


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


[PATCH v3 3/4] package: fix wifi off/on functional button

2020-08-31 Thread Todor Colov
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill 
b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0


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


[PATCH v3 4/4] tools: addfwhrd Linksys FW header genarator

2020-08-31 Thread Todor Colov
---
 tools/firmware-utils/Makefile |   4 +-
 tools/firmware-utils/src/linksys/addfwhdr.c   | 195 
 tools/firmware-utils/src/linksys/bcmdefs.h| 318 +
 .../firmware-utils/src/linksys/code_pattern.h | 396 
 tools/firmware-utils/src/linksys/crc.c| 290 
 tools/firmware-utils/src/linksys/crc.h|  69 +++
 tools/firmware-utils/src/linksys/cyutils.h| 348 ++
 tools/firmware-utils/src/linksys/typedefs.h   | 447 ++
 8 files changed, 2066 insertions(+), 1 deletion(-)
 create mode 100644 tools/firmware-utils/src/linksys/addfwhdr.c
 create mode 100644 tools/firmware-utils/src/linksys/bcmdefs.h
 create mode 100644 tools/firmware-utils/src/linksys/code_pattern.h
 create mode 100644 tools/firmware-utils/src/linksys/crc.c
 create mode 100644 tools/firmware-utils/src/linksys/crc.h
 create mode 100644 tools/firmware-utils/src/linksys/cyutils.h
 create mode 100644 tools/firmware-utils/src/linksys/typedefs.h

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..1dcbd0db77 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -24,6 +24,8 @@ endef
 
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
+   mkdir -p $(HOST_BUILD_DIR)/bin/linksys
+   $(call cc,linksys/addfwhdr linksys/crc )
$(call cc,add_header)
$(call cc,addpattern)
$(call cc,asustrx)
@@ -98,7 +100,7 @@ define Host/Compile
 endef
 
 define Host/Install
-   $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
+   $(CP) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/tools/firmware-utils/src/linksys/addfwhdr.c 
b/tools/firmware-utils/src/linksys/addfwhdr.c
new file mode 100644
index 00..6e2896c62d
--- /dev/null
+++ b/tools/firmware-utils/src/linksys/addfwhdr.c
@@ -0,0 +1,195 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyutils.h"
+#include "code_pattern.h"
+
+#include "typedefs.h"
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int 
+fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long
+file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+int opt;
+int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+extern char *optarg;
+extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+   printf("input file is [%s]\n",input_file); 
break;
+   case 'o' :
+   output_file = optarg;
+   printf("output file is [%s]\n",output_file); 
break;
+   case 'g' :
+   garbage = 1; break;
+   default :
+   usage();
+   }
+   }
+
+   if(!input_file || !output_file)
+   {
+   printf("You must specify the input and output file!\n");
+   usage();
+   }
+
+   
+   unlink(output_file);
+   if ((fd_w = open(output_file,O_RDWR|O_CREAT, S_IREA

[PATCH v3 1/4] ipq806x: add support for Linksys E8350

2020-08-31 Thread Todor Colov
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index f8b6c32358..802fb41d74 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -19,6 +19,9 @@ compex,wpq864)
ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" 
"usb2-port1"
ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" 
"usb3-port1"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 529a8d9f39..3dfad72232 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -55,6 +55,7 @@ qcom,ipq8064-db149)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 560e64af3a..4f4fb12ef0 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys E8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <&gcc EBI2_CLK>,
+   <&gcc EBI2_AON_CLK>;
+   clock-names = "core", "aon";
+   dmas = <&adm_dma 3>;
+   dma-names = "rxtx";
+   qcom,cmd-crci = <15>;
+   qcom,data-crci = <3>;
+
+   nand@0 {
+   reg = <0>;
+
+   nand-ecc-strength = <4>;
+   nand-bus-width = <8>;
+
+   partitions {
+   compatible = "fixed-partitions";
+
+   partition@0 {
+ 

[PATCH v4 0/4] ipq806x: add support for Linksys E8350-v1

2020-09-28 Thread Todor Colov
bundle of 4 patches to add support for Linksys E8350 dual band wifi router type 
AC2350

FCC ID: Q87-E8350
- device specifications are already in place under the openwrt wiki 
URL: https://openwrt.org/inbox/toh/linksys/linksys_ea8350_1$
- successful test firmware has been confirmed by me and several users 
under developer forum: 
https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/73

MAC addresses:
via system.sh function: mtd_get_mac_ascii 0:APPSBLENV ethaddr
- LAN/WAN interfaces: via /etc/board.d/02_network ethaddr mac: 
+2 / +3
- WLAN ath10k 2Ghz: via 
/etc/hotplug.d/firmware/11-ath10k-caldata  ethaddr mac: +1
- WLAN quantenna 5Ghz: set during quantenna firmware load - it 
has separate SPI flash not accessible via Openwrt OS

The device label lists only one mac address

Installation:
via stock WEB interface

Notes:
Quantenna 5Ghz Wifi requires separate packages for loading its firmware 
and driver which will be packaged outside this submission via the package feeds.

Todor Colov (4):
  ipq806x: add support for Linksys E8350 v1
  package: fix nand.sh fwtool trailer removal for UBIFS
  package: fix wifi off/on functional button
  tools: addfwhrd Linksys E8350v1 FW header genarator

 package/base-files/files/etc/rc.button/rfkill |   2 +-
 package/base-files/files/lib/upgrade/nand.sh  |   1 +
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 tools/firmware-utils/Makefile |   1 +
 tools/firmware-utils/src/addfwhdr.c   | 233 +
 10 files changed, 519 insertions(+), 3 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

-- 
2.28.0


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


[PATCH v4 3/4] package: fix wifi off/on functional button

2020-09-28 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/etc/rc.button/rfkill | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/rc.button/rfkill 
b/package/base-files/files/etc/rc.button/rfkill
index fbdda40ed5..2d4f0f86ff 100755
--- a/package/base-files/files/etc/rc.button/rfkill
+++ b/package/base-files/files/etc/rc.button/rfkill
@@ -27,6 +27,6 @@ case "${TYPE}" in
 esac
 config_foreach wifi_rfkill_set wifi-device
 uci commit wireless
-wifi up
+wifi
 
 return 0
-- 
2.28.0


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


[PATCH v4 4/4] tools: addfwhrd Linksys E8350v1 FW header genarator

2020-09-28 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 tools/firmware-utils/Makefile   |   1 +
 tools/firmware-utils/src/addfwhdr.c | 233 
 2 files changed, 234 insertions(+)
 create mode 100644 tools/firmware-utils/src/addfwhdr.c

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 39c3503886..b83acc7652 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -25,6 +25,7 @@ endef
 define Host/Compile
mkdir -p $(HOST_BUILD_DIR)/bin
$(call cc,add_header)
+   $(call cc,addfwhdr cyg_crc32)
$(call cc,addpattern)
$(call cc,asustrx)
$(call cc,buffalo-enc buffalo-lib,-Wall)
diff --git a/tools/firmware-utils/src/addfwhdr.c 
b/tools/firmware-utils/src/addfwhdr.c
new file mode 100644
index 00..ada56e6abf
--- /dev/null
+++ b/tools/firmware-utils/src/addfwhdr.c
@@ -0,0 +1,233 @@
+/*
+   Linksys e8350 v1 firmware header generator
+*/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cyg_crc.h"
+#define AC2350  20
+#define USA 1
+
+#if LOCALE == USA
+   #define CYBERTAN_VERSION"v1.0.03"
+   #define SERIAL_NUMBER   "003"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#else   // ETSI
+   #define CYBERTAN_VERSION"v1.0.00"
+   #define SERIAL_NUMBER   "01"
+   #define MINOR_VERSION   ""
+   #define BUILD_KEYWORD   " B"
+   #define BUILD_NUMBERSERIAL_NUMBER
+   #define BETA_VERSION" "
+   #define CYBERTAN_UBOOT_VERSION  "v1.0"
+#endif
+
+//add for AC2350 F/W header
+#define FWHDR_MAGIC_STR "CHDR"
+#define FWHDR_MAGIC 0X52444843
+struct cbt_fw_header
+{
+   unsigned int magic; /* "CHDR" */
+   unsigned int len;   /* Length of file including header */
+   unsigned int crc32; /* 32-bit CRC */
+   unsigned int res;
+};
+
+#define MAX_BUF1024
+#define CRC32_INIT_VALUE 0x/* Initial CRC32 checksum value */
+
+#ifndef TYPEDEF_UINT8
+typedef unsigned char   uint8;
+#endif
+
+#ifndef TYPEDEF_UINT16
+typedef unsigned short  uint16;
+#endif
+
+#ifndef TYPEDEF_UINT32
+typedef unsigned intuint32;
+#endif
+
+typedef uint32_t cyg_uint32;
+typedef uint16_t cyg_uint16;
+
+extern cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, 
int len);
+//extern uint32 crc32(uint8 *pdata, uint nbytes, uint32 crc);
+
+int fd, fd_w;
+
+void die(const char * str, ...)
+{
+   va_list args;
+   va_start(args, str);
+   vfprintf(stderr, str, args);
+   fputc('\n', stderr);
+   exit(1);
+}
+
+int fill_null0(int size)
+{
+   unsigned char buf[1];
+   int i;
+
+   fprintf(stderr,"Fill null\n");
+
+   buf[0] = 0xff;
+   for (i=0 ; i< size; i++ )
+   if (write(fd_w, buf, 1) != 1)
+   return 0;
+
+   return 1;
+}
+
+long file_open(const char *name)
+{
+   struct stat sb;
+   if ((fd = open(name, O_RDONLY, 0)) < 0){
+   die("Unable to open `%s' : %m", name);
+   }
+
+   if (fstat (fd, &sb))
+   die("Unable to stat `%s' : %m", name);
+
+   return sb.st_size;
+}
+
+void usage(void)
+{
+   die("Usage: addfwhdr [-i|--input] sysupgrade.o [-o|--output] 
code.bin\n");
+}
+
+int main(int argc, char ** argv)
+{
+   uint input_size,c;
+   char *input_file=NULL, *output_file=NULL;
+   int opt;
+   int option_index=0;
+   int garbage = 0;
+   char *buf = NULL;
+   extern char *optarg;
+   extern int optind, opterr, optopt;
+   
+   struct cbt_fw_header *fwhdr;
+   uint32 crc; 
+
+   static struct option long_options[] =
+   {
+   {"input", 1, 0, 'i'},
+   {"output", 1, 0, 'o'},
+   {"garbage", 0, 0, 'g'},
+   {0, 0, 0, 0}
+   };
+
+   printf("\n-- add fw header \n");
+
+   fwhdr  = malloc(sizeof(struct cbt_fw_header));
+   memset(fwhdr, 0, sizeof(struct cbt_fw_header)); 
+
+   while(1){
+   opt = getopt_long(argc, argv, "i:o:g",long_options, 
&option_index);
+   if(opt == -1)
+   break;
+   switch(opt){
+   case 'h' : 
+   usage(); break;
+   case 'i' :
+   input_file = optarg;
+ 

[PATCH v4 2/4] package: fix nand.sh fwtool trailer removal for UBIFS

2020-09-28 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 package/base-files/files/lib/upgrade/nand.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/nand.sh 
b/package/base-files/files/lib/upgrade/nand.sh
index ad04bbc753..91eea3bd3a 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -224,6 +224,7 @@ nand_upgrade_ubinized() {
local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
sync
+   fwtool -q -t -i /dev/null "$1"
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"
nand_do_upgrade_success
-- 
2.28.0


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


[PATCH v4 1/4] ipq806x: add support for Linksys E8350 v1

2020-09-28 Thread Todor Colov
Signed-off-by: Todor Colov 
---
 .../ipq806x/base-files/etc/board.d/01_leds|   3 +
 .../ipq806x/base-files/etc/board.d/02_network |   1 +
 .../base-files/lib/upgrade/platform.sh|   3 +-
 .../arm/boot/dts/qcom-ipq8064-e8350-v1.dts| 246 ++
 target/linux/ipq806x/image/Makefile   |  29 +++
 .../0069-arm-boot-add-dts-files.patch |   3 +-
 6 files changed, 283 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts

diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 620fc12f41..e7f0b8dd7a 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -23,6 +23,9 @@ edgecore,ecw5410)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
;;
+linksys,e8350-v1)
+ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wifi" "phy0tpt"
+;;
 nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" 
"phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" 
"phy0tpt"
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 3f9d96881d..88ec76b2c9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -60,6 +60,7 @@ qcom,ipq8064-db149)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
;;
+linksys,e8350-v1 |\
 zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index f61e8ee878..f1df0a4d3a 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv fwtool'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
 
 platform_check_image() {
@@ -16,6 +16,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
compex,wpq864|\
+   linksys,e8350-v1|\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
diff --git 
a/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts 
b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
new file mode 100644
index 00..cc478963c7
--- /dev/null
+++ b/target/linux/ipq806x/files-5.4/arch/arm/boot/dts/qcom-ipq8064-e8350-v1.dts
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+#include "qcom-ipq8064-v2.0.dtsi"
+
+#include 
+#include 
+
+/ {
+   model = "Linksys E8350 V1 WiFi Router";
+   compatible = "linksys,e8350-v1", "qcom,ipq8064";
+
+   memory@0 {
+   reg = <0x4200 0x1e00>;
+   device_type = "memory";
+   };
+
+   aliases {
+   serial0 = &gsbi4_serial;
+
+   led-boot = &led_power;
+   led-failsafe = &led_power;
+   led-running = &led_power;
+   led-upgrade = &led_power;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+   pinctrl-0 = <&button_pins>;
+   pinctrl-names = "default";
+
+   reset {
+   label = "reset";
+   gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wps {
+   label = "wps";
+   gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   wifi {
+   label = "wifi";
+   gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   nand-controller@1ac0 {
+   compatible = "qcom,ipq806x-nand";
+   reg = <0x1ac0 0x800>;
+   clocks = <

donated Linksys E8350 - helping to validate and merge the target device patches to the openwrt sources

2020-12-02 Thread Todor Colov

Dear all,

Does someone like to receive donated Linksys E8350 device to help 
validate and merge the target device patches to the openwrt sources tree?


Sample e8350 patches are pending validation in the patchwork:
https://patchwork.ozlabs.org/project/openwrt/list/?page=2


In the forum, you can see that timmyjl12 
 has spare Linksys E8350 device 
which can be donated:

https://forum.openwrt.org/t/e8350-why-not-supported-by-openwrt/57640/155


Kind regards,
Todor

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