I.MX6 Manufacturing Tool V2 (MFGTool2) ucl2.xml hacking-阿里云开发者社区

开发者社区> 开发与运维> 正文

I.MX6 Manufacturing Tool V2 (MFGTool2) ucl2.xml hacking

简介: Loading uboot. Doing Kernel. Doing Initramfs.
<!--
* 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:
            http://blog.csdn.net/menogen/article/details/38059671
-->


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

 

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章