Ejemplo n.º 1
0
void fastboot_flash_partition_init(void)
{
    fastboot_ptentry fb_part;
    int index, part_total;
    char partition_sets[128];
    char part_name[16] = "nanda";
    char *pa_index;
    int boot_part_flag;

    printf("--------fastboot partitions--------\n");
    part_total = sunxi_partition_get_total_num();
    printf("-total partitions:%d-\n", part_total);
    printf("%-12s  %-12s  %-12s\n", "-name-", "-start-", "-size-");
    memset(partition_sets, ' ', 128);
    boot_part_flag = 0;

    pa_index = partition_sets;
    for(index = 0; index < part_total && index < MBR_MAX_PART_COUNT; index++) {
        sunxi_partition_get_name(index, &fb_part.name[0]);
        fb_part.start = sunxi_partition_get_offset(index) * 512;
        fb_part.length = sunxi_partition_get_size(index) * 512;
        fb_part.flags = 0;
        printf("%-12s: %-12x  %-12x\n", fb_part.name, fb_part.start, fb_part.length);
        fastboot_flash_add_ptn(&fb_part);
        if(!strcmp(fb_part.name, "boot"))
        {
            boot_part_flag = 1;
        }
        if(boot_part_flag)
        {
            strcpy(pa_index, part_name);
            pa_index += strlen(part_name);
            *pa_index = '@';
            pa_index ++;
            strcpy(pa_index, fb_part.name);
            pa_index += strlen(fb_part.name);
            *pa_index = ':' ;
            pa_index ++;
            part_name[4] ++;
        }
    }
    pa_index--;
    *pa_index = '\0';
    printf("-----------------------------------\n");

    setenv("partitions", partition_sets);

}
Ejemplo n.º 2
0
void fastboot_partition_init(void)
{
	fastboot_ptentry fb_part;
	int index, part_total;
	char partition_sets[PARTITION_SETS_MAX_SIZE];
	char part_name[16];
	char *partition_index = partition_sets;
	int offset = 0;
	int temp_offset = 0;
	int storage_type = uboot_spare_head.boot_data.storage_type;

	printf("--------fastboot partitions--------\n");
	part_total = sunxi_partition_get_total_num();
	if((part_total <= 0) || (part_total > SUNXI_MBR_MAX_PART_COUNT))
	{
		printf("mbr not exist\n");

		return ;
	}
	printf("-total partitions:%d-\n", part_total);
	printf("%-12s  %-12s  %-12s\n", "-name-", "-start-", "-size-");

	memset(partition_sets, 0, PARTITION_SETS_MAX_SIZE);

	for(index = 0; index < part_total && index < SUNXI_MBR_MAX_PART_COUNT; index++)
	{
		sunxi_partition_get_name(index, &fb_part.name[0]);
		fb_part.start = sunxi_partition_get_offset(index) * 512;
		fb_part.length = sunxi_partition_get_size(index) * 512;
		fb_part.flags = 0;
		printf("%-12s: %-12x  %-12x\n", fb_part.name, fb_part.start, fb_part.length);

		memset(part_name, 0, 16);
		if(!storage_type)
		{
			sprintf(part_name, "nand%c", 'a' + index);
		}
		else
		{
			if(index == 0)
			{
				strcpy(part_name, "mmcblk0p2");
			}
			else if( (index+1)==part_total)
			{
				strcpy(part_name, "mmcblk0p1");
			}
			else
			{
				sprintf(part_name, "mmcblk0p%d", index + 4);
			}
		}

		temp_offset = strlen(fb_part.name) + strlen(part_name) + 2;
		if(temp_offset >= PARTITION_SETS_MAX_SIZE)
		{
			printf("partition_sets is too long, please reduces partition name\n");
			break;
		}
		fastboot_flash_add_ptn(&fb_part);
		sprintf(partition_index, "%s@%s:", fb_part.name, part_name);
		offset += temp_offset;
		partition_index = partition_sets + offset;
	}

	partition_sets[offset-1] = '\0';
	partition_sets[PARTITION_SETS_MAX_SIZE - 1] = '\0';
	printf("-----------------------------------\n");

	setenv("partitions", partition_sets);
}
Ejemplo n.º 3
0
void fastboot_flash_partition_init(void)
{
	fastboot_ptentry fb_part;
	int index, part_total;
	char partition_sets[1024];
	char part_name[32];
	char *pa_index;
	int  part_name_count;	
    
	printf("--------fastboot partitions--------\n");
	part_total = sunxi_partition_get_total_num();
	if((part_total <= 0) || (part_total > MBR_MAX_PART_COUNT))
	{
		printf("mbr not exist\n");

		return ;
	}
	printf("-total partitions:%d-\n", part_total);
	printf("%-12s  %-12s  %-12s\n", "-name-", "-start-", "-size-");
	memset(partition_sets, ' ', sizeof(partition_sets));

	memset(part_name, 0, sizeof(part_name));
	if(!storage_type)
	{
		memcpy(part_name, "nanda", 5);
	}
	else
	{
		memcpy(part_name, "mmcblk0p2", 9);
		part_name_count = 2;
	}
	pa_index = partition_sets;
	for(index = 0; index < part_total && index < MBR_MAX_PART_COUNT; index++) {
		sunxi_partition_get_name(index, &fb_part.name[0]);
		fb_part.start = sunxi_partition_get_offset(index) * 512;
		fb_part.length = sunxi_partition_get_size(index) * 512;
		fb_part.flags = 0;
		printf("%-12s: %-12x  %-12x\n", fb_part.name, fb_part.start>>9, fb_part.length>>9);
		fastboot_flash_add_ptn(&fb_part);

		strcpy(pa_index, fb_part.name);
		pa_index += strlen(fb_part.name);
		*pa_index = '@' ;
		pa_index ++;

		strcpy(pa_index, part_name);
		pa_index += strlen(part_name);
		*pa_index = ':';
		pa_index ++;			

		if(!storage_type)
		{
			part_name[4] ++;
		}
		else
		{
			part_name_count ++;
			if(part_name_count < 5)
			{
				part_name_count = 5;
				part_name[8] = '5';	
			}
			else if(part_name_count < 10)
			{
				part_name[8] ++;
			}
			else if(part_name_count == 10)
			{
				part_name[8] = '1';
				part_name[9] = '0';
			}
			else
			{
				part_name[9] ++;
			}
		}
	}
	pa_index--;
	if(storage_type)
	{
		if(part_name_count > 10)
		{
			pa_index--;
		}
		else
		{
			*(pa_index - 1) = '1';
		}
	}
	*pa_index = '\0';
	printf("-----------------------------------\n");

	setenv("partitions", partition_sets);
	
}