Commit 21d54b09 authored by Luo Ji's avatar Luo Ji
Browse files

MA-11705 [Android] Correct the parameters for 'sf' command



Pass the parameters of 'sf' command in bytes instead of in
block size.

Change-Id: I7fa5bad97a0b61b35c7ba46770d3b56df3f6a41e
Signed-off-by: default avatarLuo Ji <ji.luo@nxp.com>
parent 8c4e5a1e
......@@ -570,15 +570,19 @@ static int saveenv_to_ptn(struct fastboot_ptentry *ptn, char *err_string)
return ret;
}
static int get_block_size(void);
#ifdef CONFIG_FLASH_MCUFIRMWARE_SUPPORT
static void process_flash_sf(const char *cmdbuf)
{
int blksz = 0;
blksz = get_block_size();
if (download_bytes) {
struct fastboot_ptentry *ptn;
ptn = fastboot_flash_find_ptn(cmdbuf);
if (ptn == 0) {
fastboot_fail("partition does not exist");
} else if ((download_bytes > ptn->length)) {
} else if ((download_bytes > ptn->length * blksz)) {
fastboot_fail("image too large for partition");
/* TODO : Improve check for yaffs write */
} else {
......@@ -593,8 +597,8 @@ static void process_flash_sf(const char *cmdbuf)
return;
}
/* Erase */
sprintf(sf_command, "sf erase 0x%x 0x%x",ptn->start, /*start*/
ptn->length /*size*/);
sprintf(sf_command, "sf erase 0x%x 0x%x", ptn->start * blksz, /*start*/
ptn->length * blksz /*size*/);
ret = run_command(sf_command, 0);
if (ret) {
fastboot_fail("Erasing sf failed");
......@@ -603,7 +607,7 @@ static void process_flash_sf(const char *cmdbuf)
/* Write image */
sprintf(sf_command, "sf write 0x%x 0x%x 0x%x",
(unsigned int)(ulong)interface.transfer_buffer, /* source */
ptn->start, /* start */
ptn->start * blksz, /* start */
download_bytes /*size*/);
printf("sf write '%s'\n", ptn->name);
ret = run_command(sf_command, 0);
......
......@@ -35,7 +35,7 @@
#ifdef CONFIG_FLASH_MCUFIRMWARE_SUPPORT
#define ANDROID_MCU_FRIMWARE_DEV_TYPE DEV_SF
#define ANDROID_MCU_FIRMWARE_START 0
#define ANDROID_MCU_FIRMWARE_SIZE 0x4000000
#define ANDROID_MCU_FIRMWARE_SIZE 0x20000
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment