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.
openwrt/target/linux/ramips/base-files/lib/upgrade/platform.sh

74 lines
1.2 KiB
Bash

#
# Copyright (C) 2010 OpenWrt.org
#
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
platform_check_image() {
return 0
}
ramips: Add support for Mikrotik RouterBOARD RBM33g This commit adds support for the Mikrotik RouterBOARD RBM33g. =Hardware= The RBM33g is a mt7621 based device featuring three gigabit ports, 2 miniPCIe slots with sim card sockets, 1 M.2 slot, 1 USB 3.0 port and a male onboard RS-232 serial port. Additionally there are a lot of accessible GPIO ports and additional buses like i2c, mdio, spi and uart. ==Switch== The three Ethernet ports are all connected to the internal switch of the mt7621 SoC: port 0: Ethernet Port next to barrel jack with PoE printed on it port 1: Innermost Ethernet Port on opposite side of RS-232 port port 2: Outermost Ethernet Port on opposite side of RS-232 port port 6: CPU ==Flash== The device has two spi flash chips. The first flash chips is rather small (512 kB), connected to CS0 by default and contains only the RouterBOOT bootloader and some factory information (e.g. mac address). The second chip has a size of 16 MB, is by default connected to CS1 and contains the firmware image. ==PCIe== The board features three PCIe-enabled slots. Two of them are miniPCIe slots (PCIe0, PCIe1) and one is a M.2 (Key M) slot (PCIe2). Each of the miniPCIe slots is connected to a dedicated mini SIM socket on the back of the board. Power to all three PCIe-enabled slots is controlled via GPIOs on the mt7621 SoC: PCIe0: GPIO9 PCIe1: GPIO10 PCIe2: GPIO11 ==USB== The board has one external USB 3.0 port at the rear. Additionally PCIe port 0 has a permanently enabled USB interface. PCIe slot 1 shares its USB interface with the rear USB port. Thus only either the rear USB port or the USB interface of PCIe slot 1 can be active at the same time. The jumper next to the rear USB port controls which one is active: open: USB on PCIe 1 is active closed: USB on rear USB port is active ==Power== The board can accept both, passive PoE and external power via a 2.1 mm barrel jack. The input voltage range is 11-32 V. =Installation= ==Prerequisites== A USB -> RS-232 Adapter and a null modem cable are required for installation. To install an OpenWRT image to the device two components must be built: 1. A openwrt initramfs image 2. A openwrt sysupgrade image ===initramfs & sysupgrade image=== Select target devices "Mikrotik RBM33G" in openwrt menuconfig and build the images. This will create the images "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" and "openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" in the output directory. ==Installing== **Make sure to back up your RouterOS license in case you do ever want to go back to RouterOS using "/system license output" and back up the created license file.** Serial settings: 115200 8N1 The installation is a two-step process. First the "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" must be booted via tftp: 1. Set up a dhcp server that points the bootfile to tftp server serving the "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" initramfs image 2. Connect to WAN port (left side, next to sys-LED and power indicator) 3. Connect to serial port of board 4. Power on board and enter RouterBOOT setup menu 5. Set boot device to "boot over ethernet" 6. Set boot protocol to "dhcp protocol" (can be omitted if DHCP server allows dynamic bootp) 6. Save config 7. Wait for board to boot via Ethernet On the serial port you should now be presented with the OpenWRT boot log. The next steps will install OpenWRT persistently. 1. Copy "openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" to the device using scp. 2. Write openwrt to flash using "sysupgrade openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" Once the flashing completes reboot the router and let it boot from flash. It should boot straight to OpenWRT. Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years ago
platform_pre_upgrade() {
local board=$(board_name)
case "$board" in
mikrotik,rb750gr3|\
ramips: add support for MikroTik RouterBOARD RBM11g This commit adds support for the MikroTik RouterBOARD RBM11g. =Hardware= The RBM11g is a mt7621 based device featuring one GbE port and one miniPCIe slot with a sim card socket and USB 2.0. ==Switch== The single onboard Ethernet port is connected the CPU directly. The internal switch of the mt7621 SoC is disabled. ==Flash== The device has one spi nor flash chip. It is a 128 Mbit winbond 25Q128FVS connected to CS0. ==PCIe== The board features a single miniPCIe slot. It has a dedicated mini SIM socket and a USB 2.0 port. Power to the miniPCIe slot is controlled via GPIO9. ==USB== There are no external USB ports. ==Power== The board can accept both, passive PoE and external power via a 2.1 mm barrel jack (center-positive). The input voltage range is 11-32 V. ==Serial port== The device does have an onboard UART on an unpopulated header next to the flash chip: GND: pin 2 TX: pin 7 RX: pin 6 Settings: 115200, 8N1 See below illustration for positioning of the header. 0 = screw hole * = some pin T = TX pin R = RX pin G = GND pin Pinout: +--------------- |O | __ | / \ | \__/ | | | | +---+ | |RAM| | +--+ | | | |**| <- unpopulated header with UART | |*T| +---+ | |R*| +--------+ | |**| | | | |G*| | CPU | | +--+ | | | +--+ | | | | | +--------+ | +--+ <- flash chip |O | +-----+ | | | |+--+ | | || | | | +--------------------- =Installation= To install an OpenWRT image to the device two components must be built: 1. A openwrt initramfs image 2. A openwrt sysupgrade image ===initramfs & sysupgrade image=== Select target devices "Mikrotik RBM11G" in openwrt menuconfig and build the images. This will create the images "openwrt-ramips-mt7621-mikrotik_rbm11g-initramfs-kernel.bin" and "openwrt-ramips-mt7621-mikrotik_rbm11g-squashfs-sysupgrade.bin" in the output directory. ==Installing== **Make sure to back up your RouterOS license in case you do ever want to go back to RouterOS using "/system license output" and back up the created license file.** When rebooted the board will try booting via ethernet first. If your board does not boot via ethernet automatically you will have to attach to the serial port and set ethernet as boot device within RouterBOOT. 1. Set up a dhcp server that points the bootfile to tftp server serving the "openwrt-ramips-mt7621-mikrotik_rbm11g-initramfs-kernel.bin" initramfs image 2. Connect to ethernet port on board 3. Power on the board 4. Wait for OpenWrt to boot Right now OpenWrt will be running with a SSH server listening. Now OpenWrt must be flashed to the devices flash: 1. Copy "openwrt-ramips-mt7621-mikrotik_rbm11g-squashfs-sysupgrade.bin" to the device using scp. 2. Write openwrt to flash using "sysupgrade openwrt-ramips-mt7621-mikrotik_rbm11g-squashfs-sysupgrade.bin" Once the flashing completes the board will reboot. Disconnect from the devices ethernet port or stop the DHCP/TFTP server to prevent the device from booting via ethernet again. The device should now boot straight to OpenWrt. Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years ago
mikrotik,rbm11g|\
ramips: Add support for Mikrotik RouterBOARD RBM33g This commit adds support for the Mikrotik RouterBOARD RBM33g. =Hardware= The RBM33g is a mt7621 based device featuring three gigabit ports, 2 miniPCIe slots with sim card sockets, 1 M.2 slot, 1 USB 3.0 port and a male onboard RS-232 serial port. Additionally there are a lot of accessible GPIO ports and additional buses like i2c, mdio, spi and uart. ==Switch== The three Ethernet ports are all connected to the internal switch of the mt7621 SoC: port 0: Ethernet Port next to barrel jack with PoE printed on it port 1: Innermost Ethernet Port on opposite side of RS-232 port port 2: Outermost Ethernet Port on opposite side of RS-232 port port 6: CPU ==Flash== The device has two spi flash chips. The first flash chips is rather small (512 kB), connected to CS0 by default and contains only the RouterBOOT bootloader and some factory information (e.g. mac address). The second chip has a size of 16 MB, is by default connected to CS1 and contains the firmware image. ==PCIe== The board features three PCIe-enabled slots. Two of them are miniPCIe slots (PCIe0, PCIe1) and one is a M.2 (Key M) slot (PCIe2). Each of the miniPCIe slots is connected to a dedicated mini SIM socket on the back of the board. Power to all three PCIe-enabled slots is controlled via GPIOs on the mt7621 SoC: PCIe0: GPIO9 PCIe1: GPIO10 PCIe2: GPIO11 ==USB== The board has one external USB 3.0 port at the rear. Additionally PCIe port 0 has a permanently enabled USB interface. PCIe slot 1 shares its USB interface with the rear USB port. Thus only either the rear USB port or the USB interface of PCIe slot 1 can be active at the same time. The jumper next to the rear USB port controls which one is active: open: USB on PCIe 1 is active closed: USB on rear USB port is active ==Power== The board can accept both, passive PoE and external power via a 2.1 mm barrel jack. The input voltage range is 11-32 V. =Installation= ==Prerequisites== A USB -> RS-232 Adapter and a null modem cable are required for installation. To install an OpenWRT image to the device two components must be built: 1. A openwrt initramfs image 2. A openwrt sysupgrade image ===initramfs & sysupgrade image=== Select target devices "Mikrotik RBM33G" in openwrt menuconfig and build the images. This will create the images "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" and "openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" in the output directory. ==Installing== **Make sure to back up your RouterOS license in case you do ever want to go back to RouterOS using "/system license output" and back up the created license file.** Serial settings: 115200 8N1 The installation is a two-step process. First the "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" must be booted via tftp: 1. Set up a dhcp server that points the bootfile to tftp server serving the "openwrt-ramips-mt7621-mikrotik_rbm33g-initramfs-kernel.bin" initramfs image 2. Connect to WAN port (left side, next to sys-LED and power indicator) 3. Connect to serial port of board 4. Power on board and enter RouterBOOT setup menu 5. Set boot device to "boot over ethernet" 6. Set boot protocol to "dhcp protocol" (can be omitted if DHCP server allows dynamic bootp) 6. Save config 7. Wait for board to boot via Ethernet On the serial port you should now be presented with the OpenWRT boot log. The next steps will install OpenWRT persistently. 1. Copy "openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" to the device using scp. 2. Write openwrt to flash using "sysupgrade openwrt-ramips-mt7621-mikrotik_rbm33g-squashfs-sysupgrade.bin" Once the flashing completes reboot the router and let it boot from flash. It should boot straight to OpenWRT. Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years ago
mikrotik,rbm33g)
[ -z "$(rootfs_type)" ] && mtd erase firmware
;;
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
platform_nand_pre_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
ubnt-erx|\
ubnt-erx-sfp)
platform_upgrade_ubnt_erx "$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
;;
esac
}
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
alfa-network,ac1200rm|\
alfa-network,awusfree1|\
alfa-network,tube-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
}
default_do_upgrade "$1"
;;
hc5962|\
r6220|\
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|\
ubnt-erx|\
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
ubnt-erx-sfp|\
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
;;
ramips: add support for Archer C50 v4 This adds support for the TP-Link Archer C50 v4. It uses the same hardware as the v3 variant, sharing the same FCC-ID. CPU: MediaTek MT7628 (580MHz) RAM: 64M DDR2 FLASH: 8M SPI WiFi: 2.4GHz 2x2 MT7628 b/g/n integrated WiFI: 5GHz 2x2 MT7612 a/n/ac ETH: 1x WAN 4x LAN LED: Power, WiFi2, WiFi5, LAN, WAN, WPS BTN: WPS/WiFi, RESET UART: Near ETH ports, 115200 8n1, TP-Link pinout Create Factory image -------------------- As all installation methods require a U-Boot to be integrated into the Image (and we do not ship one with the image) we are not able to create an image in the OpenWRT build-process. Download a TP-Link image from their Wesite and a OpenWRT sysupgrade image for the device and build yourself a factory image like following: TP-Link image: tpl.bin OpenWRT sysupgrade image: owrt.bin > dd if=tpl.bin of=boot.bin bs=131584 count=1 > cat owrt.bin >> boot.bin Installing via Web-UI --------------------- Upload the boot.bin via TP-Links firmware upgrade tool in the web-interface. Installing via Recovery ----------------------- Activate Web-Recovery by beginning the upgrade Process with a Firmware-Image from TP-Link. After starting the Firmware Upgrade, wait ~3 seconds (When update status is switching to 0%), then disconnect the power supply from the device. Upgrade flag (which activates Web-Recovery) is written before the OS-image is touched and removed after write is succesfull, so this procedure should be safe. Plug the power back in. It will come up in Recovery-Mode on 192.168.0.1. When active, all LEDs but the WPS LED are off. Remeber to assign yourself a static IP-address as DHCP is not active in this mode. The boot.bin can now be uploaded and flashed using the web-recovery. Installing via TFTP ------------------- Prepare an image like following (Filenames from factory image steps apply here) > dd if=/dev/zero of=tp_recovery.bin bs=196608 count=1 > dd if=tpl.bin of=tmp.bin bs=131584 count=1 > dd if=tmp.bin of=boot.bin bs=512 skip=1 > cat boot.bin >> tp_recovery.bin > cat owrt.bin >> tp_recovery.bin Place tp_recovery.bin in root directory of TFTP server and listen on 192.168.0.66/24. Connect router LAN ports with your computer and power up the router while pressing the reset button. The router will download the image via tftp and after ~1 Minute reboot into OpenWRT. U-Boot CLI ---------- U-Boot CLI can be activated by holding down '4' on bootup. Dual U-Boot ----------- This is the first TP-Link MediaTek device to feature a split-uboot design. The first (factory-uboot) provides recovery via TFTP and HTTP, jumping straight into the second (firmware-uboot) if no recovery needs to be performed. The firmware-uboot unpacks and executed the kernel. Web-Recovery ------------ TP-Link integrated a new Web-Recovery like the one on the Archer C7v4 / TL-WR1043v5. Stock-firmware sets a flag in the "romfile" partition before beginning to write and removes it afterwards. If the router boots with this flag set, bootloader will automatically start Web-recovery and listens on 192.168.0.1. This way, the vendor-firmware or an OpenWRT factory image can be written. By doing the same while performing sysupgrade, we can take advantage of the Web-recovery in OpenWRT. It is important to note that Web-Recovery is only based on this flag. It can't detect e.g. a crashing kernel or other means. Once activated it won't boot the OS before a recovery action (either via TFTP or HTTP) is performed. This recovery-mode is indicated by an illuminated WPS-LED on boot. Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
tplink,c50-v4)
MTD_ARGS="-t romfile"
default_do_upgrade "$1"
ramips: add support for Archer C50 v4 This adds support for the TP-Link Archer C50 v4. It uses the same hardware as the v3 variant, sharing the same FCC-ID. CPU: MediaTek MT7628 (580MHz) RAM: 64M DDR2 FLASH: 8M SPI WiFi: 2.4GHz 2x2 MT7628 b/g/n integrated WiFI: 5GHz 2x2 MT7612 a/n/ac ETH: 1x WAN 4x LAN LED: Power, WiFi2, WiFi5, LAN, WAN, WPS BTN: WPS/WiFi, RESET UART: Near ETH ports, 115200 8n1, TP-Link pinout Create Factory image -------------------- As all installation methods require a U-Boot to be integrated into the Image (and we do not ship one with the image) we are not able to create an image in the OpenWRT build-process. Download a TP-Link image from their Wesite and a OpenWRT sysupgrade image for the device and build yourself a factory image like following: TP-Link image: tpl.bin OpenWRT sysupgrade image: owrt.bin > dd if=tpl.bin of=boot.bin bs=131584 count=1 > cat owrt.bin >> boot.bin Installing via Web-UI --------------------- Upload the boot.bin via TP-Links firmware upgrade tool in the web-interface. Installing via Recovery ----------------------- Activate Web-Recovery by beginning the upgrade Process with a Firmware-Image from TP-Link. After starting the Firmware Upgrade, wait ~3 seconds (When update status is switching to 0%), then disconnect the power supply from the device. Upgrade flag (which activates Web-Recovery) is written before the OS-image is touched and removed after write is succesfull, so this procedure should be safe. Plug the power back in. It will come up in Recovery-Mode on 192.168.0.1. When active, all LEDs but the WPS LED are off. Remeber to assign yourself a static IP-address as DHCP is not active in this mode. The boot.bin can now be uploaded and flashed using the web-recovery. Installing via TFTP ------------------- Prepare an image like following (Filenames from factory image steps apply here) > dd if=/dev/zero of=tp_recovery.bin bs=196608 count=1 > dd if=tpl.bin of=tmp.bin bs=131584 count=1 > dd if=tmp.bin of=boot.bin bs=512 skip=1 > cat boot.bin >> tp_recovery.bin > cat owrt.bin >> tp_recovery.bin Place tp_recovery.bin in root directory of TFTP server and listen on 192.168.0.66/24. Connect router LAN ports with your computer and power up the router while pressing the reset button. The router will download the image via tftp and after ~1 Minute reboot into OpenWRT. U-Boot CLI ---------- U-Boot CLI can be activated by holding down '4' on bootup. Dual U-Boot ----------- This is the first TP-Link MediaTek device to feature a split-uboot design. The first (factory-uboot) provides recovery via TFTP and HTTP, jumping straight into the second (firmware-uboot) if no recovery needs to be performed. The firmware-uboot unpacks and executed the kernel. Web-Recovery ------------ TP-Link integrated a new Web-Recovery like the one on the Archer C7v4 / TL-WR1043v5. Stock-firmware sets a flag in the "romfile" partition before beginning to write and removes it afterwards. If the router boots with this flag set, bootloader will automatically start Web-recovery and listens on 192.168.0.1. This way, the vendor-firmware or an OpenWRT factory image can be written. By doing the same while performing sysupgrade, we can take advantage of the Web-recovery in OpenWRT. It is important to note that Web-Recovery is only based on this flag. It can't detect e.g. a crashing kernel or other means. Once activated it won't boot the OS before a recovery action (either via TFTP or HTTP) is performed. This recovery-mode is indicated by an illuminated WPS-LED on boot. Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
;;
*)
default_do_upgrade "$1"
;;
esac
}