20160616_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0910 - MFGTool2 Workflow ucl2.xml SDCard operation list
  • 1305 - 現實 操作 問題
  • 1335 - mail AVNET FAE mike
  • 1410 - MfgTool VBScript
  • 1440 - NXP 官網 同樣的問題
  • 1455 - mfgtool2-yocto-mx-evk-sdcard-sd1.vbs
  • 1505 - 停 Formatting rootfs partition
  • 1535 - mfgtool2-yocto-mx-evk-sdcard-sd1-jeffrey.vbs
  • 1550 - mfgtool2-yocto-mx-evk-qspi-nor-n25q256a.vbs
  • 1640 - mfgtool2-yocto-mx-evk-sdcard-sd1.vbs
  • 1815 - ucl2.xml eMMC

0910

繼續看 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 無關的部分已經刪掉

昨天已經看懂了第一個

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

0915

    <CMD state="BootStrap" type="load" 
      file="firmware/zImage" 
      address="0x80800000" 
      loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
      ifdev="MX6SL MX6SX MX7D MX6UL">Loading Kernel.</CMD>

這是 Host specific command, 也是將 image download 到 RAM 去

  • file="firmware/zImage" - file - specify the path and name of the image file.
  • address="0x80800000" - address - specifies the RAM address where the image is located.
  • loadSection="OTH" - loadSection - a parameter used by ROM code, should be set to “OTH”
  • setSection="OTH" - setSection - a parameter used by ROM code, should be set to “OTH” if there are other images to be loaded; set to “APP” if the last image is loaded.
  • HasFlashHeader="FALSE" - HasFlashHeader - set TRUE if the image contains a flash header, or set to FALSE.
  • ifdev="MX6SL MX6SX MX7D MX6UL" - Commands are executed according to dev type.

0930

    <CMD state="BootStrap" type="load" 
      file="firmware/%initramfs%" 
      address="0x83800000"
      loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
      ifdev="MX6SL MX6SX MX7D MX6UL">Loading Initramfs.</CMD>

Host specific command, 將 image download 到 RAM 去

  • file="firmware/%initramfs%" - initramfs=fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot
  • address="0x83800000"
  • loadSection="OTH"
  • setSection="OTH"
  • HasFlashHeader="FALSE"
  • ifdev="MX6SL MX6SX MX7D MX6UL"

0940

    <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>

Host specific command, 將 image download 到 RAM 去

  • file="firmware/zImage-imx6ul-%6uldtb%%ldo%.dtb" - 6uldtb=14x14-ddr3-arm2 - ldo=
  • address="0x83000000"

0945

<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>

Host specific command

Notify ROM code to jump to the RAM image to run.
The command must be followed after a load command in which setSection value is set to “APP”.
The command is only for Bulk-IO mode i.MX device except i.MX50 HID mode device.

這裡說 jump command 要在 load command 之後, 而且 load command 的 setSection 要為 APP
不過目前的 load command 的 setSection 都是 OTH

待釐清

看一下截至目前我們 download 了什麼到 RAM 去

<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>
    ...
  </LIST>
  ...
</UCL>

有 U-Boot, Kernel, Initramfs 和 device tree 四個 image, 只有 U-Boot 使用 boot command, 其他都是用 load command

  • Loading U-boot - firmware/u-boot-imx6ul%6uluboot%_sd.imx
  • Loading Kernel - firmware/zImage - address="0x80800000"
  • Loading Initramfs - firmware/%initramfs% - address="0x83800000"
  • Loading device tree - firmware/zImage-imx6ul-%6uldtb%%ldo%.dtb" - address="0x83000000"

1000

再來進到 create partition 的區段, state="Updater" indicates the phase of the command executed

    <!-- 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>

push command is parsed and executed by the targeted device instead of host, the only thing host has to do is to send the command to the targeted device.
body is a parameter of the command.

body 裡所帶的內容由 target device 負責

    <CMD state="Updater" type="push" 
      body="send" 
      file="mksdcard.sh.tar">Sending partition shell</CMD>
  • body="send"
    • send command
    • Arguments: None
    • Receive the file from the host. Subsequent shell commands can refer to the file received as $FILE.
    <CMD state="Updater" type="push" 
      body="$ tar xf $FILE "> Partitioning...</CMD>
  • body="$ tar xf $FILE "
    • $ command
    • Arguments: string
    • Execute shell command - tar xf $FILE
    <CMD state="Updater" type="push" 
      body="$ sh mksdcard.sh /dev/mmcblk%mmc%"> Partitioning...</CMD>
  • body="$ sh mksdcard.sh /dev/mmcblk%mmc%"
    • $ command
    • Arguments: string
    • Execute shell command - sh mksdcard.sh /dev/mmcblk%mmc% - mmc = 0

