mfg工作的流程是由其配置文件所决定的,其配置文件的位置及其文件名: - mfg/Profiles/BSP Firmware Updater/Linux Updater/ucl.xml
下面是ucl.xml文档中的一段描述:
</LIST> <LIST name=”Singlechip NAND” desc=”Install on singlechip NAND”> <CMD type=”boot” body=”Recovery” file=”updater.sb“>Booting update firmware.</CMD> <CMD type=”find” body=”Updater” /> <CMD type=”pull” body=”?” file=”device0.xml”>Getting device info.</CMD> <CMD type=”show” file=”device0.xml” /> <CMD type=”push” body=”$ for module in lzo ubifs ubi mtdchar mtdconcat gpmi; do modprobe $module; done” >Install modules</CMD> <CMD type=”push” body=”mknod class/mtd,mtd0,/dev/mtd0″/> <CMD type=”push” body=”mknod class/mtd,mtd1,/dev/mtd1″/> <CMD type=”push” body=”mknod class/misc,ubi_ctrl,/dev/ubi_ctrl”/> <CMD type=”push” body=”send” file=”firmware.sb“>Sending firmware</CMD> <CMD type=”push” body=”$ kobs-ng init -d $FILE“>Flashing firmware</CMD> <CMD type=”push” body=”$ flash_eraseall /dev/mtd1″>Erasing rootfs partition</CMD> <CMD type=”push” body=”$ ubiattach /dev/ubi_ctrl -m 1 -d 0″>Attaching UBI</CMD> <CMD type=”push” body=”mknod class/ubi,ubi0,/dev/ubi0″/> <CMD type=”push” body=”$ ubimkvol /dev/ubi0 -n 0 -N rootfs0 -s 32MiB”>Creating UBI volumes</CMD> <CMD type=”push” body=”$ ubimkvol /dev/ubi0 -n 1 -N rootfs1 -s 32MiB”>Creating UBI volumes</CMD> <CMD type=”push” body=”$ ubimkvol /dev/ubi0 -n 2 -N data -m”>Creating UBI volumes</CMD> <CMD type=”push” body=”$ mkdir -p /mnt/ubi0; mount -t ubifs ubi0_0 /mnt/ubi0″ /> <CMD type=”push” body=”$ mkdir -p /mnt/ubi1; mount -t ubifs ubi0_1 /mnt/ubi1″ /> <CMD type=”push” body=”send” file=”files/rootfs.tar.bz2″>Sending rootfs image</CMD> <CMD type=”push” body=”$ tar -C /mnt/ubi0 -jxf $FILE”>Unpacking to partition 1</CMD> <CMD type=”push” body=”$ tar -C /mnt/ubi1 -jxf $FILE”>Unpacking to partition 1</CMD> <CMD type=”push” body=”$ umount /mnt/ubi0″>Unmounting</CMD> <CMD type=”push” body=”$ umount /mnt/ubi1″>Unmounting</CMD> <CMD type=”push” body=”!3″>Done</CMD> </LIST> 具体流程是 - 先烧写一个比较简单的内核到RAM中,这个内核的名字为updater.sb,后缀为.sb是Sigmatel Boot的缩写,在这个sb文件中包类Uboot代码,linux内核镜像,根文件系统,总之是一个能启动的linux的镜像。这个内核放到RAM中后会被启动,然后PC就可以和这个内核之间进行通信了。
- 在这个内核中创建一些节点,例如:mtd0, mtd1等。
- 下载firmware.sb到RAM中,这个名叫firmware.sb的文件本质上也是一个内核,只不过我们要把这个镜像内核烧到flash中。
- 使用kobs-nginit命令把firmware.sb写到flash中,这个命令是freescale提供的一个工具,在编译updater.sb的时候要把这个工具放到其根文件系统中。
- 擦写mtd1,使用mtd工具把mtd1指定为ubi格式,并创建一个ubi设备。
- 使用mtd工具ubimkvol在新创建的设备上创建三个ubi卷,并把这些设备挂在到文件系统中。
- 下载根文件系统rootfs.tar.bz2到RAM中,并把rootfs.tar.bz2解压到ubi卷中。
- 卸载ubi卷。
这样整个的烧写过程就结束了,其本质就是:现在RAM中启动一个内核,然后通过和这个内核进行交互,把指定的内核烧写到flash中。
|