-boot版本: v2009.08
在调试其他功能时增加了u-boot.bin容量到1M,使用fastboot download时提示:
- sending 'bootloader' (1191 KB)...
- OKAY [ 1.062s]
- writing 'bootloader'...
- FAILED (remote: image too large for partition)
- finished. total time: 1.098s
但是分区的时候是预留蛮大空间的:
- # partition size in MB
- BOOTLOAD_RESERVE=8
只能先查找出现error log的地方, uboot-imx/common/cmd_fastboot.c
- static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
- {
- ......
- else if ((download_bytes >
- (ptn->length * MMC_SATA_BLOCK_SIZE)) &&
- !(ptn->flags & FASTBOOT_PTENTRY_FLAGS_WRITE_ENV)) {
- printf("Image too large for the partition\n");
- sprintf(response, "FAILimage too large for partition");
- } else if (ptn->flags & FASTBOOT_PTENTRY_FLAGS_WRITE_ENV) {
- ......
- }
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
- static int fastboot_init_mmc_sata_ptable(void)
- {
- ......
-
- memset((char *)ptable, 0,
- sizeof(fastboot_ptentry) * (PTN_RECOVERY_INDEX + 1));
-
-
- strcpy(ptable[PTN_MBR_INDEX].name, "mbr");
- ptable[PTN_MBR_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz;
- ptable[PTN_MBR_INDEX].length = ANDROID_MBR_SIZE / dev_desc->blksz;
- ptable[PTN_MBR_INDEX].partition_id = user_partition;
-
-
- strcpy(ptable[PTN_BOOTLOADER_INDEX].name, "bootloader");
- ptable[PTN_BOOTLOADER_INDEX].start =
- ANDROID_BOOTLOADER_OFFSET / dev_desc->blksz;
- ptable[PTN_BOOTLOADER_INDEX].length =
- ANDROID_BOOTLOADER_SIZE / dev_desc->blksz;
- ptable[PTN_BOOTLOADER_INDEX].partition_id = boot_partition;
-
- setup_ptable_mmc_partition(PTN_KERNEL_INDEX,
- CONFIG_ANDROID_BOOT_PARTITION_MMC,
- user_partition, "boot", dev_desc, ptable);
- setup_ptable_mmc_partition(PTN_RECOVERY_INDEX,
- CONFIG_ANDROID_RECOVERY_PARTITION_MMC,
- user_partition,
- "recovery", dev_desc, ptable);
- setup_ptable_mmc_partition(PTN_SYSTEM_INDEX,
- CONFIG_ANDROID_SYSTEM_PARTITION_MMC,
- user_partition,
- "system", dev_desc, ptable);
-
- for (i = 0; i <= PTN_RECOVERY_INDEX; i++)
- fastboot_flash_add_ptn(&ptable[i]);
-
- return 0;
- }
ANDROID_BOOTLOADER_OFFSET:
- #define ANDROID_BOOTLOADER_SIZE 0xFFC00
所以原因就在于u-boot.bin的size是在u-boot写死了,而不是从MBR中读取的,只要修改此值就可以了。
为什么不能按照读取boot分区那样操作呢?
因为在分区表里并没有保存bootloader的信息,所以MBR和u-boot只能在u-boot中写死了。