這一整段用白話文來說

  • targeted device 會從 host 收到 mksdcard.sh.tar
  • 然後 target device 執行 shell command tar xf mksdcard.sh.tar
  • 然後 target device 執行 shell command sh mksdcard.sh /dev/mmcblk0

看到這邊之後整個關鍵變成 mksdcard.sh

解開 Profiles\Linux\OS Firmware\mksdcard.sh.tar 得到 mksdcard.sh, 內容如下

#!/bin/sh

# partition size in MB
BOOT_ROM_SIZE=10


# call sfdisk to create partition table
# destroy the partition table
node=$1
dd if=/dev/zero of=${node} bs=1024 count=1

sfdisk --force -uM ${node} << EOF
${BOOT_ROM_SIZE},500,0c
600,,83
EOF

shell script 先擱著後面再研究

1035

繼續前進

    <!-- 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"/>
  • targeted device 會從 host 收到 files/u-boot-imx6ul14x14ddr3arm2_sd.imx
  • 然後 target device 執行下述 shell command
    • dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129
    • dd if=u-boot-imx6ul14x14ddr3arm2_sd.imx of=/dev/mmcblk0 bs=1k seek=1 conv=fsync
    • mkfs.vfat /dev/mmcblk0p1
    • mkdir -p /mnt/mmcblk0p1
    • mount -t vfat /dev/mmcblk0p1 /mnt/mmcblk0p1

1040

繼續

    <!-- 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>
  • targeted device 會從 host 收到 files/zImage
  • 然後 target device 執行下述 shell command
    • cp zImage /mnt/mmcblk0p1/zImage

1045

    <!-- 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>
  • targeted device 會從 host 收到 files/zImage-imx6ul-14x14-ddr3-arm2.dtb
  • 然後 target device 執行下述 shell command
    • cp zImage-imx6ul-14x14-ddr3-arm2.dtb /mnt/mmcblk0p1/imx6ul-14x14-ddr3-arm2.dtb
    • umount /mnt/mmcblk0p1

1050

    <!-- 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>

拆開看

    <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>

Execute shell command and read data from stdio pipe IN.
mfg will send file to stdio pipe OUT.
.
It is useful for big data transfer, more than physical memory size
.
<CMD type="push" body="pipe tar -xv -C /mnt/ubi0" file="files/rootfs.tar"/>
<CMD type="push" body="flush">Finish Flashing NAND</CMD>
.
Note: The above two commands must be combined to use
.
Recommend: Please add below command prior to pipe command to free some memory.
.
<CMD type="push" body="$ echo 3 > /proc/sys/vm/drop_caches">release memory</CMD>

再來

    <CMD state="Updater" type="push" 
      body="frf">Finishing rootfs write</CMD>

same as flush Wait for all data transfer to be finished and processed.

兩個一起看

    <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>
  • targeted device 收到 files/rootfs_nogpu.tar.bz2 後執行 tar -jxv -C /mnt/mmcblk0p2
  • rootfs_nogpu.tar.bz2 可能很大... 所以利用 push command 來等待 data transfer finished

1300

全部一起看

    <!-- 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>
  • target device 執行下述 shell command
    • mkfs.ext3 -j /dev/mmcblk0p2
    • mkdir -p /mnt/mmcblk0p2
    • body="$ mount -t ext3 /dev/mmcblk0p2 /mnt/mmcblk0p2
  • targeted device 收到 files/rootfs_nogpu.tar.bz2 後執行 tar -jxv -C /mnt/mmcblk0p2
  • rootfs_nogpu.tar.bz2 可能很大... 所以利用 push command 來等待 data transfer finished
  • target device 執行下述 shell command
    • umount /mnt/mmcblk0p2
    • echo Update Complete!

1305

回到現實的操作面

目前使用上遇到的問題如下

image

1335

mail 給 AVNET FAE 的 mike 請他幫忙一下

NXP 官網有人問同樣的問題 - Cannot boot from eMMC i.mx6UL EVK

1410

MfgTool 工具包跟目錄下有很多 *.vbs, 這是 VBScript

