IOT | MT7628AN OpenWRT开发与学习


时间2023-06-21


文章目录

  • `IOT` | `MT7628AN` `OpenWRT`开发与学习
  • 1.相关资料
  • 2.开发板示意图
  • 3.上电开机
  • 启动LOG:
  • 4.开发
  • 4-1.`uboot`开发
  • 4-1-1.代码下载
  • 4-1-2.解压交叉编译工具链
  • 查看`gcc342`:
  • 查看`java`版本:
  • 4-1-3.编译
  • 5.备份无线校准文件


1.相关资料

1.Widora模组BIT3.1 BIT5.1b mt7628AN 核心板WIFI 网关御用方案-淘宝网

2.开发资料:Mango Pi official website | Tiny and Elegant SBC | 7688dev

3.备份WI-FI校准数据,非常重要 Mango Pi official website | Tiny and Elegant SBC | backup

4.刷机:Mango Pi official website | Tiny and Elegant SBC | flash

5.widora · GitHub

2.开发板示意图

【MT7628AN】IOT | MT7628AN OpenWRT开发与学习_TCP


【MT7628AN】IOT | MT7628AN OpenWRT开发与学习_TCP_02

3.上电开机

给开发板连上网线USB线(供电和查看串口信息输出);

linux系统控制台登录的默认账户:root,密码:12345678

启动LOG:

Widora by mango,V1.0.9

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fb4000
flash manufacture id: ef, device id 40 19
find flash: W25Q256FV
*** Warning - bad CRC, using default environment

============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Jul 13 2019  Time:11:46:34
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!! ONLY 0
MT7688 gpio init : wled and wdt by mango

if you press the WPS button will automatically enter the Update mode

0
1
2
3
4
5
6
7
8
9
Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   5: Entr ALL LED test mode.
   6: Entr Web failsafe mode.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP.                                                                                                                                  0 
   
