关于uboot for SDMMC 分区的疑惑

#elif defined(CFG_FASTBOOT_SDMMCBSP)
{
 int start, count;
 unsigned char pid;

 pcount = 0;

#if defined(CONFIG_FUSED)
 /* FW BL1 for fused chip */
 strcpy(ptable[pcount].name, "fwbl1");
 ptable[pcount].start = 0;
 ptable[pcount].length = 0;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
 pcount++;
#endif

 /* Bootloader */
 strcpy(ptable[pcount].name, "bootloader");
 ptable[pcount].start = 0;
 ptable[pcount].length = 0;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
 pcount++;

 /* Kernel */
 strcpy(ptable[pcount].name, "kernel");
 ptable[pcount].start = 0;
 ptable[pcount].length = 0;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
 pcount++;

 /* Ramdisk */
 strcpy(ptable[pcount].name, "ramdisk");
 ptable[pcount].start = 0;
 ptable[pcount].length = 0x300000;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
 pcount++;

 /* System */
 get_mmc_part_info("0", 2, &start, &count, &pid);
 if (pid != 0x83)
  goto part_type_error;
 strcpy(ptable[pcount].name, "system");
 ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
 pcount++;

 /* Data */
 get_mmc_part_info("0", 3, &start, &count, &pid);
 if (pid != 0x83)
  goto part_type_error;
 strcpy(ptable[pcount].name, "userdata");
 ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
 pcount++;

 /* Cache */
 get_mmc_part_info("0", 4, &start, &count, &pid);
 if (pid != 0x83)
  goto part_type_error;
 strcpy(ptable[pcount].name, "cache");
 ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
 pcount++;

 /* fat */
 get_mmc_part_info("0", 1, &start, &count, &pid);
 if (pid != 0xc)
  goto part_type_error;
 strcpy(ptable[pcount].name, "fat");
 ptable[pcount].start = start * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].length = count * CFG_FASTBOOT_SDMMC_BLOCKSIZE;
 ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD;
 pcount++;


 

明白了。这个 kernel和u-boot 都是通过名字来确认自己的位置的。
下面这个函数决定了
int movi_set_ofs(uint last)
{
 int changed = 0;

 if (ofsinfo.last != last) {
  ofsinfo.last  = last - (eFUSE_SIZE / MOVI_BLKSIZE);
  ofsinfo.bl1 = ofsinfo.last - MOVI_BL1_BLKCNT;
  ofsinfo.env = ofsinfo.bl1 - MOVI_ENV_BLKCNT;
  ofsinfo.bl2 = ofsinfo.bl1 - (MOVI_BL2_BLKCNT + MOVI_ENV_BLKCNT);
  ofsinfo.kernel = ofsinfo.bl2 - MOVI_ZIMAGE_BLKCNT;
  ofsinfo.rootfs = ofsinfo.kernel - MOVI_ROOTFS_BLKCNT;
  changed = 1;
 }

 return changed;
}
------------在 do_movi 函数有如下可以接到上面
if (strcmp(argv[2], "u-boot") == 0) {
     if (movi_emmc == 1) { /* eMMC_4.3 */
      printf("eMMC Writing bootloader to sector %d (%d sectors).. ", ofsinfo.bl2, EMMC_BL_BLKCNT);
      emmc_write((uint) addr, ofsinfo.bl2, EMMC_BL_BLKCNT);
     } else {  /* SD/MMC */
      printf("Writing 1st bootloader to sector %d (%d sectors).. ", ofsinfo.bl1, MOVI_BL1_BLKCNT);
      movi_write((uint) addr, ofsinfo.bl1, MOVI_BL1_BLKCNT);
      printf("completed\nWriting 2nd bootloader to sector %d (%d sectors).. ", ofsinfo.bl2, MOVI_BL2_BLKCNT);
      movi_write((uint) addr, ofsinfo.bl2, MOVI_BL2_BLKCNT);
     }
     printf("completed\n");

    } else if (strcmp(argv[2], "kernel") == 0) {
     if (movi_emmc == 1) { /* eMMC_4.3 */
      printf("eMMC Writing kernel to sector %d (%d sectors).. ", ofsinfo.kernel, EMMC_KERNEL_BLKCNT);
      emmc_write((uint) addr, ofsinfo.kernel, EMMC_KERNEL_BLKCNT);
     } else {  /* SD/MMC */
      printf("Writing kernel to sector %d (%d sectors).. ", ofsinfo.kernel, MOVI_ZIMAGE_BLKCNT);
      movi_write((uint) addr, ofsinfo.kernel, MOVI_ZIMAGE_BLKCNT);
     }
     printf("completed\n");

    }

 

具体的东西就要看看S5PV210的irom 的文档才知道这个实际的位置了。

呵呵,总算明白一些了。很有意思的uboot ,和wince就是很大不同。

你可能感兴趣的:(关于uboot for SDMMC 分区的疑惑)