看一下 mfgtool2-yocto-mx-14x14-arm2-sdcard-sd1.vbs

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""SDCard"" -s ""mmc=0""  -s ""6uluboot=14x14ddr3arm2"" -s ""6uldtb=14x14-ddr3-arm2"" "
Set wshShell = Nothing

這 script 應該是讓我們省了設定 cfg.ini 的功夫

順邊觀察一下 mfgtool2-yocto-mx-14x14-arm2-spi-nor.vbs

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""Nor Flash"" -s ""board=sabreauto"" -s ""mmc=0"" -s ""nor=spi-nor"" -s ""nordtb=ecspi"" -s ""6uluboot=14x14ddr3arm2"" -s ""6uldtb=14x14-ddr3-arm2"" -s ""7duboot=12x12lpddr3arm2"" -s ""7ddtb=12x12-lpddr3-arm2-ecspi"" -s ""nor_part=4"" "
Set wshShell = Nothing

mfgtool2-yocto-mx-17x17-arm2-nand.vbs

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""NAND Flash"" -s ""sxuboot=17x17arm2""  -s ""sxdtb=17x17-arm2"" -s ""board=sabreauto"" -s ""nand=nand"" -s ""nanddtb=gpmi-weim"" -s ""part_uboot=0"" -s ""part_kernel=1"" -s ""part_dtb=2"" -s ""part_rootfs=3""   "
Set wshShell = Nothing

1440

NXP 官網有人問同樣的問題 - Cannot boot from eMMC i.mx6UL EVK

for mfg tool one can look at script
mfgtool2-yocto-mx-evk-sdcard-sd2.vbs,
since eMMC is used instead SD2, it should work for it.
For using procedure in the Linux User's Guide one can try first boot
from qspi.

看一下 mfgtool2-yocto-mx-evk-sdcard-sd2.vbs 的內容

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""SDCard"" -s ""board=sabresd"" -s ""mmc=1"" -s ""6uluboot=evk"" -s ""6uldtb=14x14-evk"" "
Set wshShell = Nothing

管他的... 試試看再說...
跑起來囉...

console 印個不停...

趁著跑的當下
看看 mfgtool2-yocto-mx-evk-sdcard-sd2.vbsmfgtool2-yocto-mx-14x14-arm2-sdcard-sd1.vbs 的差別

  • mfgtool2-yocto-mx-evk-sdcard-sd2.vbs

    • -c ""linux""
    • -l ""SDCard""
    • -s ""board=sabresd""
    • -s ""mmc=1""
    • -s ""6uluboot=evk""
    • -s ""6uldtb=14x14-evk""
  • mfgtool2-yocto-mx-14x14-arm2-sdcard-sd1.vbs

    • -c ""linux""
    • -l ""SDCard""
    • -s ""mmc=0""
    • -s ""6uluboot=14x14ddr3arm2""
    • -s ""6uldtb=14x14-ddr3-arm2""

差別就在

  • mfgtool2-yocto-mx-evk-sdcard-sd2.vbs

    • -s ""6uluboot=evk""
    • -s ""6uldtb=14x14-evk""
  • mfgtool2-yocto-mx-14x14-arm2-sdcard-sd1.vbs

    • -s ""6uluboot=14x14ddr3arm2""
    • -s ""6uldtb=14x14-ddr3-arm2""

感覺上就是 static variable 6uluboot 被指定成 14x14ddr3arm2 出了錯

1455

burn 之後發現開機都沒反應... 發現 EVK 上焊的是 QSPI Flash

直接試一下 mfgtool2-yocto-mx-evk-sdcard-sd1.vbs

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""SDCard"" -s ""board=sabresd"" -s ""mmc=0"" -s ""6uluboot=evk"" -s ""6uldtb=14x14-evk"" "
Set wshShell = Nothing

跑起來囉...

1505

停在不一樣的地方... Formatting rootfs partition

image

1535

自己寫一個 - mfgtool2-yocto-mx-evk-sdcard-sd1-jeffrey.vbs, 混搭

  • -s ""6uluboot=evk""
  • -s ""6uldtb=14x14-ddr3-arm2""
Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""SDCard"" -s ""board=sabresd"" -s ""mmc=0"" -s ""6uluboot=evk"" -s ""6uldtb=14x14-ddr3-arm2"" "
Set wshShell = Nothing

還是停在 Formatting rootfs partition

1550

不知道算不算的上好消息...

使用 mfgtool2-yocto-mx-evk-qspi-nor-n25q256a.vbs 真的可以將 U-Boot 燒到 QSPI Nor Flash 去