3: System Boot system code via Flash.
## Booting image at bc050000 ...
   Image Name:   MIPS OpenWrt Linux-3.18.29
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1150283 Bytes =  1.1 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 3.18.29 (root@iZ2zed141678w8pjz6vc34Z) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r49378) ) #1 Mon Aug 12 16:49:51 CST 2019
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is WIDORA-NEO
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x07ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x07ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x07ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00026c31
[    0.000000] Readback ErrCtl register=00026c31
[    0.000000] Memory: 126272K/131072K available (2544K kernel code, 124K rwdata, 520K rodata, 196K init, 185K bss, 4800K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource_of_init: no matching clocksources found
[    0.000000] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.060000] pid_max: default: 32768 minimum: 301
[    0.060000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080000] pinctrl core: initialized pinctrl subsystem
[    0.080000] NET: Registered protocol family 16
[    0.100000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.110000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.110000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.120000] Switched to clocksource MIPS
[    0.120000] NET: Registered protocol family 2
[    0.130000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.130000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.140000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.150000] TCP: reno registered
[    0.150000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.150000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.160000] NET: Registered protocol family 1
[    0.170000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.180000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.190000] jffs2: version 2.2 (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.200000] msgmni has been set to 246
[    0.210000] io scheduler noop registered
[    0.220000] io scheduler deadline registered (default)
[    0.220000] drivers/phy/phy-ralink-usb.c:ralink_usb_phy_probe[336]
[    0.230000] drivers/phy/phy-ralink-usb.c:ralink_usb_phy_probe[350]
[    0.240000] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.240000] console [ttyS0] disabled
[    0.250000] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.260000] console [ttyS0] enabled
[    0.260000] console [ttyS0] enabled
[    0.260000] bootconsole [early0] disabled
[    0.260000] bootconsole [early0] disabled
[    0.270000] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
[    0.280000] 10000e00.uart2: ttyS2 at MMIO 0x10000e00 (irq = 30, base_baud = 2500000) is a 16550A
[    0.290000] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.300000] m25p80 spi32766.0: w25q256 (32768 Kbytes)
[    0.310000] m25p80 spi32766.0: using chunked io
[    0.310000] 4 ofpart partitions found on MTD device spi32766.0
[    0.320000] Creating 4 MTD partitions on "spi32766.0":
[    0.320000] 0x000000000000-0x000000030000 : "u-boot"
[    0.330000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.340000] 0x000000040000-0x000000050000 : "factory"
[    0.340000] 0x000000050000-0x000002000000 : "firmware"
[    0.410000] 2 uimage-fw partitions found on MTD device firmware
[    0.420000] 0x000000050000-0x000000168d8b : "kernel"
[    0.420000] 0x000000168d8b-0x000002000000 : "rootfs"
[    0.430000] mtd: device 5 (rootfs) set to be root filesystem
[    0.440000] 1 squashfs-split partitions found on MTD device rootfs
[    0.450000] 0x000000620000-0x000002000000 : "rootfs_data"
[    0.460000] ralink_soc_eth 10100000.ethernet eth0: ralink at 0xb0100000, irq 5
[    0.470000] mt7621_wdt 10000100.watchdog: Initialized
[    0.480000] TCP: cubic registered
[    0.480000] NET: Registered protocol family 17
[    0.490000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    0.500000] 8021q: 802.1Q VLAN Support v1.8
[    0.510000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    0.520000] Freeing unused kernel memory: 196K (8031f000 - 80350000)
[    1.770000] init: Console is alive
[    1.780000] init: - watchdog -
[    4.100000] usbcore: registered new interface driver usbfs
[    4.110000] usbcore: registered new interface driver hub
[    4.110000] usbcore: registered new device driver usb
[    4.120000] reg_opt_init
[    4.130000] exFAT: Version 1.2.9
[    4.170000] SCSI subsystem initialized
[    4.180000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.190000] ehci-platform: EHCI generic platform driver
[    4.360000] U2PHY P0 set SRCTRL calibration value: 7
[    4.360000] ehci-platform 101c0000.ehci: EHCI Host Controller
[    4.370000] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    4.370000] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    4.400000] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    4.400000] hub 1-0:1.0: USB hub found
[    4.410000] hub 1-0:1.0: 1 port detected
[    4.410000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.420000] ohci-platform: OHCI generic platform driver
[    4.430000] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    4.430000] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    4.440000] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    4.510000] hub 2-0:1.0: USB hub found
[    4.510000] hub 2-0:1.0: 1 port detected
[    4.530000] MTK MSDC device init.
[    4.570000] mtk-sd: MediaTek MT6575 MSDC Driver
[    4.570000] sdhci: Secure Digital Host Controller Interface driver
[    4.580000] sdhci: Copyright(c) Pierre Ossman
[    4.580000] sdhci-pltfm: SDHCI platform and OF driver helper
[    4.590000] usbcore: registered new interface driver usb-storage
[    4.830000] init: - preinit -
[    5.430000] rt305x-esw 10110000.esw: link changed 0x00
[    5.570000] random: procd urandom read with 8 bits of entropy available
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    8.860000] mount_root: loading kmods from internal overlay
[    9.330000] jffs2: notice: (365) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.350000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[    9.360000] block: extroot: not configured
[    9.490000] jffs2: notice: (362) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.740000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[    9.760000] block: extroot: not configured
[    9.760000] mount_root: switching to jffs2 overlay
[    9.790000] procd: - early -
[    9.790000] procd: - watchdog -
[   10.490000] procd: - ubus -
[   11.520000] procd: - init -
Please press Enter to activate this console.
[   12.550000] NET: Registered protocol family 10
[   12.630000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   12.640000] i2c /dev entries driver
[   12.850000] PandoraBox MT76X8 AP Driver Version-4.1.0.0(Aug  8 2019 08:13:30).
[   12.910000] i2c-mt7621 10000900.i2c: clock 100 kHz
[   12.930000] Linux video capture interface: v2.00
[   12.970000] Enable Ralink GDMA Controller Module 
[   12.970000] GDMA IP Version=3
[   12.990000] *******Enter codec_wm8960_i2c_probe********
[   13.000000] soc-audio soc-audio: ASoC: machine MTK APSoC I2S should use snd_soc_register_card()
[   13.010000] wm8960 0-001a: No platform data supplied
[   13.010000] ****** wm8960_preinit ******
[   13.520000] soc-audio soc-audio: wm8960-hifi <-> mt76xx-i2s mapping ok
[   13.540000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   13.560000] nf_conntrack version 0.5.0 (1976 buckets, 7904 max)
[   13.590000] usbcore: registered new interface driver uvcvideo
[   13.600000] USB Video Class driver (1.1.1)
[   13.620000] xt_time: kernel timezone is -0000
[   13.630000] PPP generic driver version 2.4.2
[   13.640000] NET: Registered protocol family 24
ETHMODE
3
[   18.560000] device eth0 entered promiscuous mode
[   18.560000] br-lan: port 1(eth0) entered forwarding state
[   18.570000] br-lan: port 1(eth0) entered forwarding state
[   20.570000] br-lan: port 1(eth0) entered forwarding state
[   21.750000] =====================================================
[   21.750000] Channel 1 : Busy Time = 37352, Skip Channel = FALSE
[   21.760000] Channel 2 : Busy Time = 38048, Skip Channel = FALSE
[   21.760000] Channel 3 : Busy Time = 34796, Skip Channel = FALSE
[   21.770000] Channel 4 : Busy Time = 22283, Skip Channel = FALSE
[   21.780000] Channel 5 : Busy Time = 24140, Skip Channel = FALSE
[   21.780000] Channel 6 : Busy Time = 22576, Skip Channel = FALSE
[   21.790000] Channel 7 : Busy Time = 25072, Skip Channel = FALSE
[   21.790000] Channel 8 : Busy Time = 16413, Skip Channel = FALSE
[   21.800000] Channel 9 : Busy Time = 21496, Skip Channel = FALSE
[   21.810000] Channel 10 : Busy Time = 26082, Skip Channel = FALSE
[   21.810000] Channel 11 : Busy Time = 27687, Skip Channel = FALSE
[   21.820000] Channel 12 : Busy Time = 27334, Skip Channel = TRUE
[   21.820000] Channel 13 : Busy Time = 29471, Skip Channel = TRUE
[   21.830000] =====================================================
[   21.840000] Rule 3 Channel Busy time value : Min Channel Busy  ==> Select Channel 8 
[   21.840000] Min Channel Busy = 16413
[   21.850000] BW        = 40
[   21.890000] |--------------------------------------------------------|
[   21.900000] |------------Widora wifi driver--version:1.5-------------|
[   21.900000] |Copyright 2016-2019 by WIDORA TECH.  All rights reserved|
[   21.910000] |       This Driver licensing-only runs on Widora HW!    |
[   21.920000] |  Found bug? Please contact widora@qq.com , thanks!     |
[   21.920000] |--------------------------------------------------------|
[   23.680000] br-lan: port 1(eth0) entered disabled state
[   23.680000] device eth0 left promiscuous mode
[   23.690000] br-lan: port 1(eth0) entered disabled state
[   23.700000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   23.730000] device eth0 entered promiscuous mode
[   23.760000] br-lan: port 1(eth0) entered forwarding state
[   23.760000] br-lan: port 1(eth0) entered forwarding state
[   25.120000] device ra0 entered promiscuous mode
[   25.130000] br-lan: port 2(ra0) entered forwarding state
[   25.130000] br-lan: port 2(ra0) entered forwarding state
[   25.760000] br-lan: port 1(eth0) entered forwarding state
[   27.130000] br-lan: port 2(ra0) entered forwarding state

