使用mfg tool烧写android5.1的镜像之后,再使用旧版的mfg tool烧写linux或者android镜像,都不能正常启动,而且运行的uboot还是android5.1版本的uboot。

参考链接

http://www.itdadao.com/articles/c15a39492p0.html

http://www.cnblogs.com/heiyue/p/5199851.html#undefined

http://www.cnblogs.com/heiyue/p/5830505.html

https://linux.codingbelief.com/zh/storage/flash_memory/emmc/emmc_partitions.html

https://community.nxp.com/thread/331306

https://freescale.jiveon.com/thread/429311

http://blog.5ibc.net/p/80599.html

emmc boot分区

在同事的帮助下才知道emmc有boot1,boot2以及RPMB(Replay Protected Memory Block),GPAP(General Purpose Area Partitions,最多可以有4个),UDA(User Data Area)分区。而我们一般只知道UDA分区。

我们通常对emmc进行分区,也只是对UDA分区。boot1,boot2,RPMB分区是固定的,我们并不能控制器大小和分区格式。如下图所示(图片摘自网络):

这次的android5.1镜像将uboot烧写到了boot1分区,并且将boot1分区使能。那么emmc每次启动之后就从boot1分区启动,运行android5.1的uboot,而android5.1的uboot又找不到其对应的kernel等镜像(因为UDA的区域的镜像已经烧写成别的版本),所以就一直卡在启动的页面。

并且写到emmc寄存器中的值是一直保留的,不会因为开机就恢复为默认值。

而原来的工具是将uboot放在UDA分区。

android5.1的mfg tool中,ucl2.xml有那么一段。(我添加了注释)

<!-- 使emmc的boot0分区变为可读写 -->
<CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk%mmc%boot0/force_ro">access boot partition 1</CMD>
<CMD state="Updater" type="push" body="send" file="files/android/%folder%/u-boot-imx%soc%%plus%.imx" >Sending u-boot.bin</CMD>
<!-- 将uboot烧录到emmc的boot0分区,在系统盘符里分区的序号是从0开始,也就是boot0, boot1 -->
<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk%mmc%boot0 bs=512 seek=2">write U-Boot to sd card</CMD>
<!-- 使emmc的boot0分区变为只读 -->
<CMD state="Updater" type="push" body="$ echo 1 > /sys/block/mmcblk%mmc%boot0/force_ro"> re-enable read-only access </CMD>
<!-- 将boot0分区使能,那么启动的时候就会从boot1分区启动,
emmc寄存器序号是从1开始,boot1,boot2.这里的enable 1指的是emmc boot分区的第一个分区,是针对emmc的寄存器而言的。
而上面的/sys/block/mmcblk3boot0指是针对linux系统而言的,其实指的都是统一个分区,就是emmc boot的最开始的分区。
-->
<CMD state="Updater" type="push" body="$ mmc bootpart enable 1 1 /dev/mmcblk%mmc%">enable boot partion 1 to boot</CMD>

emmc boot寄存器

下图是emmc寄存器设置。

不使能引导,将BOOT_PARTITION_ENABLE设置为0,

使能boot1,将BOOT_PARTITION_ENABLE设置为1,

使能boot2,将BOOT_PARTITION_ENABLE设置为2,

使能UDA,将BOOT_PARTITION_ENABLE设置为7.

解决方法

在uboot中有emmc命令,用于设置emmc的寄存器。uboot版本不同,命令有些不一样。

          FSL 2009.08 U-boot       u-boot-fslc branch patches-2014.07
args mmc bootpart mmc partconf dev boot_ack boot_partition partition_access example for change boot partition to device 2 partition 1:
mmc bootpart 2 1 mmc partconf 2 1 1 1 example for change boot partition to device 2 partition 0:
mmc bootpart 2 0 mmc partconf 2 1 0 1

具体操作如下:

