コード例 #1
0
int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
	char *cmd;
	ulong addr, start_blk, blkcnt;
	char *addr_img_compare;         //used to compare the image between 4212 & 4412
	uint rfs_size;
	char run_cmd[100];
	uint rw = 0, attribute = 0;
	int i;
	member_t *image;
	struct mmc *mmc;
	int boot_dev = 0;

	cmd = argv[1];

	switch (cmd[0]) {
	case 'i':
		raw_area_control.magic_number = 0;
		run_command("mmcinfo", 0);
		return 1;	
	case 'r':
		rw = 0;	/* read case */
		break;
	case 'w':
		rw = 1; /* write case */
		break;
	default:
		goto usage;
	}
	
	cmd = argv[2];

	switch (cmd[0]) {
	
	case 'f':
		if (argc != 4)
			goto usage;
		attribute = 0x0;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'u':
		if (argc != 4)
			goto usage;
		attribute = 0x2;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'k':
		if (argc != 4)
			goto usage;
		attribute = 0x4;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
		
	#ifdef CONFIG_RECOVERY
	case 'R':
		if (argc != 5)
			goto usage;
		attribute = 0x6;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	#endif
	
	case 'r':
		if (argc != 5)
			goto usage;
		attribute = 0x8;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'e':
		if (argc != 4)
			goto usage;
		attribute = 0x20;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;		

	
	default:
		goto usage;
	}
	
	mmc = find_mmc_device(0);
	

	if(OmPin == BOOT_EMMC441)
	{
		boot_dev = 0;		
	}
	else if(OmPin == BOOT_MMCSD)
	{
		if(strcmp(mmc->name, "S5P_MSHC4") == 0)//emmc exist..
		{
			boot_dev = 1;	
		}
		else
		{
			boot_dev = 0; 
		}

	}
	else
	{
		boot_dev = 0; 
		printf("[ERROR]Undefined booting mode\n");
	}

	
//	init_raw_area_table();

	/* firmware BL1 r/w */
	if (attribute == 0x0) {
		/* on write case we should write BL1 1st. */
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s FWBL1 .. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}

