1. 程式人生 > >基於MT7688模組的開發筆記8——TFTP方式燒寫Uboot韌體

基於MT7688模組的開發筆記8——TFTP方式燒寫Uboot韌體

通過TFTP方式,燒寫Uboot.bin韌體需要準備tftpd、SecureCRT,還要準備網線,串列埠線。
一、我的MT7688開發板出廠的IP地址為:192.168.1.1/24,所以給電腦設定一個同網段的靜態IP地址。然後用網線將開發板的LAN與電腦的網絡卡連線。如果不知道開發板的IP地址,通過SecureCRT串列埠登入開發板,執行ifconfig可以查看板子的IP地址。
BusyBox v1.12.1 (2015-07-14 09:33:29 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ifconfig
br0       Link encap:Ethernet  HWaddr 00:0C:43:E1:76:28  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:43ff:fee1:7628/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4492 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3103 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:330738 (322.9 KiB)  TX bytes:278487 (271.9 KiB)
二、關於SecureCRT怎樣登入開發板,這個很簡單了,根據廠家的說明需要設定位元率:57600;資料位:8;奇偶校驗:NOne;停止位:1;序列終端長度100毫秒。同時去掉互動視窗,去掉RTS/CTS。
三、前面提到過通過虛擬機器本身的資料夾共享功能實現Windows與Ubuntu的檔案共享,這樣在Linux中我只要將編譯生成的Uboot韌體放到這個資料夾中,在Windows中就可以使用該韌體。於是,我在D盤建了個資料夾tftpd32,共享該資料夾,同時我的tftpd軟體的檔案目錄也是該目錄,這樣在通過tftp方式燒寫韌體時稍微方便點了。如果某些版本的Ubuntu系統無法使用虛擬機器的資料夾共享功能,可以搭建samba服務,參考上文。
四、確保電腦與開發板的IP在同一網段,準備好後就可以開始通過tftp方式燒寫韌體了,按下開發板上的SW1,串口出現Uboot介面如下:
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:May  1 2016  Time:07:58:19
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 


 ##### The CPU freq = 575 MHZ #### 
 estimate memory size =64 Mbytes
RESET MT7628 PHY!!!!!!
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.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

在燒寫的過程中,不要強行中斷!!!!!!
這個時候請快速按下9,要是動作慢了,系統就按照原來的系統啟動了,不過可以重新再來。
下面是我的操作過程:操作的過程中,需要輸入板子的IP、tftp伺服器的IP、Uboot檔案
在燒寫的過程中,不要強行中斷!!!!!!
U-Boot 1.1.3 (May  1 2016 - 07:58:19)


Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
*** Warning - bad CRC, using default environment


============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:May  1 2016  Time:07:58:19
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 


 ##### The CPU freq = 575 MHZ #### 
 estimate memory size =64 Mbytes
RESET MT7628 PHY!!!!!!
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.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
You choosed 9


 0 


9: System Load Boot Loader then write to Flash via TFTP. 
 Warning!! Erase Boot Loader in Flash then burn new one. Are you sure?(Y/N)
 Please Input new ones /or Ctrl-C to discard
        Input device IP (10.10.10.123) ==:192.168.1.1 
        Input server IP (10.10.10.3) ==:192.168.1.32
        Input Uboot filename () ==:uboot.bin
 netboot_common, argc= 3 
 NetTxPacket = 0x83FE4E00 
 KSEG1ADDR(NetTxPacket) = 0xA3FE4E00 
 NetLoop,call eth_halt ! 
 NetLoop,call eth_init ! 
 Trying Eth0 (10/100-M)
 Waitting for RX_DMA_BUSY status Start... done
 ETH_STATE_ACTIVE!! 
TFTP from server 192.168.1.32; our IP address is 192.168.1.1
Filename 'uboot.bin'.
TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: checksum bad
Got ARP REQUEST, return our IP
checksum bad
checksum bad
checksum bad
Got ARP REQUEST, return our IP
checksum bad
Got ARP REQUEST, return our IP
checksum bad
checksum bad
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
checksum bad
checksum bad
Got ARP REQUEST, return our IP
checksum bad
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REPLY, set server/gtwy eth addr (b8:88:e3:7a:66:3a)
Got it
##################
done
Bytes transferred = 88020 (157d4 hex)
NetBootFileXferSize= 000157d4
.
.
.
Done!
五、燒寫完成後,板子也會啟動起來

U-Boot 1.1.3 (May  1 2016 - 07:58:19)
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
*** Warning - bad CRC, using default environment
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:May  1 2016  Time:07:58:19
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
 ##### The CPU freq = 575 MHZ #### 
 estimate memory size =64 Mbytes
RESET MT7628 PHY!!!!!!
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.
   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:   Linux Kernel Image
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    7277004 Bytes =  6.9 MB
   Load Address: 80000000
   Entry Point:  8000c150
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 8000c150) ...
## Giving linux memsize in MB, 64
Starting kernel ...
LINUX started...
 THIS IS ASIC
Welcome to
     __   ___  _____  _____   _  _______ ______  _____  _   ___
    |  \ /   ||  ___||  __ \ | ||  __  ||__  __||  ___|| | /  /
    |   ^    || |__  | |  \ \| || |  | |  | |   | |__  | |/  /
    |  | |   ||  ___|| |  | || || |__| |  | |   |  ___||    \
    |  | |   || |___ | |__/ /| ||  __  |  | |   | |___ | |\  \
    |__| |___||_____||_____/ |_||_|  |_|  |_|   |_____||_| \__\

                        = Everyday Genius =
                            
make_audio_html.sh
init: can't log to /dev/tty5
starting pid 154, tty '/dev/ttyS1': '/bin/sh'
BusyBox v1.12.1 (2015-07-14 09:33:29 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls
etc     sys     mnt     init    usr     dev     etc_ro  lib
home    bin     proc    var     media   sbin    tmp