# uboot中首先查看emmc的编号
Tony> mmc list
FSL_SDHC: 0
FSL_SDHC: 1
FSL_SDHC: 2 (eMMC)
# 确定emmc的序号是2
# 查看emmc命令
Tony> mmc
mmc - MMC sub system
Usage:
mmc info - display info of the current MMC device
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
mmc hwpartition [args...] - does hardware partitioning
arguments (sizes in 512-byte blocks):
[user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
[gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
[check|set|complete] - mode, complete set partitioning completed
WARNING: Partitioning is a write-once setting once it is set to complete.
Power cycling is required to initialize partitions after set to complete.
mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
- Set the BOOT_BUS_WIDTH field of the specified device
mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>
- Change sizes of boot and RPMB partitions of specified device
mmc partconf dev boot_ack boot_partition partition_access
- Change the bits of the PARTITION_CONFIG field of the specified device
mmc rst-function dev value
- Change the RST_n_FUNCTION field of the specified device
WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.
mmc setdsr <value> - set DSR register value # 设置emmc的启动分区,主要是partconf后面的第一个和第三个参数。
# 2是emmc的编号,第三个参数设置启动的分区,对应寄存器BOOT_PARTITION_ENABLE字段。设为0表示不使能。
Tony> mmc partconf 2 0 0 0
# 或者设置为7表示从UDA启动, 0和7我都尝试了,烧录原来的镜像都能够启动成功。
Tony> mmc partconf 2 0 7 0

或者更改ucl2.xml文件,使能UDA分区。

<!-- 但是设置成0时,烧录出错,不知道为什么 -->
<CMD state="Updater" type="push" body="$ mmc bootpart enable 0 1 /dev/mmcblk%mmc%">enable boot partion 1 to boot</CMD>
或者
<!-- 设置成7,烧录成功,再烧录原来的系统,能正常运行 -->
<CMD state="Updater" type="push" body="$ mmc bootpart enable 7 1 /dev/mmcblk%mmc%">enable boot partion 1 to boot</CMD>

Author

Tony Liu

2016-11-11, Shenzhen

emmc boot1 boot2 partition的更多相关文章

  1. I.MX6 change boot partition 1 to User area

    /************************************************************************************ * I.MX6 change ...

  2. I.MX6 Android 5.1 回到 Android 4.2 emmc 启动

    /*************************************************************************** * I.MX6 Android 5.1 回到 ...

  3. Android MMC/EMMC/MTD Partition Layout

    Android devices have a couple of partitions to store different data. The common ones are the recover ...

  4. Linux和Uboot下eMMC boot分区读写

    关键词:eMMC boot.PARTITION_CONFIG.force_ro等. 1. eMMC的分区 大部分eMMC都有类似如下的分区,其中BOOT.RPMB和UDA一般是默认存在的,gpp分区需 ...

  5. AOSP5.0换8G eMMC不能开机问题

    AOSP5.0 MT6572平台.用H9TP32A4GDBCPR_KGM这颗4G的eMMC就能够.可是用H9TP65A8JDACPR_KGM这个8G的就开不了机,一直是重新启动.用串口抓LOG发现以下 ...

  6. imx6 MFG TOOL 分析

    之前分析过mfgtool的内容,最近从官网下载,返现新版的mfgtool工具将imx6各种版本的linux/android都使用一个工具进行烧录.所以从新分析一下. 新版与旧版的一个区别是烧写使用的u ...

  7. 编译android后找不到ramdisk-u.img[已解决]

    --- --- #!/bin/bash OUTDIR=out/target/product/tiny4412AHOSTBIN=out/host/linux-x86/bin # install vend ...

  8. Android updater-scripts(Edify Script)各函数详细说明(转)

    这是Android系统来运行updater-scripts的Edify语言的基本介绍. 大部分的Edify命名都是函数,当调用这些函数结束的时候,会返回数据给脚本.当然,你也可以使用这些函数的返回值来 ...

  9. LPC1800 and LPC4300 Boot/ISP/CRP

    MCU的启动方式有很多种:UART接口,扩展的静态存储单元(NOR Flash), SPI Flash,quad SPI Flash,高速USB0和USB1.另外可以通过对OTP存储单元的编程. 首先 ...

随机推荐

  1. c++ map 的使用

    1.map是一类关联式容器,它是模板类. 关联的本质在于元素的值与某个特定的键相关联,而并非通过元素在数组中的位置类获取.它的特点是增加和删除节点对迭代器的影响很小,除了操作节点,对其他的节点都没有什 ...

  2. Mysql_mysql多个TimeStamp设置

    timestamp设置默认值是Default CURRENT_TIMESTAMP timestamp设置随着表变化而自动更新是ON UPDATE CURRENT_TIMESTAMP 但是由于 一个表中 ...

  3. CustomValidator验证的使用方法

    <asp:TextBox ID="txtNum" runat="server" Width="400px" ></asp: ...

  4. [zt]给你的Mp4大换血,精选Touch里3年收集的900多首歌,"经典不忍去的""最新近流行的",与你共享~~

    如果你是音乐爱好者: 这些歌, 请戴上耳机, 调大音量, 一个人听 ,全世界 都是你的!!!!! (一)这些歌很温暖,没有金属味,适合有阳光的午后,很悠闲... [Anaesthesia]Maximi ...

  5. shell if判断语句

    测试脚本是否有语法错误: sh  -n  脚本名 一.if语句: 二.逻辑运算解析: -f  判断文件是否存在 -d 判断目录是否存在 -eq 判断是否相等 -ne 判断是否不相等 -lt 小于 -g ...

  6. 数据库SQL及相关

    //1.生成随机数 ROUND(((89 - 71 -1) * RAND() + 71), 0) DECLARE @Result INT DECLARE @Upper INT DECLARE @Low ...

  7. C#并行库(TaskParallelLibrary)用法小结

    今天有空,总结一下.NET 4.5并行库(TaskParallelLibrary)用法. 也许C和C++的程序员刚刚开始写C#还习惯于new Thread来新建一个线程,但新建线程需要内存和CPU上下 ...

  8. jQuery 判断多个 input checkbox 中至少有一个勾选

    html ( 使用 TP 标签 ) : <volist name="health_tag" id="htag"> <input type=&q ...

  9. js判断时间差

    //var startDate = "2015-09-09"; //var endDate = "2015-09-08"; var startDate = &q ...

  10. [SHELL进阶] (转)最牛B的 Linux Shell 命令 (三)

    1. 更友好的显示当前挂载的文件系统 mount | column -t 这条命令适用于任何文件系统,column 用于把输出结果进行列表格式化操作,这里最主要的目的是让大家熟悉一下 columnt ...