飛思卡爾燒寫工具mfgtools的使用

轉載地址:https://www.cnblogs.com/fah936861121/p/7344085.html

MFGTool是飛思卡爾提供的燒寫工具,使用起來非常方便。但是,在使用MFGTool有幾點是需要注意的,否則就會在燒寫過程中遇到一些問題:
1、在使用MFGTool前,文件cfg.ini 和 UICfg.ini是必須要在同一個文件夾下,同時這兩個文件一定要配置正確。
         UICfg.ini用來配置每次同時可以燒寫開發板的個數:
             [UICfg]
             PortMgrDlg=1
       cfg.ini用來配置芯片類型和板子信息以及燒寫內容存儲方式:
[profiles]
chip = MX6DL Linux Update   -----------芯片爲i.mx6dl
 
[platform]
board = SabreSD                       ------------板子型號
 
[LIST]
name = i.MX6DL-ubuntu-SabreSD-SD ---------------燒寫內容及存儲方式
cfg.ini一定要根據你的板子和要燒寫到哪裏來設置,設置的信息和你使用的板子要匹配。
2、ucl2.xml
MFGTool燒寫過程是完全按照ucl2.xml進行的。具體ucl2.xml的內容你可以到
MFGTool-Dir/Profiles/MX6DL Linux Update/OS Firmware下查看。ucl2.xml中的燒寫命令爲linux命令(文檔Manufacturing Tool V2 Quick Start Guide中有介紹)這裏不再詳述。
3、
boot mode方式要正確
在燒寫前要設置板子爲下載模式,纔可以進行燒寫。
總結一下使用MFGTool燒寫過程如下:
1)配置
cfg.ini和UICfg.ini文件
2)設置boot mode爲download模式
3)用OTG-USB線連接開發板和PC機
4)打開終端,並運行MfgTool2.exe
5)給開發板上電,出現如下HID-compliant device,點擊Start開始下載。

 

 

4、如何使用MFGTool燒寫image到你自己設計的板子上? 
編譯生成板子上需要跑的U-boot、uImage和文件系統rootfs(具體操作查看你參考設計的板子的User Guider中有詳細的步驟和介紹)
Sending U-Boot
write U-Boot to sd card
Sending kernel uImage
write kernel image to sd card………….
     Sending and writting rootfs
根據ucl2.xml文件中的內容來創建你自己設計板子的燒寫過程,只要修改原有的U-Boot 和 kernel就夠了。
 
  以下時ucl2.xml文件:
 <CFG>
<STATE name="BootStrap" dev="MX6Q" vid="15A2" pid="0054"/><STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/>

<STATE name="Updater"   dev="MSC" vid="066F" pid="37FF"/>
</CFG>
//全局變量 
//ucl2.xml將燒錄過程分成兩個階段:BootStrap和Updater 
//dev、vid和pid:分別對應兩個階段的設備名、設備對應連接的USB vid和pid號 
//針對imx6系列,在 BootStrap階段,有效的設備名只有MX6Q、MX6D、MX6SL。在Updater階段,有效的設備名只有MSC


<LIST name="Android-Marsboard-eMMC" desc="Choose eMMC as media">
//根據cfg.ini 文件中定義的name 選擇(ucl2.xml中LIST name要與cfg.ini文件中定義的name相對應)


<CMD state="BootStrap" type="boot" body="BootStrap" file="u-boot.bin">Loading U-boot</CMD>
//下載當前目錄的u-boot.bin 文件到RAM


<CMD state="BootStrap" type="load" file="uImage" address="0x10800000" loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">Loading Kernel.</CMD>
//下載當前目錄的uImage文件到RAM的0x10800000地址處


<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000" loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">Loading Initramfs.</CMD>
//下載當前目錄的initramfs.cpio.gz.uboot文件到內存的0x10C00000地址處


<CMD state="BootStrap" type="jump"> Jumping to OS image. </CMD>
//通知內嵌ROM代碼跳轉到內存中的鏡像執行


<CMD state="Updater" type="push" body="$ flash_eraseall /dev/mtd0">Erasing Boot partition</CMD>
//擦除信息mtd0


<CMD state="Updater" type="push" body="send" file="files/android/u-boot.bin">Sending U-Boot</CMD>
//將files/android/u-boot.bin文件發送到目標機


<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
//燒寫將$FILE下載到/dev/mtd0位置,bs=512,指定讀/寫的blocks大小爲512bytes


<CMD state="Updater" type="push" body="$ flash_eraseall /dev/mtd1">Clear Params</CMD>
//擦除信息mtd1
<CMD state="Updater" type="push" body="send" file="mksdcard-android.sh.tar">Sending partition shell</CMD>
//將files/android/u-boot.bin文件發送到目標機
//將當前目錄的mksdcard-android.sh.tar 分區腳本文件,發送到目標機
<CMD state="Updater" type="push" body="$ tar xf $FILE "> Partitioning...</CMD>
//解壓腳本文件
<CMD state="Updater" type="push" body="$ sh mksdcard-android.sh /dev/mmcblk0"> Partitioning...</CMD>
//執行腳本文件
<CMD state="Updater" type="push" body="$ ls -l /dev/mmc* ">Formatting sd partition</CMD>

//從下面開始燒錄內核、文件系統
<CMD state="Updater" type="push" body="send" file="files/android/boot.img">Sending kernel uImage</CMD>
//將files/android/boot.img 發送到目標機
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0p1">write boot.img</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
//刷新,等待數據傳送完成
<CMD state="Updater" type="push" body="$ mkfs.ext4 -b 4096 -m 0 /dev/mmcblk0p4">Formatting data partition</CMD>

<CMD state="Updater" type="push" body="send" file="mk-encryptable-data-android.sh.tar">Sending data partition shell</CMD>
<CMD state="Updater" type="push" body="$ tar xf $FILE ">Extracting data partition shell</CMD>

<CMD state="Updater" type="push" body="$ sh mk-encryptable-data-android.sh /dev/mmcblk0 /dev/mmcblk0p4">Making data encryptable</CMD>
<CMD state="Updater" type="push" body="$ mkfs.ext4 /dev/mmcblk0p5">Formatting system partition</CMD>
<CMD state="Updater" type="push" body="$ mkfs.ext4 /dev/mmcblk0p6">Formatting cache partition</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>

<CMD state="Updater" type="push" body="$ mkfs.ext4 /dev/mmcblk0p7">Formatting device partition</CMD> 
<CMD state="Updater" type="push" body="pipe dd of=/dev/mmcblk0p5 bs=512" file="files/android/system.img">Sending and writting system.img</CMD>
//利用pipe 傳輸大數據
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
//執行flush刷新操作,等到數據傳輸完畢

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章