From 99835e09992bb411519fda1f8d16a6d07df7f598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Valentin?= Date: Wed, 23 Oct 2019 11:30:30 +0200 Subject: ath79: add support for ZyXEL NBG6716 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attention: Kernel partition size has been enlarged to 4MB. To switch, you must update to latest ar71xx-nand snapshort and flash the sysupgrade-4M-Kernel.bin: zcat openwrt-ath79-nand-zyxel_nbg6716-squashfs-sysupgrade-4M-Kernel.bin | mtd -r -e ubi write - firmware; reboot -f You will end up with a fresh config if you do not inject config into the image. The NBG6716 may come with 128MB or 256MB NAND. ar71xx was able to use all, but ath79 can only use the first 128MB. Therefore the complete NAND needs to be overwritten. If not, the old UBI may make problems and lead to reboot loop. Access the real u-boot shell: ZyXEL uses a proprietary loader/shell on top of u-boot: "ZyXEL zloader v2.02" When the device is starting up, the user can enter the the loader shell by simply pressing a key within the 3 seconds once the following string appears on the serial console: | Hit any key to stop autoboot: 3 The user is then dropped to a locked shell. |NBG6716> HELP |ATEN x[,y] set BootExtension Debug Flag (y=password) |ATSE x show the seed of password generator |ATSH dump manufacturer related data in ROM |ATRT [x,y,z,u] RAM read/write test (x=level, y=start addr, z=end addr, u=iterations) |ATGO boot up whole system |ATUR x upgrade RAS image (filename) |NBG6716> In order to escape/unlock a password challenge has to be passed. Note: the value is dynamic! you have to calculate your own! First use ATSE $MODELNAME (MODELNAME is the hostname in u-boot env) to get the challange value/seed. |NBG6716> ATSE NBG6716 |012345678901 This seed/value can be converted to the password with the help of this bash script (Thanks to http://www.adslayuda.com/Zyxel650-9.html authors): - tool.sh - ror32() { echo $(( ($1 >> $2) | (($1 << (32 - $2) & (2**32-1)) ) )) } v="0x$1" a="0x${v:2:6}" b=$(( $a + 0x10F0A563)) c=$(( 0x${v:12:14} & 7 )) p=$(( $(ror32 $b $c) ^ $a )) printf "ATEN 1,%X\n" $p - end of tool.sh - |# bash ./tool.sh 012345678901 | |ATEN 1,879C711 copy and paste the result into the shell to unlock zloader. |NBG6716> ATEN 1,0046B0017430 If the entered code was correct the shell will change to use the ATGU command to enter the real u-boot shell. |NBG6716> ATGU |NBG6716# Signed-off-by: André Valentin --- target/linux/ath79/base-files/etc/board.d/02_network | 8 ++++++++ .../linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom | 4 ++++ .../ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++++ .../ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration | 3 ++- target/linux/ath79/base-files/lib/upgrade/platform.sh | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) (limited to 'target/linux/ath79/base-files') diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index c40c07a906..b5209f7014 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -304,6 +304,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "3:lan:1" "4:lan:2" ;; + zyxel,nbg6716) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; @@ -443,6 +447,10 @@ ath79_setup_macs() wd,mynet-wifi-rangeextender) lan_mac=$(nvram get et0macaddr) ;; + zyxel,nbg6716) + lan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) + wan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 2cd46f8c28..14cfe64a41 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -47,6 +47,10 @@ case "$FIRMWARE" in caldata_extract "radiocfg" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac") ;; + zyxel,nbg6716) + caldata_extract "art" 0x1000 0x440 + ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr) + ;; *) caldata_die "board $board is not supported yet" ;; diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b2ec803a72..91e813f121 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -113,6 +113,10 @@ case "$FIRMWARE" in ubnt,unifiac-pro) caldata_extract "EEPROM" 0x5000 0x844 ;; + zyxel,nbg6716) + caldata_extract "art" 0x5000 0x844 + ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) + ;; esac ;; "ath10k/pre-cal-pci-0000:00:00.0.bin") diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration index 37a1346fe7..b0a5d79f9d 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration +++ b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration @@ -15,7 +15,8 @@ migrate_wifi_path() { case "$board" in tplink,archer-c7-v1|\ - tplink,archer-c7-v2) + tplink,archer-c7-v2|\ + zyxel,nbg6716) path="pci0000:00/0000:00:00.0" WIFI_PATH_CHANGED=1 ;; diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh index 10756abbaf..83c4e78d25 100644 --- a/target/linux/ath79/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh @@ -51,6 +51,9 @@ platform_do_upgrade() { ubnt,routerstation-pro) echo "Sysupgrade disabled due bug FS#2428" ;; + zyxel,nbg6716) + nand_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; -- cgit v1.2.3