OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 1091|回复: 0

IMX6ULL eMMC板添加 "A/B(无缝)系统"之二:文件烧录

[复制链接]

5

主题

120

帖子

0

精华

高级会员

Rank: 4

积分
813
金钱
813
注册时间
2021-2-26
在线时间
117 小时
发表于 2021-3-7 14:15:54 | 显示全部楼层 |阅读模式
上一个帖子我们讲到了分区表的修改,并且成功的分出了我们想要的分区表,现在我们烧录对应的文件到分区中。
由之前的帖子我们知道,烧录时候使用的烧录脚本是<mfgtool/Profiles/Linux/OS Firmware/ucl2.xml>,那我们直接对他进行修改。

修改前,我们要做一些记录:
uboot_a ====> /dev/mmcblk1boot0
uboot_b ====> /dev/mmcblk1boot1
boot_a  ====> /dev/mmcblk1p1
boot_b  ====> /dev/mmcblk1p2
rootfs_a ====> /dev/mmcblk1p5
rootfs_b ====> /dev/mmcblk1p6
userdata ====> /dev/mmcblk1p7

ucl2.xml修改如下:

  1. <LIST name="eMMC" desc="Choose eMMC as media">
  2.         <CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6ull-14x14-emmc.imx" ifdev="MX6ULL">Loading U-boot</CMD>
  3.                
  4.         <CMD state="BootStrap" type="load" file="firmware/zImage" address="0x80800000"
  5.                 loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6ULL">Loading Kernel.</CMD>

  6.         <CMD state="BootStrap" type="load" file="firmware/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot" address="0x83800000"
  7.                 loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6ULL">Loading Initramfs.</CMD>

  8.         <CMD state="BootStrap" type="load" file="firmware/imx6ull-14x14-emmc.dtb" address="0x83000000"
  9.                 loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6ULL">Loading device tree.</CMD>

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


  11.         <CMD state="Updater" type="push" body="send" file="mksdcard.sh.tar">Sending partition shell</CMD>
  12.         <CMD state="Updater" type="push" body="$ tar -xf $FILE "> Partitioning...</CMD>
  13.         <CMD state="Updater" type="push" body="$ sh mksdcard.sh /dev/mmcblk1"> Partitioning...</CMD>

  14.         <!-- burn uboot -->
  15.         <CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk1 bs=1k seek=768 conv=fsync count=8">clear u-boot env</CMD>
  16.         <CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk1boot0/force_ro">access boot partition 1</CMD>
  17.         <CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk1boot1/force_ro">access boot partition 2</CMD>       <!-- 打开emmc boot1的写入权限 -->
  18.         <CMD state="Updater" type="push" body="send" file="files/boot/u-boot-imx6ull-14x14-ddr%ddr%-emmc1.imx" ifdev="MX6ULL">Sending u-boot1.bin</CMD>
  19.         <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk1boot0 bs=512 seek=2">write U-Boot to boot1</CMD>
  20.         <CMD state="Updater" type="push" body="$ sleep 1">delay</CMD>
  21.         <CMD state="Updater" type="push" body="send" file="files/boot/u-boot-imx6ull-14x14-ddr%ddr%-emmc2.imx" ifdev="MX6ULL">Sending u-boot2.bin</CMD>
  22.         <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk1boot1 bs=512 seek=2">write U-Boot to boot2</CMD>    <!-- 写入uboot到emmc boot1分区 -->
  23.         <CMD state="Updater" type="push" body="$ echo 1 > /sys/block/mmcblk1boot0/force_ro"> re-enable read-only access </CMD>
  24.         <CMD state="Updater" type="push" body="$ echo 1 > /sys/block/mmcblk1boot1/force_ro"> re-enable read-only access </CMD>    <!-- 关闭emmc boot1的写入权限 -->
  25.         <CMD state="Updater" type="push" body="$ mmc bootpart enable 1 1 /dev/mmcblk1">enable boot partion 1 to boot</CMD>
  26.         <!-- <CMD state="Updater" type="push" body="$ mmc bootpart enable 2 1 /dev/mmcblk1">enable boot partion 2 to boot</CMD> -->

  27.         <!-- format and mount boot partition         -->
  28.         <CMD state="Updater" type="push" body="$ while [ ! -e /dev/mmcblk1p1 ]; do sleep 1; echo "waiting..."; done ">Waiting for the partition ready</CMD>
  29.         <CMD state="Updater" type="push" body="$ mkfs.vfat -F 32 /dev/mmcblk1p1">Formatting boot partition1</CMD>
  30.         <CMD state="Updater" type="push" body="$ mkfs.vfat -F 32 /dev/mmcblk1p2">Formatting boot partition2</CMD>      <!-- 格式化/dev/mmcblk1p2为FAT32格式 -->
  31.         <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk1p1"/>
  32.         <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk1p2"/>
  33.         <CMD state="Updater" type="push" body="$ mount -t vfat /dev/mmcblk1p1 /mnt/mmcblk1p1"/>
  34.         <CMD state="Updater" type="push" body="$ mount -t vfat /dev/mmcblk1p2 /mnt/mmcblk1p2"/>         <!-- 挂载/dev/mmcblk1p2到/mnt/mmcblk1p2 -->


  35.         <CMD state="Updater" type="push" body="send" file="files/boot/zImage">Sending kernel zImage</CMD>
  36.         <CMD state="Updater" type="push" body="$ cp $FILE /mnt/mmcblk1p1/zImage">write kernel image to boot1</CMD>
  37.         <CMD state="Updater" type="push" body="$ cp $FILE /mnt/mmcblk1p2/zImage">write kernel image to boot2</CMD>    <!-- 复制zImage到/mnt/mmcblk1p2 -->

  38.         <CMD state="Updater" type="push" body="send" file="files/boot/imx6ull-alientek-emmc.dtb" ifdev="MX6ULL">Sending Device Tree file</CMD>
  39.         <CMD state="Updater" type="push" body="$ cp $FILE /mnt/mmcblk1p1/imx6ull-alientek-emmc.dtb" ifdev="MX6ULL">write device tree to boot1</CMD>
  40.         <CMD state="Updater" type="push" body="$ cp $FILE /mnt/mmcblk1p2/imx6ull-alientek-emmc.dtb" ifdev="MX6ULL">write device tree to boot2</CMD>     <!-- 复制dtb到/mnt/mmcblk1p2 -->
  41.       
  42.         <CMD state="Updater" type="push" body="$ sleep 1">delay</CMD>
  43.         <CMD state="Updater" type="push" body="$ sync">Sync...</CMD>
  44.         <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk1p1">Unmounting vfat partition</CMD>
  45.         <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk1p2">Unmounting vfat partition</CMD>              <!-- 卸载/mnt/mmcblk1p2 -->

  46.         <CMD state="Updater" type="push" body="$ mkfs.ext3 -F -E nodiscard /dev/mmcblk1p5">Formatting rootfs partition1</CMD>
  47.         <CMD state="Updater" type="push" body="$ mkfs.ext3 -F -E nodiscard /dev/mmcblk1p6">Formatting rootfs partition2</CMD>      <!-- 格式化/dev/mmcblk1p6为EXT3格式 -->
  48.         <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk1p5"/>
  49.         <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk1p6"/>
  50.         <CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk1p5 /mnt/mmcblk1p5"/>
  51.         <CMD state="Updater" type="push" body="$ mount -t ext3 /dev/mmcblk1p6 /mnt/mmcblk1p6"/>          <!-- 挂载/dev/mmcblk1p6到/mnt/mmcblk1p6 -->

  52.         <CMD state="Updater" type="push" body="pipe tar -jxv -C /mnt/mmcblk1p5" file="files/filesystem/rootfs1.tar.bz2" ifdev="MX6ULL">Sending and writting rootfs1</CMD>
  53.         <CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
  54.         <CMD state="Updater" type="push" body="$ sleep 1">delay</CMD>
  55.       
  56.         <CMD state="Updater" type="push" body="pipe tar -jxv -C /mnt/mmcblk1p6" file="files/filesystem/rootfs2.tar.bz2" ifdev="MX6ULL">Sending and writting rootfs2</CMD>       <!-- 拷贝rootfs文件到/mnt/mmcblk1p6 -->
  57.         <CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>
  58.         <CMD state="Updater" type="push" body="$ sync">Sync...</CMD>
  59.         <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk1p5">Unmounting rootfs partition</CMD>
  60.         <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk1p6">Unmounting rootfs partition</CMD>          <!-- 卸载/mnt/mmcblk1p6 -->
  61.       
  62.         <CMD state="Updater" type="push" body="$ mkfs.ext3 -F -E nodiscard /dev/mmcblk1p7">Formatting userdata partition1</CMD>        <!-- 格式化/dev/mmcblk1p7为EXT3格式 -->
  63.       
  64.         <CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
  65.   </LIST>
复制代码

准备好对应的文件,使用mfgtool进行烧录,正常情况下,烧录会直接成功。那么接下来就是第一次开机启动了。

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-25 21:38

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表