lede/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
AmadeusGhost a1807936af
ramips: add xiaomi_miwifi-r3 support (#3839)
* ramips: add xiaomi_miwifi-r3 support

Specification:
 - CPU: 580 MHz
 - Flash size: 128 MiB NAND
 - RAM size: 128 MiB DDR2
 - Wireless No1: SoC-integrated: MT7620A 2x2 MIMO 802.11b/g/n (2.4 GHz)
 - Wireless No2: On-board chip: MT7612E 2x2 MIMO 802.11a/n/ac (5 GHz)
 - Switch: MT7620 built-in 10/100 switch w/ vlan support
 - USB: 2.0 x1

Flash instructions:
 1. access ssh via https://wiki.openwrt.org/toh/xiaomi/mir3
 2. in ssh:
      nvram set flag_last_success=1
      nvram set boot_wait=on
      nvram set uart_en=1
      nvram commit
      mtd write lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin kernel1
      mtd write lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin rootfs0
      reboot

If you want to revert back to stock fw while on LEDE:
  insert usb stick (FAT/FAT32) with stock fw renamed to miwifi.bin
  fw_setenv flag_last_success 0
  power off the device
  hold the reset button and power on the device, keep holding the reset button until yellow led starts blinking.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>

* ramips: add mt7620-nand driver for NAND flash

This add the mt7620-nand driver
and enable nand ubifs for subtarget mt7620

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>

Co-authored-by: Chen Minqiang <ptpt52@gmail.com>
2020-03-17 01:39:45 +08:00

45 lines
1.1 KiB
Bash
Executable File

#
# 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
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
alfa-network,ac1200rm|\
alfa-network,r36m-e4g|\
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"
;;
xiaomi,miwifi-r3)
# this make it compatible with breed
dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock"
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi X-WRT && CI_KERNPART_EXT="kernel_stock"
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi NATCAP && CI_KERNPART_EXT="kernel0_rsvd"
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}