fastboot:remote: Image is too large for the partition

-boot版本: v2009.08


在调试其他功能时增加了u-boot.bin容量到1M,使用fastboot download时提示:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sending 'bootloader' (1191 KB)...  
  2. OKAY [  1.062s]  
  3. writing 'bootloader'...  
  4. FAILED (remote: image too large for partition)  
  5. finished. total time: 1.098s  
但是分区的时候是预留蛮大空间的:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. # partition size in MB  
  2. BOOTLOAD_RESERVE=8  

只能先查找出现error log的地方, uboot-imx/common/cmd_fastboot.c

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)  
  2. {  
  3. ......  
  4.                 else if ((download_bytes >  
  5.                        (ptn->length * MMC_SATA_BLOCK_SIZE)) &&  
  6.                         !(ptn->flags & FASTBOOT_PTENTRY_FLAGS_WRITE_ENV)) {  
  7.                     printf("Image too large for the partition\n");  
  8.                     sprintf(response, "FAILimage too large for partition");  
  9.                 } else if (ptn->flags & FASTBOOT_PTENTRY_FLAGS_WRITE_ENV) {  
  10. ......  
  11. }  
download_bytes是要download的size, 

ptn->length应该就是u-boot分区的大小了,以MMC_SATA_BLOCK_SIZE为单位。

那么ptn->length是什么时候得到的,看fastboot_init():

fastboot_init -> fastboot_init_mmc_sata_ptable

uboot-imx/drivers/fastboot/fastboot.c

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. static int fastboot_init_mmc_sata_ptable(void)  
  2. {  
  3. ......  
  4.     /*以下操作是保存分区表信息到ptable中*/  
  5.     memset((char *)ptable, 0,  
  6.             sizeof(fastboot_ptentry) * (PTN_RECOVERY_INDEX + 1));  
  7.     /* MBR */  
  8.     /*头一个分区放MBR*/  
  9.     strcpy(ptable[PTN_MBR_INDEX].name, "mbr");  
  10.     ptable[PTN_MBR_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz;  
  11.     ptable[PTN_MBR_INDEX].length = ANDROID_MBR_SIZE / dev_desc->blksz;  
  12.     ptable[PTN_MBR_INDEX].partition_id = user_partition;  
  13.     /* Bootloader */  
  14.     /*保存bootloader信息,也就是u-boot信息*/  
  15.     strcpy(ptable[PTN_BOOTLOADER_INDEX].name, "bootloader");  
  16.     ptable[PTN_BOOTLOADER_INDEX].start =  
  17.                 ANDROID_BOOTLOADER_OFFSET / dev_desc->blksz;  
  18.     ptable[PTN_BOOTLOADER_INDEX].length =  
  19.                  ANDROID_BOOTLOADER_SIZE / dev_desc->blksz;  
  20.     ptable[PTN_BOOTLOADER_INDEX].partition_id = boot_partition;  
  21.     /*从MBR中读取boot, recovery, system分区的信息并保存*/  
  22.     setup_ptable_mmc_partition(PTN_KERNEL_INDEX,  
  23.                    CONFIG_ANDROID_BOOT_PARTITION_MMC,  
  24.                    user_partition, "boot", dev_desc, ptable);  
  25.     setup_ptable_mmc_partition(PTN_RECOVERY_INDEX,  
  26.                    CONFIG_ANDROID_RECOVERY_PARTITION_MMC,  
  27.                    user_partition,  
  28.                    "recovery", dev_desc, ptable);  
  29.     setup_ptable_mmc_partition(PTN_SYSTEM_INDEX,  
  30.                    CONFIG_ANDROID_SYSTEM_PARTITION_MMC,  
  31.                    user_partition,  
  32.                    "system", dev_desc, ptable);  
  33.     /*全部添加到ptable中*/  
  34.     for (i = 0; i <= PTN_RECOVERY_INDEX; i++)  
  35.         fastboot_flash_add_ptn(&ptable[i]);  
  36.   
  37.     return 0;  
  38. }  
ANDROID_BOOTLOADER_OFFSET:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. #define ANDROID_BOOTLOADER_SIZE     0xFFC00  
所以原因就在于u-boot.bin的size是在u-boot写死了,而不是从MBR中读取的,只要修改此值就可以了。

为什么不能按照读取boot分区那样操作呢?

因为在分区表里并没有保存bootloader的信息,所以MBR和u-boot只能在u-boot中写死了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值