20160615_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0915 - MfgTool2 Quick Start Guide
  • 1125 - MFGTool2 Update Command List (UCL) User Guide
  • 1400 - MFGTool2 Workflow ucl2.xml SDCard operation list
  • 1455 - MFGTool2 Workflow ucl2.xml SDCard operation list

0915

來玩 MfgTool

先看 Manufacturing Tool V2 (MFGTool2) Quick Start Guide

1125

再看 Manufacturing Tool V2 (MFGTool2) Update Command List (UCL) User Guide

1400

Manufacturing Tool V2 (MFGTool2) Workflow 可知各個零件彼此之間的關係

Overview
This document describes the relationship between MFGTool2.exe, cfg.ini, UICfg.ini, ucl2.xml, the operation list defined in ucl2.xml, and the binary files which will be used in the burning process.
.
The basic function of MFGTool2 is to burn the image to a specific storage on a specific target (board) with a specific SoC.

overview 點出了有哪些零件

The first thing you need to do is to tell MFGTool2 what kind of SoC it works on

  • Q: Why does MFGTool2 need this information?
  • A: The MFGTool2 is based on the USB, different SoCs have different PID/VID, and MFGTool2 needs this information to monitor the device tree to get the exactly right Device on which it manipulates.
    .
  • Q: How to provide this information to MFGTool2?
  • A: By using the ucl2.xml.
    One ucl2.xml is used for a specific SoC.
    At the beginning of the ucl2.xml, a <CFG> pare term defines the SoC name and the PID/VID for it.
    The detailed information about <CFG> can be found in the “Manufacturing Tool V2 UCL user manual.doc”

