<!--
* Copyright (C) 2010-2013, Freescale Semiconductor, Inc. All Rights Reserved.
* The CFG element contains a list of recognized usb devices.
* DEV elements provide a name, class, vid and pid for each device.
*
* Each LIST element contains a list of update instructions.
* "Install" - Erase media and install firmware.
* "Update" - Update firmware only.
*
* Each CMD element contains one update instruction of attribute type.
* "pull" - Does UtpRead(body, file) transaction.
* "push" - Does UtpWrite(body, file) transaction.
* "drop" - Does UtpCommand(body) then waits for device to disconnect.
* "boot" - Finds configured device, forces it to "body" device and downloads "file".
* "find" - Waits for "timeout" seconds for the "body" device to connect.
* "show" - Parse and show device info in "file".
-->
<!--
參考文章:
1. dd指令的conv=fsync,oflag=sync/dsync:
-->
<UCL>
<CFG>
<STATE name="BootStrap" dev="MX6D" vid="15A2" pid="0061"/>
<STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/>
</CFG>
<!--
The following Lists are for i.MX6Solo/DualLite chips
-->
<!-- 名字叫:MYZR-I.MX6-SPI_NOR & eMMC的指令集,描述是:Choose SPI-NOR/eMMC as media -->
<LIST name="MYZR-I.MX6-SPI_NOR & eMMC" desc="Choose SPI-NOR/eMMC as media">
<!-- 啟動第一階段,加載u-boot.bin,這裡不需要指定位址,不知道為什麼 -->
<CMD state="BootStrap" type="boot" body="BootStrap" file ="myzr_u-boot.bin" >Loading uboot.</CMD>
<!-- 啟動第一階段,加載uImage,指定加載到0x10800000 -->
<CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Kernel.</CMD>
<!-- initramfs: 最初的想法是Linus提出的,把cache當作檔案系統裝載。-->
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Initramfs.</CMD>
<!-- 跳到uImage的地方去執行,也就意味着uImage必須放在0x10800000 -->
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<!--burn the uboot to SPI-NOR: -->
<!-- 不存在SPI-NOR,是以不需要了 -->
<!--
<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
-->
<!-- partitioning the eMMC: -->
<!--
目前還不知道這裡是用來做什麼的,另外,從燒寫、測試的過程來看,這裡是不需要這條指令的,因為加了這條
指令,系統無法啟動,而且總是會處于USB軟體下載下傳的狀态。如果不小心運作着這條指令,想要改回之前的狀态,
可以将指令參數8改成0,經過測試,這樣是可行的,目前不知道是為什麼。
-->
<CMD state="Updater" type="push" body="$ echo 8 > /sys/devices/platform/sdhci-esdhc-imx.3/mmc_host/mmc0/mmc0:0001/boot_config">access user partition and enable boot partion 1 to boot</CMD>
<!-- 發送分區檔案到目标機 -->
<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>
<!-- 對裝置/dev/mmcblk0進行分區,也就是對對應的mmc進行分區,分區情況請參考mksdcard.sh.tar -->
<CMD state="Updater" type="push" body="$ sh mksdcard.sh /dev/mmcblk0"> Partitioning SD card now...</CMD>
<!-- burn the uboot: -->
<!-- 發送u-boot到目标機中 -->
<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>
<!-- 擦除mmcblk0的1k(512*2=1k)位元組到1M(512*2000=1M)emmc,最前面的1k位元組貌似儲存了emmc分區表的 -->
<CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=2 count=2000">Clean U-Bootenvironment</CMD>
<!-- 将上面發送到目标機的u-boot寫入emmc中,從emmc的1k(512*2=1k)的地方開始,這裡不知道我們是不是一定要從這個位址開始寫 -->
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=512 seek=2 skip=2">write U-Boot to sdcard</CMD>
<!-- burn the kernel: -->
<!-- 發送uImage到目标機中 -->
<CMD state="Updater" type="push" body="send" file="files/uImage">Sending kernel uImage</CMD>
<!--
conv=fsync: Synchronize output data and metadata just before finishing 意思也就是在dd指令結束前同步data和metadata,那就是不是每一次寫都同步一次咯,也就是如果我們在dd指令中寫了100次,他可能是等到最後的時候才把他們同步到磁盤。
oflag=dsync: Use synchronized I/O for data. For the output file, this forces a physical write of output data on each write,注意這裡邊用詞 a physical write of output data on each write,那就是他是每一次寫都得等到這一次寫寫到了磁盤才進行下一個寫,也就是如果我們使用dd寫100次,他每次寫都是寫到磁盤後才進行下一次寫的。
将前面發送的目标機的uImage寫入emmc中,從1M的地方開始寫,同樣不知道是不是一定要從這個位置開始寫
-->
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=1M seek=1 conv=fsync">write kernel image to emmc</CMD>
<!-- burn the rootfs: -->
<!-- ext3格式格式化emmc的第一個分區,這是檔案系統分區 -->
<CMD state="Updater" type="push" body="$ mkfs.ext3 -j /dev/mmcblk0p1">Formatting rootfs partition</CMD>
<!-- 建立/mnt/mmcblk0p1檔案夾 -->
<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/>
<!-- 以ext3格式挂載emmc的第一個分區到/mnt/mmcblk0p1檔案夾 -->
<CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk0p1 /mnt/mmcblk0p1"/>
<!-- 采用pipe的方式傳輸大檔案,主要是防止檔案過大,并大于記憶體,解壓rootfs.tar.bz2檔案到emmc第一個分區中 -->
<CMD state="Updater" type="push" body="pipe tar -jxv -C /mnt/mmcblk0p1" file="files/rootfs.tar.bz2">Sending and writting rootfs</CMD>
<!-- flush記憶體中的資料到emmc中 -->
<CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
<!-- 解除安裝挂載在/mnt/mmcblk0p1上的分區 -->
<CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p1">Unmounting rootfs partition</CMD>
<!-- 提示更新系統完畢 -->
<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
<!-- 名字叫:MYZR-I.MX6-SPI_NOR & SD card的指令集,描述是:Choose SPI-NOR/SD as media -->
<LIST name="MYZR-I.MX6-SPI_NOR & SD card" desc="Choose SPI-NOR/SD as media">
<!-- 第一階段,将u-boot下載下傳到目标機上,這裡沒有指定起始位址 -->
<CMD state="BootStrap" type="boot" body="BootStrap" file ="myzr_u-boot.bin" >Loading uboot.</CMD>
<!--
第一階段,将uImage下載下傳到記憶體位址的0x10800000的地方,不知道為什麼要下載下傳到這個地方.
-->
<CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Kernel.</CMD>
<!-- 第一階段,将initramfs檔案系統發送到目标機上,起始位址是0x10C00000 -->
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Doing Initramfs.</CMD>
<!--
跳轉到uImage的地方開始運作,從這裡可以看出,系統是知道核心在哪裡的,而前面又正好将uImage放在
0x10800000的地方,應該是系統中已經設定好了這個值
-->
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<!--burn the uboot to SPI-NOR: -->
<!--
這一部分的目标是将U-Boot放入SPI-NOR中,也就意味着U-Boot是從SPI-NOR中開始引導啟動
-->
<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
<!-- partitioning the SD card: -->
<!--
對SD卡進行分區,這裡的SD的裝置節點是:/dev/mmcblk1,也就是說SD卡挂在在emmc總線的第二個上面
-->
<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/mmcblk1"> Partitioning SD card now...</CMD>
<!-- burn the kernel: -->
<!-- 将核心燒入SD卡的中,從SD卡的1M的地方開始燒寫 -->
<CMD state="Updater" type="push" body="send" file="files/uImage">Sending kernel uImage</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk1 bs=1M seek=1 conv=fsync">write kernel image to sd card</CMD>
<!-- burn the rootfs: -->
<!-- 以ext3的方式格式化分區1,并将檔案系統的檔案解壓放到這個分區中去 -->
<CMD state="Updater" type="push" body="$ mkfs.ext3 -j /dev/mmcblk1p1">Formatting rootfs partition</CMD>
<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk1p1"/>
<CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk1p1 /mnt/mmcblk1p1"/>
<CMD state="Updater" type="push" body="pipe tar -jxv -C /mnt/mmcblk1p1" file="files/rootfs.tar.bz2">Sending and writting rootfs</CMD>
<CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
<CMD state="Updater" type="push" body="$ umount /mnt/mmcblk1p1">Unmounting rootfs partition</CMD>
<!-- 提示更新完畢 -->
<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
<!-- 名字叫:MYZR-I.MX6-UBUNTU-SPI_NOR & eMMC的指令集,描述是:Choose eMMC as media -->
<LIST name="MYZR-I.MX6-UBUNTU-SPI_NOR & eMMC" desc="Choose eMMC as media">
<!--
第一階段,将u-boot下載下傳到目标機上,這裡沒有指定起始位址
第一階段,将uImage下載下傳到記憶體位址的0x10800000的地方,不知道為什麼要下載下傳到這個地方.
第一階段,将initramfs檔案系統發送到目标機上,起始位址是0x10C00000
跳轉到uImage的地方開始運作,從這裡可以看出,系統是知道核心在哪裡的,而前面又正好将uImage放在
0x10800000的地方,應該是系統中已經設定好了這個值
-->
<CMD state="BootStrap" type="boot" body="BootStrap" file ="myzr_u-boot.bin" >Loading U-boot</CMD>
<CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</CMD>
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD>
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<!--burn the uboot to SPI-NOR: -->
<!--
這一部分的目标是将U-Boot放入SPI-NOR中,也就意味着U-Boot是從SPI-NOR中開始引導啟動
-->
<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
<!-- partitioning the eMMC: -->
<!--
對SD卡進行分區,這裡的SD的裝置節點是:/dev/mmcblk0,也就是說SD卡挂在在emmc總線的第二個上面
-->
<CMD state="Updater" type="push" body="$ echo 8 > /sys/devices/platform/sdhci-esdhc-imx.3/mmc_host/mmc0/mmc0:0001/boot_config">access user partition and enable boot partion 1 to boot</CMD>
<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/mmcblk0"> Partitioning SD card now...</CMD>
<!-- burn the kernel: -->
<!-- 将核心燒入emmc卡的中,從emmc卡的1M的地方開始燒寫 -->
<CMD state="Updater" type="push" body="send" file="files/uImage">Sending kernel uImage</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=1M seek=1 conv=fsync">write kernel image to emmc</CMD>
<!-- burn the rootfs: -->
<!-- 以ext3的方式格式化分區1,并将檔案系統的檔案解壓放到這個分區中去 -->
<CMD state="Updater" type="push" body="$ mkfs.ext3 -j /dev/mmcblk0p1">Formatting rootfs partition</CMD>
<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk0p1 /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="pipe tar --numeric-owner -zxv -C /mnt/mmcblk0p1" file="files/oneiric12.04LTS.tgz">Sending and writting rootfs</CMD>
<CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
<CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p1">Unmounting rootfs partition</CMD>
<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
<LIST name="Android-MYZR-SPI_NOR-eMMC" desc="Choose SPI-NOR and SD Rootfs as media">
<CMD state="BootStrap" type="boot" body="BootStrap" file ="myzr_u-boot.bin" >Loading U-boot</CMD>
<CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</CMD>
<CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD>
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<!--
Please use "cat /proc/mtd" to check the right partitions for NAND
,mtd0 and mtd1 are for SPI-NOR; mtd2 - mtd6 are for NAND
-->
<!--
<CMD state="Updater" type="push" body="mknod class/mtd,mtd0,/dev/mtd0"/>
<CMD state="Updater" type="push" body="mknod block,mtdblock0,/dev/mtdblock0,block"/>
-->
<!--
<CMD state="Updater" type="push" body="$ flash_erase /dev/mtd0 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push" body="send" file="files/android/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
-->
<!-- 對emmc進行分區-->
<CMD state="Updater" type="push" body="send" file="mksdcard-android.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-android.sh /dev/mmcblk0"> Partitioning...</CMD>
<CMD state="Updater" type="push" body="$ ls -l /dev/mmc* ">Formatting sd partition</CMD>
<!-- burn the uboot: -->
<!-- 發送u-boot到目标機中 -->
<!-- 擦除mmcblk0的1k(512*2=1k)位元組到1M(512*2000=1M)emmc,最前面的1k位元組貌似儲存了emmc分區表的 -->
<!-- 将上面發送到目标機的u-boot寫入emmc中,從emmc的1k(512*2=1k)的地方開始,這裡不知道我們是不是一定要從這個位址開始寫 -->
<CMD state="Updater" type="push" body="send" file="files/android/u-boot.bin">Sending U-Boot</CMD>
<CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=2 count=2000">Clean U-Bootenvironment</CMD>
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=512 seek=2 skip=2">write U-Boot to sdcard</CMD>
<!-- burn the uImage: -->
<!-- 将boot.img檔案寫入mmcblk0p1分區 -->
<CMD state="Updater" type="push" body="send" file="files/android/boot.img">Sending kernel uImage</CMD>
<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>
<!-- 對分區4、5、6、7進行格式化,以ext3的檔案系統格式進行格式化 -->
<CMD state="Updater" type="push" body="$ mkfs.ext4 -L data /dev/mmcblk0p4">Formatting sd partition</CMD>
<CMD state="Updater" type="push" body="$ mkfs.ext4 -L system /dev/mmcblk0p5">Formatting system partition</CMD>
<CMD state="Updater" type="push" body="$ mkfs.ext4 -L cache -O^extent /dev/mmcblk0p6">Formatting cache partition</CMD>
<CMD state="Updater" type="push" body="$ mkfs.ext4 -L vender /dev/mmcblk0p7">Formatting data partition</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
<!-- 将檔案系統寫入rootfs分區中,使用pipe方式傳輸 -->
<CMD state="Updater" type="push" body="$ mkfs.ext4 /dev/mmcblk0p8">Formatting misc 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>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
<!-- Write userdata.img is optional, for some customer this is needed, but it's optional. -->
<!-- Also, userdata.img will have android unit test, you can use this to do some auto test. -->
<!--
<CMD state="Updater" type="push" onError="ignore" body="pipe dd of=/dev/mmcblk0p7" file="file/android/userdate.img"> Sending userdata.img(optional) </CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
-->
<!-- 将recovery鏡像寫入第二個分區中-->
<CMD state="Updater" type="push" body="pipe dd of=/dev/mmcblk0p2 bs=512" file="files/android/recovery.img">Sending and writting recovery.img</CMD>
<CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
<!-- 提示更新完畢 -->
<CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
</UCL>