燒完之後從 QSPI 開機可以看到 U-Boot 的訊息... 不過真的只有 U-boot 而已

ucl2.xml 可以來看看 MfgTool 做了什麼事

  <LIST name="Quad Nor Flash" desc="Choose Quad Nor flash as media">
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6q%board%_%nor%.imx" ifdev="MX6Q">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6dl%board%_%nor%.imx" ifdev="MX6D">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6slevk_spi-nor.imx" ifdev="MX6SL">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6sx%sxuboot%_sd.imx" ifdev="MX6SX">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx7d%7duboot%_sd.imx" ifdev="MX7D">Loading U-boot</CMD>
	<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="0x12000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q MX6DL">Loading Kernel.</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="0x12C00000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q MX6DL">Loading Initramfs.</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-imx6q-%board%-%nordtb%.dtb" address="0x18000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q">Loading device tree.</CMD>
	<CMD state="BootStrap" type="load" file="firmware/zImage-imx6dl-%board%-%nordtb%.dtb" address="0x18000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6D">Loading device tree.</CMD>
	<CMD state="BootStrap" type="load" file="firmware/zImage-imx6sl-evk.dtb" address="0x83000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6SL">Loading device tree.</CMD>
	<CMD state="BootStrap" type="load" file="firmware/zImage-imx6sx-%sxdtb%.dtb" address="0x83000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6SX">Loading device tree.</CMD>
	<CMD state="BootStrap" type="load" file="firmware/zImage-imx7d-%7ddtb%.dtb" address="0x83000000"
		loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX7D">Loading device tree.</CMD>
	<CMD state="BootStrap" type="load" file="firmware/zImage-imx6ul-%6uldtb%.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>

	<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 20">Erasing Boot partition</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx6q%board%_%nor%.imx" ifdev="MX6Q">Sending U-Boot</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx6dl%board%_%nor%.imx" ifdev="MX6D">Sending U-Boot</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx6slevk_spi-nor.imx" ifdev="MX6SL">Sending u-boot.bin</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx6sx%sxuboot%_%sxnor%.imx" ifdev="MX6SX">Sending u-boot.bin</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx7d%7duboot%_%7dnor%.imx" ifdev="MX7D">Sending u-boot.bin</CMD>
	<CMD state="Updater" type="push" body="send" file="files/u-boot-imx6ul%6uluboot%_%6ulnor%.imx" ifdev="MX6UL">Sending u-boot.bin</CMD>

	<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=1k seek=4" ifdev="MX6SX MX6UL">write U-Boot to NOR flash</CMD>
	<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=1k seek=1" ifdev="MX7D">write U-Boot to NOR flash</CMD>

	<!--QSPI header-->
	<CMD state="Updater" type="push" body="send" file="qspi-header.sh.tar">Sending qspi header shell</CMD>
	<CMD state="Updater" type="push" body="$ tar xf $FILE "> Extracting...</CMD>
	<CMD state="Updater" type="push" body="send" file="files/%norconfig%">Sending QSPI header config file</CMD>
	<CMD state="Updater" type="push" body="$ sh qspi-header.sh $FILE"> Generating the ascii value header</CMD>
	<!--hexdump to convert ascii value to hex file-->
	<CMD state="Updater" type="push" body="$ busybox hexdump -R qspi-tmp > qspi-header">Converting ascii value to hex file</CMD>
	<CMD state="Updater" type="push" body="$ dd if=qspi-header of=/dev/mtd0 bs=1k seek=1" ifdev="MX6SX MX6UL">Writing header to NOR flash</CMD>
	<CMD state="Updater" type="push" body="$ dd if=qspi-header of=/dev/mtd0 bs=1k seek=0" ifdev="MX7D">Writing header to NOR flash</CMD>
	<!--delete temporary files-->
	<CMD state="Updater" type="push" body="$ rm qspi-tmp">Deleting temporary file</CMD>
	<CMD state="Updater" type="push" body="$ rm qspi-header">Deleting temporary file</CMD>
	<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
  </LIST>

來整理一下不會被執行的 command, 順便拿掉 ifdev 字眼

