mboot 升级提示分区限制问题

     mstar主板 升级主程序出现分区限制问题,出现烧录执行mmc erase.p 命令时出现Exceed the max number of partition, STOP错误打印,最开始以为是分区大小有问题,后面查看代码,发现是版本匹配问题。暂时做如下修改

通过Exceed the max number of partition, STOP找到


                if(exist_pdb.signature == EMMC_PARTITION_MAGIC){
                        if(!strcmp((const char *)pdb_p->name, (const char *)exist_pdb.name)){
                            printf("** Try to change a exist partition %s **\n", exist_pdb.name);
                            if(pdb_p->block_count > exist_pdb.block_count){
                                printf("** The new size of the partition is too big!\n");
                                return (-1);
                            }

                            if(special_start != 0)
                                pdb_p->start_block = special_start;
                            else
                                pdb_p->start_block = exist_pdb.start_block;
                           
                            if(pdb_p->start_block + pdb_p->block_count > dev_desc->lba){
                                printf("** Partition exceed emmc capacity**\n");
                                return (-1);
                            }                         
                                
                            if(dev_desc->block_write(dev_desc->dev, n, 1, (ulong *)pdb_p) != 1){
                                printf("** Can't write Driver Desiptor Block **\n");
                                return (-1);
                            }                         
                            return (0);
                        }

                        if(exist_pdb.start_block + exist_pdb.block_count > usr_partition_start)
                            /* skip UBOOT partition */
                            start_block += exist_pdb.block_count;
                        
                        ++n;
                        if(n > g_emmc_reserved_for_map){
                            printf("** Exceed the max number of partition, STOP!**\n");
                            return (-1);
                        }
                }

 通过上述代码发现是分区出超过了g_emmc_reserved_for_map参数定义数量,接着查找g_emmc_reserved_for_map


static int check_partition_table_version(block_dev_desc_t *dev_desc, emmc_driver_desc_t *ddb_p)
{        
        if (part_emmc_read_ddb (dev_desc, ddb_p) < 0) {
                return (-1);
        }

		#ifdef CONFIG_DOUBLE_MBOOT
        if (ddb_p->version == EMMC_PARTITIONTABLE_VERSION2 || ddb_p->version == EMMC_PARTITIONTABLE_VERSION3){
		#else
        if (ddb_p->version == EMMC_PARTITIONTABLE_VERSION2){
		#endif
            g_emmc_reserved_for_map = ddb_p->drvr_cnt;
            return 1;
        }
        else{            
            g_emmc_reserved_for_map = EMMC_RESERVED_FOR_MAP;
            return 0;
        }
}

上诉代码可以看出限制分区个数的g_emmc_reserved_for_map 是会先判断ddb_p->version和EMMC_PARTITIONTABLE_VERSION2参数是否相同,相同的话直接动态获取,我的升级包就是这个地方出现了错误导致程序走到了g_emmc_reserved_for_map = EMMC_RESERVED_FOR_MAP,下面查看

u-boot-2011.06\disk\part_emmc.h中对EMMC_RESERVED_FOR_MAP,EMMC_PARTITIONTABLE_VERSION2定义。


#define EMMC_RESERVED_FOR_MAP 10        
#define EMMC_RESERVED_FOR_MAP_V2 63   //0~32kb for partition table. 32kb~64kb reserved for partition table, but not used
#ifdef CONFIG_DOUBLE_MBOOT
#define EMMC_RESERVED_FOR_MAP_V3 EMMC_RESERVED_FOR_MAP_V2   //0~32kb for partition table. 32kb~64kb reserved for partition table, but not used

#define EMMC_PARTITION_MAGIC    0x5840
#define EMMC_PARTITIONTABLE_VERSION2 0x2000
#ifdef CONFIG_DOUBLE_MBOOT
#define EMMC_PARTITIONTABLE_VERSION3 0x4000

发现EMMC_PARTITIONTABLE_VERSION2为0x2000而我通过打印ddb_p->version为0x4000,于是修改EMMC_PARTITIONTABLE_VERSION2为0x4000重新烧录mboot 然后升级主程序升级成功,另外也可直接修改EMMC_RESERVED_FOR_MAP 为你的分区数量。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值