#if defined(CONFIG_SECURE)
	
	/* u-boot r/w */
	if (attribute == 0x2) {
		/* on write case we should write BL2 1st. */
		if (rw) {
			start_blk = raw_area_control.image[1].start_blk;
			blkcnt = raw_area_control.image[1].used_blk;
			printf("Writing BL1 to sector %ld (%ld sectors).. ",
					start_blk, blkcnt);
			movi_calc_checksum_bl1(addr);
		}
		
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s bootloader.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;		
		
#else	/* NOT CONFIG_SECURE */
	/* u-boot r/w */
	if (attribute == 0x2) {
		#if 0//ly: we don't need it 
		/* on write case we should write BL2 1st. */
		if (rw) {
			start_blk = raw_area_control.image[1].start_blk;
			blkcnt = raw_area_control.image[1].used_blk;
			printf("Writing BL1 to sector %ld (%ld sectors).. ",
					start_blk, blkcnt);
			movi_write_bl1(addr);
		}

		#endif
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
				
		}
		start_blk =1;// image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s bootloader.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 1 0x%lx 0x%lx 0x%lx", //0-->1
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}
#endif		
	/* u-boot r/w for emmc*/
	if (attribute == 0x20) {

		//printf("******u-boot r/w for emmc!!\n");

	
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == 0x2) /* the same with uboot setting */
				break;
		}

		/* switch mmc to boot partition */

		/* transfer u-boot-config-fused */

		/*added by jzb
		   check whether the uboot img matchs the board or not
		*/
		#if 0
		addr_img_compare = addr + 4;//there is a difference at the fifth byte between 4212 & 4412 image
		
		if ((s5pc210_cpu_id & 0xfffff000) == SMDK4212_ID) {
			if (*addr_img_compare != 0x66) {
				printf("\n\n*** Incorrect u-boot image!!!\n");
				printf("*** Please fuse the %s!\n",CONFIG_4212_BOOTLOADER);
				return -1;
			}
		}
		else if ((s5pc210_cpu_id & 0xfffff000) == SMDK4412_ID && Is_TC4_Dvt == 0) {
			if (*addr_img_compare != 0xfe) {
				printf("\n\n*** Incorrect u-boot image!!!\n");
				printf("*** Please fuse the %s!\n",CONFIG_4412_BOOTLOADER);
				return -1;
			}
		}
		else if ((s5pc210_cpu_id & 0xfffff000) == SMDK4412_ID && Is_TC4_Dvt != 0) {
			if (*addr_img_compare != 0x8a) {
				printf("\n\n*** Incorrect u-boot image!!!\n");
				printf("*** Please fuse the %s!\n",CONFIG_4412_DVT_BOOTLOADER);
				return -1;
			}
		}
		#endif
		
		start_blk =0;// image[i].start_blk ;//+ MOVI_BL1_BLKCNT;
		blkcnt = image[i].used_blk ;//- MOVI_BL1_BLKCNT;
		printf("%s bootloader.. %ld, %ld \n", rw ? "writing":"reading",
				start_blk, blkcnt);
		
		sprintf(run_cmd,"emmc open 0");
		run_command(run_cmd, 0);
		
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);


		run_command(run_cmd, 0);

		/* switch mmc to normal paritition */
		sprintf(run_cmd,"emmc close 0");
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}
	
	/* kernel r/w */
	if (attribute == 0x4) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s kernel.. %ld, %ld ", rw ? "writing" : "reading",
				start_blk, blkcnt);
		if (1 == fuse_by_fastboot)
			sprintf(run_cmd, "mmc %s %s 0x%lx 0x%lx 0x%lx",
					rw ? "write" : "read", dev_number_write ? "1" : "0",
					addr, start_blk, blkcnt);
		else
		{
			#if 0
			if (key1_pulldown == 1)
				sprintf(run_cmd,"mmc %s 1 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",
						addr, start_blk, blkcnt);
			else 
			#endif
				sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",boot_dev,
						addr, start_blk, blkcnt);
		}
		
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}


	
	/* root file system r/w */
	if (attribute == 0x8) {
		rfs_size = simple_strtoul(argv[4], NULL, 16);
		
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = rfs_size/MOVI_BLKSIZE +
			((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
		image[i].used_blk = blkcnt;
		printf("%s RFS.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		if (1 == fuse_by_fastboot)
			sprintf(run_cmd, "mmc %s %s 0x%lx 0x%lx 0x%lx",
					rw ? "write" : "read", dev_number_write ? "1" : "0",
					addr, start_blk, blkcnt);
		else
		{
			#if 0
			if (key1_pulldown == 1)
				sprintf(run_cmd,"mmc %s 1 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",
						addr, start_blk, blkcnt);
			else
			#endif
				sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",boot_dev,
						addr, start_blk, blkcnt);
		}

		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}

	/* Recovery image.. r/w */
	if (attribute == 0x6) {
		rfs_size = simple_strtoul(argv[4], NULL, 16);
		
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = rfs_size/MOVI_BLKSIZE +
			((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
		image[i].used_blk = blkcnt;
		
		printf("%s recovery-img.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		
		if (1 == fuse_by_fastboot)
			sprintf(run_cmd, "mmc %s %s 0x%lx 0x%lx 0x%lx",
					rw ? "write" : "read", dev_number_write ? "1" : "0",
					addr, start_blk, blkcnt);
		else
		{
			#if 0
			if (key1_pulldown == 1)
				sprintf(run_cmd,"mmc %s 1 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",
						addr, start_blk, blkcnt);
			else
			#endif
				sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
						rw ? "write":"read",boot_dev,
						addr, start_blk, blkcnt);
		}
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}

usage:
	printf("Usage:\n%s\n", cmdtp->usage);
	return -1;
}

U_BOOT_CMD(
		movi,	5,	0,	do_movi,
		"movi\t- sd/mmc r/w sub system for SMDK board\n",
		"init - Initialize moviNAND and show card info\n"
		"movi read  {u-boot | kernel} {addr} - Read data from sd/mmc\n"
		"movi write {fwbl1 | u-boot | kernel} {addr} - Write data to sd/mmc\n"
		"movi read  rootfs {addr} [bytes(hex)] - Read rootfs data from sd/mmc by size\n"
		"movi write rootfs {addr} [bytes(hex)] - Write rootfs data to sd/mmc by size\n"
		"movi read  {sector#} {bytes(hex)} {addr} - instead of this, you can use \"mmc read\"\n"
		"movi write {sector#} {bytes(hex)} {addr} - instead of this, you can use \"mmc write\"\n"
	  );
コード例 #2
0
int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
	char *cmd;
	ulong addr, start_blk, blkcnt;
	uint rfs_size;
	char run_cmd[100];
	uint rw = 0, attribute = -1;
	int i;
	member_t *image;
	struct mmc *mmc;
	int dev_num = 0;
	int location = 1;

	cmd = argv[1];
	
	switch (cmd[0]) {
	case 'i':
		if(argv[2]==NULL)
		{
			dev_num = 0;
		} else {
			dev_num = simple_strtoul(argv[2], NULL, 10);
		}

		sprintf(run_cmd,"mmcinfo %d", dev_num);
		run_command(run_cmd, dev_num);
		return 1;
	case 'r':
		rw = 0;	/* read case */
		break;
	case 'w':
		rw = 1; /* write case */
		break;
	default:
		goto usage;
	}

	cmd = argv[2];

	switch (cmd[0]) {
	case 'z':
		location = 0;
		break;
	default:
		location = 1;
		break;
	}

	dev_num = simple_strtoul(argv[4 - location], NULL, 10);
	cmd = argv[3 - location];

	switch (cmd[0]) {

#if defined(CONFIG_SECURE_BOOT) || defined(CONFIG_SECURE_BL1_ONLY)	
	case 'f':
		if (argc != (6 - location))
			goto usage;
		attribute = 0x0;
		break;
#endif
	case 'b':
		if (argc != (6 - location))
			goto usage;
		attribute = 0x3;
		break;
	case 'u':
		if (argc != (6 - location))
			goto usage;
		attribute = 0x2;
		break;
	case 'k':
		if (argc != 5)
			goto usage;
		attribute = 0x4;
		break;
	case 'r':
		if (argc != 6)
			goto usage;
		attribute = 0x8;
		break;
	case 't':
		if (argc != (6 - location))
			goto usage;
		attribute = 0x9;
		break;
	default:
		goto usage;
	}

	addr = simple_strtoul(argv[5 - location], NULL, 16);

	mmc = find_mmc_device(dev_num);

	init_raw_area_table(&mmc->block_dev, location);

	/* firmware BL1 r/w */
	if (attribute == 0x0) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}

		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s FWBL1 ..device %d Start %ld, Count %ld ", rw ? "writing":"reading",
			dev_num, start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write":"read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}
	/* Signed BL2 r/w */
	if (attribute == 0x3) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s BL2 ..device %d Start %ld, Count %ld ", rw ? "writing":"reading",
			dev_num, start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write":"read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}
	/* u-boot r/w */
	if (attribute == 0x2) {
#if !defined(CONFIG_TRUSTZONE)
#if !defined(CONFIG_SECURE_BOOT)
#if !defined(CONFIG_S5P6460_IP_TEST)
		/* on write case we should write BL1 1st. */
		if (rw) {
			start_blk = raw_area_control.image[1].start_blk;
			blkcnt = raw_area_control.image[1].used_blk;
			printf("Writing BL1 to device %d Start %ld (Count %ld sectors)..\n",
				dev_num, start_blk, blkcnt);
			movi_write_bl1(addr, dev_num);
		}
#endif
#endif
#endif
		
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s bootloader..device %d Start %ld, Count %ld ", rw ? "writing":"reading",
			dev_num, start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write":"read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}
	
	/* kernel r/w */
	if (attribute == 0x4) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s kernel..device %d Start %ld, Count %ld ", rw ? "writing" : "reading",
			dev_num, start_blk, blkcnt);
		sprintf(run_cmd, "mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write" : "read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}

	/* root file system r/w */
	if (attribute == 0x8) {
		rfs_size = simple_strtoul(argv[5], NULL, 16);

		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		if(!strcmp(argv[2],"rootfs4_2"))
		{
			start_blk = image[i].start_blk;
		}else{
			start_blk = image[i].start_blk+MOVI_ZIMAGE_BLKCNT;
		}
#ifdef DEBUG
		printf("%s\n",argv[2]);
		printf("%s\n",cmd);
		printf("%ld\n",start_blk);
		printf("%ld\n",image[i].start_blk);
#endif		
		blkcnt = rfs_size/MOVI_BLKSIZE +
			((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
		image[i].used_blk = blkcnt;
		printf("%s RFS..device %d Count %ld, Start %ld ", rw ? "writing":"reading",
			dev_num, start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write":"read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}

	/* TrustZone S/W */
	if (attribute == 0x9) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s %d TrustZone S/W.. Start %ld, Count %ld ", rw ? "writing" : "reading",
		       dev_num, start_blk, blkcnt);
		sprintf(run_cmd, "mmc %s %d 0x%lx 0x%lx 0x%lx",
			rw ? "write" : "read", dev_num,
			addr, start_blk, blkcnt);
		run_command(run_cmd, dev_num);
		printf("completed\n");
		return 1;
	}

	return 1;

usage:
	printf("Usage:\n%s\n", cmdtp->usage);
	return -1;
}
コード例 #3
0
ファイル: cmd_movi.c プロジェクト: minime/x210ii
int do_movi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
	char *cmd;
	ulong addr, start_blk, blkcnt;
	uint rfs_size;
	char run_cmd[100];
	uint rw = 0, attribute = 0;
	int i;
	member_t *image;
	struct mmc *mmc;
	int dev_num = 0;

#if defined(CONFIG_VOGUES)
	int boot_dev;
#endif
	cmd = argv[1];

	switch (cmd[0]) {
	case 'i':
		raw_area_control.magic_number = 0;
		run_command("mmcinfo", 0);
		return 1;
	case 'r':
		rw = 0;	/* read case */
		break;
	case 'w':
		rw = 1; /* write case */
		break;
	default:
		goto usage;
	}

	cmd = argv[2];
	switch (cmd[0]) {
	
	case 'f':
		if (argc != 4)
			goto usage;
		attribute = 0x0;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'u':
		if (argc != 4)
			goto usage;
		attribute = 0x2;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'k':
		if (argc != 4)
			goto usage;
		attribute = 0x4;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	case 'r':
		if (argc != 5)
			goto usage;
		attribute = 0x8;
		addr = simple_strtoul(argv[3], NULL, 16);
		break;
	default:
		goto usage;
	}

#if defined(CONFIG_VOGUES)
	boot_dev = movi_boot_src();
	if (boot_dev) {
		/* boot device is NOR */
		/* read kernel from eMMC */
		#if defined (FORCE_MMC1)
		mmc = find_mmc_device(1);
		#else
		mmc = find_mmc_device(0);
		#endif
		printf("MMC #0 is boot device\r\n");
	} else {
		/* boot device is SD card */
		/* read kernel from SD card */
		#if defined(FORCE_MMC1)
		mmc = find_mmc_device(1);
		#else
		mmc = find_mmc_device(1);
		#endif
		printf("MMC #1 is boot device\r\n");
	}
#else
	mmc = find_mmc_device(dev_num);
#endif

	mmc_init(mmc);

	/* firmware BL1 r/w */
	if (attribute == 0x0) {
		/* on write case we should write BL1 1st. */
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s FWBL1 .. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}

	/* u-boot r/w */
	if (attribute == 0x2) {
		/* on write case we should write BL2 1st. */
#if defined(CONFIG_FUSED) 
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == 0x1)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s BL1.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
#else
		if (rw) {
			start_blk = raw_area_control.image[1].start_blk;
			blkcnt = raw_area_control.image[1].used_blk;
			printf("Writing BL1 to sector %ld (%ld sectors).. ",
					start_blk, blkcnt);
			movi_write_bl1(addr);
		}
#endif
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s bootloader.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);

