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.

65 lines
1.3 KiB
Bash

#
# Copyright (C) 2010 OpenWrt.org
#
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
ramips: add support for ALFA Network Quad-E4G ALFA Network Quad-E4G is a universal Wi-Fi/4G platform, which offers three miniPCIe (PCIe, USB 2.0, SIM) and a single M.2 B-key (dual-SIM, USB 3.0) slots, RTC and five Gigabit Ethernet ports with PoE support. Specification: - MT7621A (880 MHz) - 256/512 MB of RAM (DDR3) - 16/32+ MB of FLASH (SPI NOR) - optional second SPI flash (8-pin WSON/SOIC) - 1x microSD (SDXC) flash card reader - 5x 10/100/100 Mbps Ethernet, with passive PoE support (24 V) in LAN1 - optional 802.3at/af PoE module for WAN - 3x miniPCIe slot (with PCIe and USB 2.0 buses, micro SIM and 5 V) - 1x M.2/NGFF B-key 3042 (USB 3.0/2.0, mini + micro SIM) - RTC (TI BQ32002, I2C bus) with backup battery (CR2032) - external hardware watchdog (EM Microelectronic EM6324) - 1x USB 2.0 Type-A - 1x micro USB Type-B for system serial console (Holtek HT42B534) - 11x LED (5 for Ethernet, 5 driven by GPIO, 1x power indicator) - 3x button (reset, user1, user2) - 1x I2C (4-pin, 2.54 mm pitch) header on PCB - 4x SIM (6-pin, 2.00 mm pitch) headers on PCB - 2x UART2/3 (4-pin, 2.54 mm pitch) headers on PCB - 1x mechanical power switch - 1x DC jack with lock (24 V) Other: - U-Boot selects default SIM slot, based on value of 'default_sim' env variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This board has additional logic circuit for M.2 SIM switching. The 'sim-select' will work only if both SIM slots are occupied. Otherwise, always slot with SIM inside is selected, no matter 'sim-select' value. - U-Boot enables power in all three miniPCIe and M.2 slots before loading the kernel - this board supports 'dual image' feature (controlled by 'dual_image' U-Boot environment variable) - all three miniPCIe slots have additional 5 V supply on pins 47 and 49 - the board allows to install up to two oversized miniPCIe cards (vendor has dedicated MediaTek MT7615N/D cards for this board) - this board has additional logic circuit controlling PERSTn pins inside miniPCIe slots. By default, PERSTn (GPIO19) is routed to all miniPCIe slots but setting GPIO22 to high allows PERSTn control per slot, using GPIO23-25 (value is inverted) You can use the 'sysupgrade' image directly in vendor firmware which is based on OpenWrt (make sure to not preserve settings - use 'sysupgrade -n -F ...' command). Alternatively, use web recovery mode in U-Boot: 1. Power the device with reset button pressed, the modem LED will start blinking slowly and after ~3 seconds, when it starts blinking faster, you can release the button. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image. Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
platform_check_image() {
return 0
}
platform_do_upgrade() {
local board=$(board_name)
ramips: add support for Ubiquiti EdgeRouter X (UBNT-ERX) This router is based on MT7621 SoC, no wifi, no usb, nand. Works: * Boots. * Ethernet. * Switch. * Button (reset). * Flashing OpenWrt from stock firmware. * Upgrading OpenWrt. Doesn't work: * No GPIO leds. All leds are controlled by switch, but stock firmware was able to control them. * SoC has crypto engine but no open driver. * SoC has nat acceleration, but no open driver. * This router has 2MB spi flash soldered in but MT nand/spi drivers do not support pin sharing, so it is not accessable and disabled. Stock firmware could read it and it was empty. * PoE out. Router has serial pins populated. If looking at the top of the router, then counting from Eth sockets pins go as: 'GND, RX, TX, GND'. 3.3v, 57600. U-boot bootloader supports tftpboot, controlled from serial. This router has two kernel partitions: 'live' and 'backup'. They are swapped during flashing (on both stock and OpenWrt). Active partition is controlled by a flag in a factory partition. U-boot has custom command to switch active kernel partition. Kernel partitions are 'bare flash' 3MB. Stock bootloader has no UBI support. Stock rootfs is UBIFS. Flashing procedure. Stock firmware uses custom kernel patch to mount squashfs from a file that is located on UBIFS volume. This makes wiping out this volume from within stock firmware difficult. Instead this patch builds image that is flashable by stock firmware and contains initrams image (with minimal set of packages to fit into kernel partition). Once this is flashed one can reboot into initramfs OpenWrt and use sysupgrade to flash OpenWrt including rootfs into nand. Note: factory image is only built if initramfs image is enabled. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com> SVN-Revision: 47881
9 years ago
case "$board" in
ramips: add support for ALFA Network Quad-E4G ALFA Network Quad-E4G is a universal Wi-Fi/4G platform, which offers three miniPCIe (PCIe, USB 2.0, SIM) and a single M.2 B-key (dual-SIM, USB 3.0) slots, RTC and five Gigabit Ethernet ports with PoE support. Specification: - MT7621A (880 MHz) - 256/512 MB of RAM (DDR3) - 16/32+ MB of FLASH (SPI NOR) - optional second SPI flash (8-pin WSON/SOIC) - 1x microSD (SDXC) flash card reader - 5x 10/100/100 Mbps Ethernet, with passive PoE support (24 V) in LAN1 - optional 802.3at/af PoE module for WAN - 3x miniPCIe slot (with PCIe and USB 2.0 buses, micro SIM and 5 V) - 1x M.2/NGFF B-key 3042 (USB 3.0/2.0, mini + micro SIM) - RTC (TI BQ32002, I2C bus) with backup battery (CR2032) - external hardware watchdog (EM Microelectronic EM6324) - 1x USB 2.0 Type-A - 1x micro USB Type-B for system serial console (Holtek HT42B534) - 11x LED (5 for Ethernet, 5 driven by GPIO, 1x power indicator) - 3x button (reset, user1, user2) - 1x I2C (4-pin, 2.54 mm pitch) header on PCB - 4x SIM (6-pin, 2.00 mm pitch) headers on PCB - 2x UART2/3 (4-pin, 2.54 mm pitch) headers on PCB - 1x mechanical power switch - 1x DC jack with lock (24 V) Other: - U-Boot selects default SIM slot, based on value of 'default_sim' env variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This board has additional logic circuit for M.2 SIM switching. The 'sim-select' will work only if both SIM slots are occupied. Otherwise, always slot with SIM inside is selected, no matter 'sim-select' value. - U-Boot enables power in all three miniPCIe and M.2 slots before loading the kernel - this board supports 'dual image' feature (controlled by 'dual_image' U-Boot environment variable) - all three miniPCIe slots have additional 5 V supply on pins 47 and 49 - the board allows to install up to two oversized miniPCIe cards (vendor has dedicated MediaTek MT7615N/D cards for this board) - this board has additional logic circuit controlling PERSTn pins inside miniPCIe slots. By default, PERSTn (GPIO19) is routed to all miniPCIe slots but setting GPIO22 to high allows PERSTn control per slot, using GPIO23-25 (value is inverted) You can use the 'sysupgrade' image directly in vendor firmware which is based on OpenWrt (make sure to not preserve settings - use 'sysupgrade -n -F ...' command). Alternatively, use web recovery mode in U-Boot: 1. Power the device with reset button pressed, the modem LED will start blinking slowly and after ~3 seconds, when it starts blinking faster, you can release the button. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image. Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
alfa-network,quad-e4g)
[ "$(fw_printenv -n dual_image 2>/dev/null)" = "1" ] &&\
[ -n "$(find_mtd_part backup)" ] && {
PART_NAME=backup
if [ "$(fw_printenv -n bootactive 2>/dev/null)" = "1" ]; then
fw_setenv bootactive 2 || exit 1
else
fw_setenv bootactive 1 || exit 1
fi
}
;;
mikrotik,rb750gr3|\
mikrotik,rbm11g|\
mikrotik,rbm33g)
[ -z "$(rootfs_type)" ] && mtd erase firmware
;;
asus,rt-ac65p|\
asus,rt-ac85p)
echo "Backing up firmware"
dd if=/dev/mtd4 bs=1024 count=4096 > /tmp/backup_firmware.bin
dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
;;
esac
ramips: add support for Ubiquiti EdgeRouter X (UBNT-ERX) This router is based on MT7621 SoC, no wifi, no usb, nand. Works: * Boots. * Ethernet. * Switch. * Button (reset). * Flashing OpenWrt from stock firmware. * Upgrading OpenWrt. Doesn't work: * No GPIO leds. All leds are controlled by switch, but stock firmware was able to control them. * SoC has crypto engine but no open driver. * SoC has nat acceleration, but no open driver. * This router has 2MB spi flash soldered in but MT nand/spi drivers do not support pin sharing, so it is not accessable and disabled. Stock firmware could read it and it was empty. * PoE out. Router has serial pins populated. If looking at the top of the router, then counting from Eth sockets pins go as: 'GND, RX, TX, GND'. 3.3v, 57600. U-boot bootloader supports tftpboot, controlled from serial. This router has two kernel partitions: 'live' and 'backup'. They are swapped during flashing (on both stock and OpenWrt). Active partition is controlled by a flag in a factory partition. U-boot has custom command to switch active kernel partition. Kernel partitions are 'bare flash' 3MB. Stock bootloader has no UBI support. Stock rootfs is UBIFS. Flashing procedure. Stock firmware uses custom kernel patch to mount squashfs from a file that is located on UBIFS volume. This makes wiping out this volume from within stock firmware difficult. Instead this patch builds image that is flashable by stock firmware and contains initrams image (with minimal set of packages to fit into kernel partition). Once this is flashed one can reboot into initramfs OpenWrt and use sysupgrade to flash OpenWrt including rootfs into nand. Note: factory image is only built if initramfs image is enabled. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com> SVN-Revision: 47881
9 years ago
case "$board" in
asus,rt-ac65p|\
asus,rt-ac85p|\
hiwifi,hc5962|\
netgear,r6220|\
netgear,r6260|\
ramips: add support for Netgear R6350 Netgear R6350 is a wireless router, aka Netgear AC1750. Specification: - SoC: Mediatek MT7621AT (2 CPU cores, 4 threads) - RAM: 128MiB (Nanya NT5CC64M16GP-DI) - ROM: 128MiB NAND Flash (Macronix MX30LF1G18AC-TI) - Wireless: for 11b/g/n (upto 300Mbps): MT7603 for 11a/ac (upto 1450Mbps) : MT7615, is not avaliable now - Ethernet LAN speed: up to 1000Mbps - Ethernet LAN ports: 4 - Ethernet WAN speed: up to 1000Mbps - Ethernet WAN ports: 1 - USB ports: 1 (USB 2.0) - LEDs: 4 (all can be controlled by SoC's GPIO) - buttons: 2 - serial ports: unknown Installation through telnet: - Copy kernel.bin and rootfs.bin to a USB flash disk, plug to usb port on the router. - Enable telnet with link: http://192.168.1.1/setup.cgi?todo=debug (login if required, default: admin password) - You will see "Debug Enabled!" - Telnet 192.168.1.1 and login with "root" - ls /mnt/shares/ to find out path of your USB disk. 'myUdisk' for example. - cd /mnt/shares/myUdisk - mtd_write write rootfs.bin Rootfs - mtd_write write kernel.bin Kernel - reboot recovery when bricked: nmrpflash can be used to recover to the netgear firmware if a broken image was flashed. The SC_PART_MAP partition suggests that an on flash partition table exists. After implementing a partition parser/builder for the sercom partition format, the definitions don't match the flash layout used by the stock firmware. It either means the partition format has not yet been completely understood or it isn't used by the stock firmware. For now, use fixed partitions instead. Signed-off-by: NOGUCHI Hiroshi <drvlabo@gmail.com> [apply latest ramips changes and document the on flash partition map issues] Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
netgear,r6350|\
netgear,r6850|\
xiaomi,mir3g|\
ramips: add support for Xiaomi Mi Router 3 Pro Hardware: CPU: MediaTek MT7621AT (2x880MHz) RAM: 512MB DDR3 FLASH: 256MB NAND WiFi: 2.4GHz 4x4 MT7615 b/g/n (Needs driver, See Issues!) WiFI: 5GHz 4x4 MT7615 a/n/ac (Needs driver, See Issues!) USB: 1x 3.0 ETH: 1x WAN 10/100/1000 3x LAN 10/100/1000 LED: Power/Status BTN: RESET UART: 115200 8n1 Partition layout and boot: Stock Xiaomi firmware has the MTD split into (among others) - kernel0 (@0x200000) - kernel1 (@0x600000) - rootfs0 - rootfs1 - overlay (ubi) Xiaomi uboot expects to find kernels at 0x200000 & 0x600000 referred to as system 1 & system 2 respectively. a kernel is considered suitable for handing control over if its linux magic number exists & uImage CRC are correct. If either of those conditions fail, a matching sys'n'_fail flag is set in uboot env & a restart performed in the hope that the alternate kernel is okay. If neither kernel checksums ok and both are marked failed, system 2 is booted anyway. Note uboot's tftp flash install writes the transferred image to both kernel partitions. Installation: Similar to the Xiaomi MIR3G, we keep stock Xiaomi firmware in kernel0 for ease of recovery, and install OpenWRT into kernel1 and after. The installation file for OpenWRT is a *squashfs-factory.bin file that contains the kernel and a ubi partition. This is flashed as follows: nvram set flag_try_sys1_failed=1 nvram set flag_try_sys2_failed=0 nvram commit dd if=factory.bin bs=1M count=4 | mtd write - kernel1 dd if=factory.bin bs=1M skip=4 | mtd write - rootfs0 reboot Reverting to stock: The part of stock firmware we've kept in kernel0 allows us to run stock recovery, which will re-flash stock firmware from a *.bin file on a USB. For this we do the following: fw_setenv flag_try_sys1_failed 0 fw_setenv flag_try_sys2_failed 1 reboot After reboot the LED status light will blink red, at which point pressing the 'reset' button will cause stock firmware to be installed from USB. Issues: OpenWRT currently does not have support for the MT7615 wifi chips. There is ongoing work to add mt7615 support to the open source mt76 driver. Until that support is in place, there are closed-source kernel modules that can be used. See: https://forum.openwrt.org/t/support-for-xiaomi-wifi-r3p-pro/20290/170 Signed-off-by: Ozgur Can Leonard <ozgurcan@gmail.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [02_network remaps, Added link to notes]
5 years ago
xiaomi,mir3p)
nand_do_upgrade "$1"
ramips: add support for Ubiquiti EdgeRouter X (UBNT-ERX) This router is based on MT7621 SoC, no wifi, no usb, nand. Works: * Boots. * Ethernet. * Switch. * Button (reset). * Flashing OpenWrt from stock firmware. * Upgrading OpenWrt. Doesn't work: * No GPIO leds. All leds are controlled by switch, but stock firmware was able to control them. * SoC has crypto engine but no open driver. * SoC has nat acceleration, but no open driver. * This router has 2MB spi flash soldered in but MT nand/spi drivers do not support pin sharing, so it is not accessable and disabled. Stock firmware could read it and it was empty. * PoE out. Router has serial pins populated. If looking at the top of the router, then counting from Eth sockets pins go as: 'GND, RX, TX, GND'. 3.3v, 57600. U-boot bootloader supports tftpboot, controlled from serial. This router has two kernel partitions: 'live' and 'backup'. They are swapped during flashing (on both stock and OpenWrt). Active partition is controlled by a flag in a factory partition. U-boot has custom command to switch active kernel partition. Kernel partitions are 'bare flash' 3MB. Stock bootloader has no UBI support. Stock rootfs is UBIFS. Flashing procedure. Stock firmware uses custom kernel patch to mount squashfs from a file that is located on UBIFS volume. This makes wiping out this volume from within stock firmware difficult. Instead this patch builds image that is flashable by stock firmware and contains initrams image (with minimal set of packages to fit into kernel partition). Once this is flashed one can reboot into initramfs OpenWrt and use sysupgrade to flash OpenWrt including rootfs into nand. Note: factory image is only built if initramfs image is enabled. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com> SVN-Revision: 47881
9 years ago
;;
ubiquiti,edgerouterx|\
ubiquiti,edgerouterx-sfp)
platform_upgrade_ubnt_erx "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}