<LIST name="Quad Nor Flash" desc="Choose Quad Nor flash as media">

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

  <CMD state="BootStrap" type="load" 
    file="firmware/zImage" address="0x80800000"
    loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
  >Loading Kernel.</CMD>

  <CMD state="BootStrap" type="load" 
    file="firmware/%initramfs%" address="0x83800000"
    loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
  >Loading Initramfs.</CMD>

  <CMD state="BootStrap" type="load" 
    file="firmware/zImage-imx6ul-%6uldtb%.dtb" address="0x83000000"
    loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" 
  >Loading device tree.</CMD>

  <CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>

  <CMD state="Updater" type="push" 
    body="$ flash_erase /dev/mtd0 0 20"
  >Erasing Boot partition</CMD>

  <CMD state="Updater" type="push" 
    body="send" 
    file="files/u-boot-imx6ul%6uluboot%_%6ulnor%.imx" 
  >Sending u-boot.bin</CMD>

  <CMD state="Updater" type="push" 
    body="$ dd if=$FILE of=/dev/mtd0 bs=1k seek=4" 
  >write U-Boot to NOR flash</CMD>

  <!--QSPI header-->

  <CMD state="Updater" type="push" 
    body="send" 
    file="qspi-header.sh.tar"
  >Sending qspi header shell</CMD>

  <CMD state="Updater" type="push" 
    body="$ tar xf $FILE "
  > Extracting...</CMD>

  <CMD state="Updater" type="push" 
    body="send" 
    file="files/%norconfig%"
  >Sending QSPI header config file</CMD>

  <CMD state="Updater" type="push" 
    body="$ sh qspi-header.sh $FILE"
  > Generating the ascii value header</CMD>

  <!--hexdump to convert ascii value to hex file-->

  <CMD state="Updater" type="push" 
    body="$ busybox hexdump -R qspi-tmp > qspi-header"
  >Converting ascii value to hex file</CMD>

  <CMD state="Updater" type="push" 
    body="$ dd if=qspi-header of=/dev/mtd0 bs=1k seek=1" 
  >Writing header to NOR flash</CMD>

  <!--delete temporary files-->

  <CMD state="Updater" type="push" 
    body="$ rm qspi-tmp"
  >Deleting temporary file</CMD>

  <CMD state="Updater" type="push" 
    body="$ rm qspi-header"
  >Deleting temporary file</CMD>

  <CMD state="Updater" type="push" 
    body="$ echo Update Complete!"
  >Done</CMD>

</LIST>

i.MX Linux® User's Guide4.4.1.3 Flashing U-Boot on SPI-NOR from U-Boot 看來

並沒有示範怎麼將 kernel 燒到 QSPI Flash 的範例

1640

再追一下 mfgtool2-yocto-mx-evk-sdcard-sd1.vbs 的問題

Jumping to OS image. 已經成功了... 就不去看它了... 這也意味著我們部用去擔心 ram kernel 或 ram U-Boot 的問題

  <LIST name="SDCard" desc="Choose SD Card as media">

    ...

    <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">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>
    ...

  </LIST>

目前可以肯定的是停在 mkfs.vfat /dev/mmcblk%mmc%p1

taget device console 的訊息從 Starting kernel ... 之後開始追

Starting kernel ...

...

Starting UTP
uuc 0.5 [built Dec  3 2015 08:26:46]
UTP: Waiting for device to appear
UTP: file/device node /dev/utp already exists
cpu_id is 0
g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ tar xf $FILE '
UTP: executing "tar xf $FILE "
UTP: sending Success to kernel for command $ tar xf $FILE .
utp_poll: pass returned.
UTP: received command '$ sh mksdcard.sh /dev/mmcblk0'
UTP: executing "sh mksdcard.sh /dev/mmcblk0"
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000626667 s, 1.6 MB/s
sfdisk: Warning: /dev/mmcblk0 is not a block device
sfdisk: Disk /dev/mmcblk0: cannot get geometry

Disk /dev/mmcblk0: 0 cylinders, 255 heads, 63 sectors/track
sfdisk:  /dev/mmcblk0: unrecognized partition table type
Old situation:
sfdisk: No partitions found
sfdisk: Warning: given size (503) exceeds max allowable size (0)
New situation:
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/mmcblk0p1         7+   509-   503-    514080    c  W95 FAT32 (LBA)
/dev/mmcblk0p2       596+   596-     0          0   83  Linux
/dev/mmcblk0p3         0      -      0          0    0  Empty
/dev/mmcblk0p4         0      -      0          0    0  Empty
sfdisk: Warning: partition 2 has size 0 but is not marked Empty
sfdisk: Warning: partition 1 extends past end of disk
Successfully wrote the new partition table


sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
UTP: sending Success to kernel for command $ sh mksdcard.sh /dev/mmcblk0.
utp_poll: pass returned.
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129'
UTP: executing "dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129"
129+0 records in
129+0 records out
132096 bytes (132 kB) copied, 0.00339467 s, 38.9 MB/s
UTP: sending Success to kernel for command $ dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129.
utp_poll: pass returned.
UTP: received command '$ dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync'
UTP: executing "dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync"
351+0 records in
351+0 records out
359424 bytes (359 kB) copied, 0.00847333 s, 42.4 MB/s
UTP: sending Success to kernel for command $ dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync.
utp_poll: pass returned.
UTP: received command '$ mkfs.vfat /dev/mmcblk0p1'
UTP: executing "mkfs.vfat /dev/mmcblk0p1"
mkfs.vfat 2.11 (12 Mar 2005)
/dev/mmcblk0p1: No such file or directory
UTP: sending Non-success to kernel for command $ mkfs.vfat /dev/mmcblk0p1.
utp_poll: exit with status 256
random: nonblocking pool is initialized

1655

    <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>

搭配

UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ tar xf $FILE '
UTP: executing "tar xf $FILE "
UTP: sending Success to kernel for command $ tar xf $FILE .
utp_poll: pass returned.

UTP: sending Success to kernel for command $ tar xf $FILE .

1455

    <CMD state="Updater" type="push" 
      body="$ sh mksdcard.sh /dev/mmcblk%mmc%"> Partitioning...</CMD>

搭配

UTP: received command '$ sh mksdcard.sh /dev/mmcblk0'
UTP: executing "sh mksdcard.sh /dev/mmcblk0"
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000626667 s, 1.6 MB/s
sfdisk: Warning: /dev/mmcblk0 is not a block device
sfdisk: Disk /dev/mmcblk0: cannot get geometry

Disk /dev/mmcblk0: 0 cylinders, 255 heads, 63 sectors/track
sfdisk:  /dev/mmcblk0: unrecognized partition table type
Old situation:
sfdisk: No partitions found
sfdisk: Warning: given size (503) exceeds max allowable size (0)
New situation:
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/mmcblk0p1         7+   509-   503-    514080    c  W95 FAT32 (LBA)
/dev/mmcblk0p2       596+   596-     0          0   83  Linux
/dev/mmcblk0p3         0      -      0          0    0  Empty
/dev/mmcblk0p4         0      -      0          0    0  Empty
sfdisk: Warning: partition 2 has size 0 but is not marked Empty
sfdisk: Warning: partition 1 extends past end of disk
Successfully wrote the new partition table


sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
UTP: sending Success to kernel for command $ sh mksdcard.sh /dev/mmcblk0.
utp_poll: pass returned.

UTP: sending Success to kernel for command $ sh mksdcard.sh /dev/mmcblk0.

1700

    <CMD state="Updater" type="push" 
      body="send" 
      file="files/u-boot-imx6ul%6uluboot%_sd.imx">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>
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129'
UTP: executing "dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129"
129+0 records in
129+0 records out
132096 bytes (132 kB) copied, 0.00339467 s, 38.9 MB/s
UTP: sending Success to kernel for command $ dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129.
utp_poll: pass returned.

UTP: sending Success to kernel for command $ dd if=/dev/zero of=/dev/mmcblk0 bs=1k seek=384 conv=fsync count=129.

    <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>
UTP: received command '$ dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync'
UTP: executing "dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync"
351+0 records in
351+0 records out
359424 bytes (359 kB) copied, 0.00847333 s, 42.4 MB/s
UTP: sending Success to kernel for command $ dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync.
utp_poll: pass returned.

UTP: sending Success to kernel for command $ dd if=$FILE of=/dev/mmcblk0 bs=1k seek=1 conv=fsync.

1705

    <CMD state="Updater" type="push" 
      body="$ mkfs.vfat /dev/mmcblk%mmc%p1">Formatting rootfs partition</CMD>
UTP: received command '$ mkfs.vfat /dev/mmcblk0p1'
UTP: executing "mkfs.vfat /dev/mmcblk0p1"
mkfs.vfat 2.11 (12 Mar 2005)
/dev/mmcblk0p1: No such file or directory
UTP: sending Non-success to kernel for command $ mkfs.vfat /dev/mmcblk0p1.
utp_poll: exit with status 256
random: nonblocking pool is initialized

UTP: sending Non-success to kernel for command $ mkfs.vfat /dev/mmcblk0p1.

1815

明天可以參考一下 ucl2.xmleMMC 的部分

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