mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
3c0e2aa63e
I-O DATA WN-DX1167R is a 2.4/5 GHz band 11ac rotuer, based on MediaTek MT7621A. Specification: - SoC : MediaTek MT7621A - RAM : DDR3 128 MiB - Flash : NAND 128 MiB - WLAN : MediaTek MT7615D (2.4/5 GHz, 2T2R) - Ethernet : 5x 10/100/1000 Mbps - Switch : MediaTek MT7621A (MT7530) - LEDs/Input : 2x/3x (2x buttons, 1x slide-switch) - UART : through-hole on PCB - J5: Vcc, TX, RX, NC, GND - 57600 bps Flash instruction using initramfs image: 1. Boot WN-DX1167R normally 2. Access to "http://192.168.0.1/" and open firmware update page ("ファームウェア") 3. Select the OpenWrt initramfs image and click update ("更新") button to perform firmware update 4. On the initramfs image, perform sysupgrade with squashfs-sysupgrade image 5. Wait ~120 seconds to complete flashing Notes: - configuration in DeviceTree of DBDC (Dual-Band-Dual-Concurrent) mode for MT7615D chip is not supported in mt76 driver - last 0x80000 (512 KiB) in NAND flash is not used on stock firmware - stock firmware requires "customized uImage header" by MSTC (MitraStar Technology Corp.), but U-Boot doesn't - uImage magic (0x0 - 0x3) : 0x434F4D43 (COMC) - header crc32 (0x4 - 0x7) : with data length and data crc32 - image name (0x20 - 0x37) : model ID and firmware versions - data length (0x38 - 0x3b): kernel + rootfs - data crc32 (0x3c - 0x3f) : kernel + rootfs Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Reviewed-by: Sungbo Eo <mans0n@gorani.run>
56 lines
1.7 KiB
Bash
56 lines
1.7 KiB
Bash
#
|
|
# Copyright (C) 2019 OpenWrt.org
|
|
#
|
|
|
|
. /lib/functions.sh
|
|
|
|
iodata_mstc_prepare_fail() {
|
|
echo "failed to check and prepare the environment, rebooting..."
|
|
umount -a
|
|
reboot -f
|
|
}
|
|
|
|
# I-O DATA devices manufactured by MSTC (MitraStar Technology Corp.)
|
|
# have two important flags:
|
|
# - bootnum: switch between two os images
|
|
# use 1st image in OpenWrt
|
|
# - debugflag: enable/disable debug
|
|
# users can interrupt Z-Loader for recovering the device if enabled
|
|
iodata_mstc_upgrade_prepare() {
|
|
local persist_mtd="$(find_mtd_part persist)"
|
|
local factory_mtd="$(find_mtd_part factory)"
|
|
|
|
if [ -z "$persist_mtd" -o -z "$factory_mtd" ]; then
|
|
echo 'cannot find mtd partition(s), "factory" or "persist"'
|
|
iodata_mstc_prepare_fail
|
|
fi
|
|
|
|
local bootnum=$(hexdump -s 4 -n 1 -e '"%x"' ${persist_mtd})
|
|
local debugflag=$(hexdump -s 65141 -n 1 -e '"%x"' ${factory_mtd})
|
|
|
|
if [ "$bootnum" != "1" -a "$bootnum" != "2" ]; then
|
|
echo "failed to get bootnum, please check the value at 0x4 in ${persist_mtd}"
|
|
iodata_mstc_prepare_fail
|
|
fi
|
|
if [ "$debugflag" != "0" -a "$debugflag" != "1" ]; then
|
|
echo "failed to get debugflag, please check the value at 0xFE75 in ${factory_mtd}"
|
|
iodata_mstc_prepare_fail
|
|
fi
|
|
echo "current: bootnum => ${bootnum}, debugflag => ${debugflag}"
|
|
|
|
if [ "$bootnum" = "2" ]; then
|
|
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=4 conv=notrunc of=${persist_mtd} 2>/dev/null); then
|
|
echo "failed to set bootnum"
|
|
iodata_mstc_prepare_fail
|
|
fi
|
|
echo "### switch to 1st os-image on next boot ###"
|
|
fi
|
|
if [ "$debugflag" = "0" ]; then
|
|
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=65141 conv=notrunc of=${factory_mtd} 2>/dev/null); then
|
|
echo "failed to set debugflag"
|
|
iodata_mstc_prepare_fail
|
|
fi
|
|
echo "### enable debug ###"
|
|
fi
|
|
}
|