在MarS board上烧录系统镜像

MarS Board 是基于飞思卡尔(Freescale Semiconductor)i.MX 6Dual 处理器的评估板。i.MX 6Dual 处理器集成了高达 1GHz 的 ARM Cortex™-A9 内核、2D和3D 图形处理器和 3D 1080p 视频处理器。
MarS Board评 估板具有丰富的接口,包括HDMI接口、 LVDS 接口、 Mini USB OTG接口、 Mini USB Debug 接口、RJ45 接口、USB Host 接口、TF 卡接口和 LCD 显示接口,能够帮助开发者针对上 网本、桌面一体机、高端移动互联网设备、高端掌上电脑、高端便携式媒体播放器、游戏 机和便携式导航设备等各种不同领域进行开发。

这个板子是国内的英蓓特设计的,网上能直接找的资料很少,官方给的烧写工具是Mfgtools-Rel-12.04.01_ER_MX6Q_UPDATER,但是存在兼容性问题,不支持XP以上系统以及USB3.0

我使用的系统是win 8.1 pro,所以只能另外找工具,最终我使用的是Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER,可以兼容win 8.1,但是还是需要一个USB HUB将USB3.0转换到2.0

使用Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER要注意在ProfilesMX6Q Linux UpdateOS Firmware目录下要有镜像文件,否则烧录工具不能打开

这个烧录工具与官方提供的使用方法大致相同,在cfg.ini中要烧录的预配置,配置文件内容如下

1 [profiles]
2 chip = MX6Q Linux Update
3 
4 [platform]
5 board = MarS Board
6 
7 [LIST]
8 name = Ubuntu-Marsboard-eMMC

我选择的烧写配置为Ubuntu-Marsboard-eMMC,如果要修改,在ProfilesMX6Q Linux UpdateOS Firmware目录下ucl2.xml中记录了Ubuntu-Marsboard-eMMC的配置

 1 <LIST name="ubuntu-Marsboard-eMMC" desc="Choose eMMC as media">
 2     <CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot.bin" >Loading U-boot</CMD>
 3     <CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
 4         loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</CMD>
 5     <CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"
 6         loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD>
 7     <CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
 8     
 9     <CMD state="Updater" type="push" body="$ flash_eraseall /dev/mtd0">Erasing Boot partition</CMD>
10     <CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>
11     <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mtd0 bs=512">write U-Boot to SPI-NOR</CMD>
12     <CMD state="Updater" type="push" body="$ flash_eraseall /dev/mtd1">Clear Params</CMD>
13 
14     <CMD state="Updater" type="push" body="send" file="files/uImage">Sending kernel uImage</CMD>
15     <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=1M seek=1 conv=fsync">write kernel image to sd card</CMD>
16     
17     <CMD state="Updater" type="push" body="send" file="mksdcard.sh.tar">Sending partition shell</CMD>
18     <CMD state="Updater" type="push" body="$ tar xf $FILE "> Partitioning...</CMD>
19     <CMD state="Updater" type="push" body="$ sh mksdcard.sh /dev/mmcblk0"> Partitioning...</CMD>
20 
21     <CMD state="Updater" type="push" body="$ mkfs.ext3 -j /dev/mmcblk0p1">Formatting rootfs partition</CMD>
22     <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/> 
23     <CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk0p1 /mnt/mmcblk0p1"/>
24     <CMD state="Updater" type="push" body="pipe tar --numeric-owner -zxv -C /mnt/mmcblk0p1" file="files/oneiric.tgz">Sending and writting rootfs</CMD>
25     <CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
26     <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p1">Unmounting rootfs partition</CMD>
27     <CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
28   </LIST>

在上面配置的24行

<CMD state="Updater" type="push" body="pipe tar --numeric-owner -zxv -C /mnt/mmcblk0p1" file="files/oneiric.tgz">Sending and writting rootfs</CMD>

这里设置了烧写用的系统文件镜像为files/oneiric.tgz,也就是用ProfilesMX6Q Linux UpdateOS Firmwarefilesoneiric.tgz文件

要注意的是,这个烧录方式与树莓派的烧录方式有明显不同,树莓派的镜像文件只有一个img文件,但是这里分为了三个,分别是u-boot.bin、uImage和oneiric.tgz

u-boot.bin是记录引导区的镜像,uImage是Linux内核镜像,oneiric.tgz是文件系统镜像。

官方提供了交叉编译工具和源代码,也可使用Freescale提供的BSP,可以自己精简编译内核,生成u-boot.bin和uImage文件

oneiric.tgz文件则决定了系统的版本号,MarS Board使用的是Ubuntu的衍生版本Linaro,官方自带的oneiric.tgz中是11.10的版本,可以去Linaro的官方网站下载最新版本的镜像,通过替换这个镜像使用更高版本的系统。

如果要使用14.04以上版本的系统,u-boot.bin文件需要下载最新的源码编译生成,否则无法正常引导。

要注意的是由于内核与内核动态模块不是一起编译的(内核在uImage中,内核动态模块在oneiric.tgz中),所以有些功能无法使用(如iptables)

准备好u-boot.bin、uImage和oneiric.tgz这三个文件就可以开始烧录了,烧录工具会先载入内核文件和引导文件,然后设备自动重启(中途USB会断开一小会儿,又会自动连上)开始烧录

原文地址:https://www.cnblogs.com/guozhubeta/p/4005824.html