#if defined(CONFIG_SECURE_BOOT)
#define	BL2_SIZE 8192
		
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr + BL2_SIZE, start_blk, blkcnt);
#else
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
#endif
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}
	
	/* kernel r/w */
	if (attribute == 0x4) {
		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = image[i].used_blk;
		printf("%s kernel.. %ld, %ld ", rw ? "writing" : "reading",
		       start_blk, blkcnt);
	#if defined(CONFIG_VOGUES)
		if (boot_dev)
			sprintf(run_cmd, "mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write" : "read", addr, start_blk, blkcnt);
		else
			sprintf(run_cmd, "mmc %s 1 0x%lx 0x%lx 0x%lx",
				rw ? "write" : "read", addr, start_blk, blkcnt);
	#else
		sprintf(run_cmd, "mmc %s 0 0x%lx 0x%lx 0x%lx",
			rw ? "write" : "read", addr, start_blk, blkcnt);
	#endif
		run_command(run_cmd, 0);

		printf("completed\n");
		return 1;
	}

	/* root file system r/w */
	if (attribute == 0x8) {
		rfs_size = simple_strtoul(argv[4], NULL, 16);

		for (i=0, image = raw_area_control.image; i<15; i++) {
			if (image[i].attribute == attribute)
				break;
		}
		start_blk = image[i].start_blk;
		blkcnt = rfs_size/MOVI_BLKSIZE +
			((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
		image[i].used_blk = blkcnt;
		printf("%s RFS.. %ld, %ld ", rw ? "writing":"reading",
				start_blk, blkcnt);
		sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
				rw ? "write":"read",
				addr, start_blk, blkcnt);
		run_command(run_cmd, 0);
		printf("completed\n");
		return 1;
	}

	return 1;

usage:
	printf("Usage:\n%s\n", cmdtp->usage);
	return -1;
}