透過這兩個 Q & A 我們可以在 `Profiles\Linux\OS Firmware\ucl2.xml' 看到

<UCL>
  <CFG>
    ...
    <STATE name="BootStrap" dev="MX6UL" vid="15A2" pid="007D"/>
    ...
  </CFG>
  ...
</UCL>

我們在這邊便定義了

  • SoC name - dev="MX6UL"
  • PID - pid="007D"
  • VID - vid="15A2"

Specify the target storage and target board.

  • Q: Why do you need this information?
  • A: Since different boards may have different uboot.bin file and different kernel image, the user needs to differentiate them.
    Additionally, the operation on a different target and board will be different too. .
  • Q: How to differentiate storage and board?
  • A: By using the operation list defined in ucl2.xml.
    One operation list is dedicated to defining a specific storage on a specific board. .
  • Q: I have defined many different operation lists.
    How do I let MFGTool2 know which one should be used?
  • A: By using the cfg.ini.
    In this cfg.ini, there is
    [LIST]
    name = Sabre-SD
    MFGTool2 will try to find the operation list named “Sabre-SD” in the ucl2.xml which should allocate at Profiles${chip}\OS Firmware.

由這裡我們可以在 cfg.ini 看到

[LIST]
name = SDCard

所以我們需要來看 Profiles\Linux\OS Firmware\ucl2.xml 裡頭名為 SDCard 的 operation list

<UCL>
  ...
  <LIST name="SDCard" desc="Choose SD Card as media">
    <CMD state="BootStrap" type="boot" 
      body="BootStrap" 
      file ="firmware/u-boot-imx6ul%6uluboot%_sd.imx" 
      ifdev="MX6UL">Loading U-boot</CMD>
    <CMD state="BootStrap" type="load" 
      file="firmware/zImage" 
      address="0x80800000" 
      loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
      ifdev="MX6SL MX6SX MX7D MX6UL">Loading Kernel.</CMD>
    <CMD state="BootStrap" type="load" 
      file="firmware/%initramfs%" 
      address="0x83800000"
      loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
      ifdev="MX6SL MX6SX MX7D MX6UL">Loading Initramfs.</CMD>
    <CMD state="BootStrap" type="load" 
      file="firmware/zImage-imx6ul-%6uldtb%%ldo%.dtb" 
      address="0x83000000"
      loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
      ifdev="MX6UL">Loading device tree.</CMD>
    <CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>

    <!-- create partition -->
    <CMD state="Updater" type="push" 
      body="send" 
      file="mksdcard.sh.tar">Sending partition shell</CMD>
    <CMD state="Updater" type="push" body="$ tar xf $FILE "> Partitioning...</CMD>
    <CMD state="Updater" type="push" body="$ sh mksdcard.sh /dev/mmcblk%mmc%"> Partitioning...</CMD>

    <!-- burn uboot -->
    <CMD state="Updater" type="push" 
      body="send" 
      file="files/u-boot-imx6ul%6uluboot%_sd.imx" 
      ifdev="MX6UL">Sending u-boot.bin</CMD>
    <CMD state="Updater" type="push" 
      body="$ dd if=/dev/zero of=/dev/mmcblk%mmc% bs=1k seek=384 conv=fsync count=129">clear u-boot arg</CMD>
    <CMD state="Updater" type="push" 
      body="$ dd if=$FILE of=/dev/mmcblk%mmc% bs=1k seek=1 conv=fsync">write u-boot.bin to sd card</CMD>
    <CMD state="Updater" type="push" 
      body="$ mkfs.vfat /dev/mmcblk%mmc%p1">Formatting rootfs partition</CMD>
    <CMD state="Updater" type="push" 
      body="$ mkdir -p /mnt/mmcblk%mmc%p1"/>
    <CMD state="Updater" type="push" 
      body="$ mount -t vfat /dev/mmcblk%mmc%p1 /mnt/mmcblk%mmc%p1"/>

    <!-- burn zImage -->
    <CMD state="Updater" type="push" 
      body="send" file="files/zImage">Sending kernel</CMD>
    <CMD state="Updater" type="push" 
      body="$ cp $FILE /mnt/mmcblk%mmc%p1/zImage">write kernel image to sd card</CMD>

    <!-- burn dtb -->
    <CMD state="Updater" type="push" 
      body="send" file="files/zImage-imx6ul-%6uldtb%%ldo%.dtb" 
      ifdev="MX6UL">Sending Device Tree file</CMD>

    <CMD state="Updater" type="push" 
      body="$ cp $FILE /mnt/mmcblk%mmc%p1/imx6ul-%6uldtb%.dtb" 
      ifdef="MX6UL">write device tree to sd card</CMD>

    <CMD state="Updater" type="push" 
      body="$ umount /mnt/mmcblk%mmc%p1">Unmounting vfat partition</CMD>

    <!-- burn rootfs -->
    <CMD state="Updater" type="push" 
      body="$ mkfs.ext3 -j /dev/mmcblk%mmc%p2">Formatting rootfs partition</CMD>
    <CMD state="Updater" type="push" 
      body="$ mkdir -p /mnt/mmcblk%mmc%p2"/>
    <CMD state="Updater" type="push" 
      body="$ mount -t ext3 /dev/mmcblk%mmc%p2 /mnt/mmcblk%mmc%p2"/>
    <CMD state="Updater" type="push" 
      body="pipe tar -jxv -C /mnt/mmcblk%mmc%p2" file="files/rootfs_nogpu.tar.bz2" 
      ifdev="MX6UL MX7D">Sending and writting rootfs</CMD>
    <CMD state="Updater" type="push" 
      body="frf">Finishing rootfs write</CMD>
    <CMD state="Updater" type="push" 
      body="$ umount /mnt/mmcblk%mmc%p2">Unmounting rootfs partition</CMD>
    <CMD state="Updater" type="push" 
      body="$ echo Update Complete!">Done</CMD>
  </LIST>
  ...
</UCL>

這邊我已將將跟 SoC MX6UL 無關的部分刪掉了

要看懂這 operation list 要參考 Manufacturing Tool V2 (MFGTool2) Update Command List (UCL) User Guide

1455

從第一個看吧

    <CMD state="BootStrap" type="boot" 
      body="BootStrap" 
      file ="firmware/u-boot-imx6ul%6uluboot%_sd.imx" 
      ifdev="MX6UL">Loading U-boot</CMD>

這是一個 Host specific command - these commands are parsed and executed by host tool

這 command 會讓 host tool 將 image download 到 RAM 去
哪個 image 要看 file ="firmware/u-boot-imx6ul%6uluboot%_sd.imx"
%6uluboot% 表示是 有一個 static variable 叫 6uluboot

cfg.ini 裡有定義該 variable 的 value

[variable]
...
6uluboot=14x14ddr3arm2
...

所以我們知道 host tool 會將 firmware/u-boot-imx6ul14x14ddr3arm2_sd.imx 這 image download 到 RAM 去

⚠️ **GitHub.com Fallback** ⚠️