Widora login: 
Widora login: root
Password: [   56.540000] random: nonblocking pool is initialized



BusyBox v1.23.2 (2019-08-12 16:33:28 CST) built-in shell (ash)

 _       ___     __
| |     / (_)___/ /___  _________ _
| | /| / / / __  / __ \/ ___/ __ `/
| |/ |/ / / /_/ / /_/ / /  / /_/ /
|__/|__/_/\__,_/\____/_/   \__,_/
 -----------------------------------------------------
 CHAOS CALMER (Chaos Calmer, r49378) Ver:0.1.9-20190812 by WIDORA
 -----------------------------------------------------
root@Widora:~#

4.开发

编译

4-1.uboot开发

4-1-1.代码下载

git clone git@gitcode.net:project1/mt7688an/u-boot-mt7688.git

或者:git clone git@gitee.com:flyer-iot/u-boot-mt7688.git


4-1-2.解压交叉编译工具链

[lanfeiye@fly-vm mt76x8]$ cd u-boot-mt7688/
[lanfeiye@fly-vm u-boot-mt7688]$ ls
autoconf.h                common     cpu      fs           lib_mips     Makefile              mt7621_ddr.sh  rtc      uboot_README
board                     config.in  CREDITS  httpd        LICENSE      mips_config.mk        net            scripts  uboot_version.h
buildroot-gcc342.tar.bz2  config.mk  disk     include      MAINTAINERS  mkconfig              README         stage1
CHANGELOG                 COPYING    drivers  lib_generic  MAKEALL      mt7621_ddr_param.txt  README.md      tools
[lanfeiye@fly-vm u-boot-mt7688]$ sudo tar xvfj buildroot-gcc342.tar.bz2 -C /opt/
查看gcc342
[lanfeiye@fly-vm opt]$ ls -lh buildroot-gcc342/
total 32K
drwxr-xr-x  2 1010 fly 4.0K 10月  3  2012 bin
drwxr-xr-x 18 1010 fly 4.0K 8月  18  2008 include
drwxr-xr-x  2 1010 fly 4.0K 8月  13  2008 info
drwxr-xr-x  4 1010 fly 4.0K 8月  13  2008 lib
drwxr-xr-x  3 1010 fly 4.0K 8月  13  2008 libexec
drwxr-xr-x  6 1010 fly 4.0K 8月  13  2008 man
lrwxrwxrwx  1 1010 fly   19 10月  3  2012 mipsel-linux -> mipsel-linux-uclibc
drwxr-xr-x  4 1010 fly 4.0K 8月  13  2008 mipsel-linux-uclibc
drwxr-xr-x  3 1010 fly 4.0K 8月  13  2008 usr
查看java版本:
[lanfeiye@fly-vm u-boot-mt7688]$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

4-1-3.编译

[lanfeiye@fly-vm u-boot-mt7688]$ make clean
[lanfeiye@fly-vm u-boot-mt7688]$ make -j4

5.备份无线校准文件

root@Widora:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 01fb0000 00010000 "firmware"
mtd4: 00118d8b 00010000 "kernel"
mtd5: 01e97275 00010000 "rootfs"
mtd6: 019e0000 00010000 "rootfs_data"
root@Widora:~# dd if=/dev/mtd2 of=/www/art.bin
128+0 records in
128+0 records out
root@Widora:~# ls -lh /www/art.bin 
-rw-r--r--    1 root     root       64.0K Jul  5 12:21 /www/art.bin

(主要连接网络)然后通过浏览器下载文件:http://widora.local/art.bin