From 3b15eb06c366cf3805590a61f22e966a95bf8101 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 28 Oct 2017 12:30:39 +0200 Subject: [PATCH] ar71xx: complete support for RB wAP 2nD This patch adds support for the MikroTik RouterBOARD wAP https://mikrotik.com/product/RBwAP2nD Specifications: - SoC: Qualcomm QCA9533 (650 MHz) - RAM: 64 MB - Storage: 16 MB NOR SPI flash - Wireless: built-in QCA9533, 2x2:2 - Ethernet: 1x100M (802.3af/at POE in) This patch adds missing code to fully support wAP. Machfile already contained configuration for wAP 2nD but device specific configuration like LEDs etc. was missing. Installation: 1. Login to the Mikrotik WebUI to backup your licence keys 2. Setup a DHCP/BOOTP server with: - DHCP-Option 66 (TFTP server name) pointing to a local TFTP server within the same subnet of the DHCP range - DHCP-Option 67 (Bootfile-Name) matching the initramfs filename of the to be booted image 3. Connect the port labeled internet to your local network 4. Keep the reset button pushed down and power on the board The board should load and start the initramfs image from the TFTP server. Login as root/without password to the started LEDE via SSH listing on IPv4 address 192.168.1.1. Use sysupgrade to install LEDE. Revert to RouterOS Use the "rbcfg" package on in LEDE: - rbcfg set boot_protocol bootp - rbcfg set boot_device ethnand - rbcfg apply Open Netinstall and reboot routerboard. Now Netinstall sees RouterBOARD and you can install RouterOS. If NetInstall gets stuck on Sending offer just wait for it to timeout and then close and open Netinstall again. Click on install again. In order for RouterOS to function properly, you need to restore license for the device. You can do that by including license in NetInstall. Signed-off-by: Robert Marko --- target/linux/ar71xx/base-files/etc/board.d/01_leds | 4 ++++ target/linux/ar71xx/base-files/etc/board.d/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 6 ++++-- .../linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 2 +- target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c | 9 +++++++-- target/linux/ar71xx/image/mikrotik.mk | 2 +- .../701-MIPS-ath79-add-routerboard-detection.patch | 3 ++- .../701-MIPS-ath79-add-routerboard-detection.patch | 3 ++- 9 files changed, 25 insertions(+), 8 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index e101d557bd..867fa9d381 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -325,6 +325,10 @@ rb-mapl-2nd) ucidef_set_led_netdev "lan" "LAN" "rb:green:eth" "eth0" ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt" ;; +rb-wap-2nd) + ucidef_set_led_timer "user" "USER" "rb:green:user" "1000" "1000" + ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt" + ;; dap-2695-a1) ucidef_set_led_default "power" "POWER" "d-link:green:power" "1" ucidef_set_led_default "diag" "DIAG" "d-link:red:power" "0" diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index f8060f401c..5aef2058c2 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -101,6 +101,7 @@ ar71xx_setup_interfaces() rb-mapl-2nd|\ rb-sxt2n|\ rb-sxt5n|\ + rb-wap-2nd|\ re450|\ rocket-m-xw|\ sc300m |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 7c381c00f3..702ed215ca 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -974,6 +974,9 @@ ar71xx_board_detect() { *"RouterBOARD SXT Lite5") name="rb-sxt5n" ;; + *"RouterBOARD wAP 2nD r2") + name="rb-wap-2nd" + ;; *"RouterStation") name="routerstation" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 210e4a2970..4639ae32cf 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -666,7 +666,8 @@ platform_check_image() { rb-952ui-5ac2nd|\ rb-962uigs-5hact2hnt|\ rb-lhg-5nd|\ - rb-mapl-2nd) + rb-mapl-2nd|\ + rb-wap-2nd) return 0 ;; esac @@ -725,7 +726,8 @@ platform_pre_upgrade() { rb-952ui-5ac2nd|\ rb-962uigs-5hact2hnt|\ rb-lhg-5nd|\ - rb-mapl-2nd) + rb-mapl-2nd|\ + rb-wap-2nd) # erase firmware if booted from initramfs [ -z "$(rootfs_type)" ] && mtd erase firmware ;; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 0380b09c71..77e523bcc4 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -1035,7 +1035,7 @@ config ATH79_MACH_RBSPI MikroTik RouterBOARD LHG 5 MikroTik RouterBOARD cAP (EXPERIMENTAL) MikroTik RouterBOARD mAP (EXPERIMENTAL) - MikroTik RouterBOARD wAP (EXPERIMENTAL) + MikroTik RouterBOARD wAP config ATH79_MACH_RBSXTLITE bool "MikroTik RouterBOARD SXT Lite" diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c index 1045dfc6e7..2e1ecd0f52 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c @@ -10,9 +10,9 @@ * - MikroTik RouterBOARD 750P-PBr2 * - MikroTik RouterBOARD 750 r2 * - MikroTik RouterBOARD LHG 5nD + * - MikroTik RouterBOARD wAP2nD * * Preliminary support for the following hardware - * - MikroTik RouterBOARD wAP2nD * - MikroTik RouterBOARD cAP2nD * - MikroTik RouterBOARD mAP2nD * Furthermore, the cAP lite (cAPL2nD) appears to feature the exact same @@ -873,7 +873,7 @@ static void __init rblhg_setup(void) } /* - * Init the wAP hardware (EXPERIMENTAL). + * Init the wAP hardware. * The wAP 2nD has a single ethernet port. */ static void __init rbwap_setup(void) @@ -889,6 +889,11 @@ static void __init rbwap_setup(void) rbspi_network_setup(flags, 0, 1, 0); ath79_register_leds_gpio(-1, ARRAY_SIZE(rbwap_leds), rbwap_leds); + + /* wAP has a single reset button as GPIO 16 */ + ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL, + ARRAY_SIZE(rbspi_gpio_keys_reset16), + rbspi_gpio_keys_reset16); } /* diff --git a/target/linux/ar71xx/image/mikrotik.mk b/target/linux/ar71xx/image/mikrotik.mk index 8f7d7cce98..5ee3eee65e 100644 --- a/target/linux/ar71xx/image/mikrotik.mk +++ b/target/linux/ar71xx/image/mikrotik.mk @@ -30,7 +30,7 @@ define Device/rb-nor-flash-16M LOADER_TYPE := elf KERNEL_INSTALL := 1 KERNEL := kernel-bin | lzma | loader-kernel - SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-750p-pbr2 rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-mapl-2nd + SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-750p-pbr2 rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-mapl-2nd rb-wap-2nd IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) endef diff --git a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch index cd91ac3c02..fc3091ec65 100644 --- a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch +++ b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c -@@ -136,6 +136,27 @@ void __init prom_init(void) +@@ -136,6 +136,28 @@ void __init prom_init(void) initrd_end = initrd_start + fw_getenvl("initrd_size"); } #endif @@ -20,6 +20,7 @@ + strstr(arcs_cmdline, "board=962") || + strstr(arcs_cmdline, "board=lhg") || + strstr(arcs_cmdline, "board=map-hb") || ++ strstr(arcs_cmdline, "board=wap-hb") || + strstr(arcs_cmdline, "board=2011L") || + strstr(arcs_cmdline, "board=2011r") || + strstr(arcs_cmdline, "board=711Gr100") || diff --git a/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch index cd91ac3c02..fc3091ec65 100644 --- a/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch +++ b/target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c -@@ -136,6 +136,27 @@ void __init prom_init(void) +@@ -136,6 +136,28 @@ void __init prom_init(void) initrd_end = initrd_start + fw_getenvl("initrd_size"); } #endif @@ -20,6 +20,7 @@ + strstr(arcs_cmdline, "board=962") || + strstr(arcs_cmdline, "board=lhg") || + strstr(arcs_cmdline, "board=map-hb") || ++ strstr(arcs_cmdline, "board=wap-hb") || + strstr(arcs_cmdline, "board=2011L") || + strstr(arcs_cmdline, "board=2011r") || + strstr(arcs_cmdline, "board=711Gr100") || -- 2.30.2