diff options
author | Chen Guoyin <guoyin.chen@nxp.com> | 2016-11-11 17:16:53 +0800 |
---|---|---|
committer | Chen Guoyin <guoyin.chen@nxp.com> | 2016-11-15 16:27:38 +0800 |
commit | b67bc30e34a9d1e438a49927c64e69dd2e0f5b3e (patch) | |
tree | 9560bd88088952f8e9d66f2d306051e3677fa41a | |
parent | bb019f1909fb10ed7153aa939942ccb6cc07c06b (diff) | |
download | uboot-imx-b67bc30e34a9d1e438a49927c64e69dd2e0f5b3e.tar.gz |
MA-9005 fastboot: Support sparse image flashing for oem partition
Make all partitions can be flashed by sparse image if it is
in raw format
Signed-off-by: Chen Guoyin <guoyin.chen@nxp.com>
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 46 | ||||
-rw-r--r-- | include/fsl_fastboot.h | 2 |
2 files changed, 33 insertions, 15 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index d9a13a6070..cdb9b3d564 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -858,22 +858,38 @@ static void process_flash_sata(const char *cmdbuf, char *response) #endif #if defined(CONFIG_FASTBOOT_STORAGE_MMC) -static int is_sparse_partition(struct fastboot_ptentry *ptn) +static int is_raw_partition(struct fastboot_ptentry *ptn) { #ifdef CONFIG_BRILLO_SUPPORT - if (ptn && (!strncmp(ptn->name, FASTBOOT_PARTITION_SYSTEM_A, - strlen(FASTBOOT_PARTITION_SYSTEM_A)) || - !strncmp(ptn->name, FASTBOOT_PARTITION_SYSTEM_B, - strlen(FASTBOOT_PARTITION_SYSTEM_B)) || - !strncmp(ptn->name, FASTBOOT_PARTITION_DATA, - strlen(FASTBOOT_PARTITION_DATA)))) { + if (ptn && (!strncmp(ptn->name, FASTBOOT_PARTITION_BOOTLOADER, + strlen(FASTBOOT_PARTITION_BOOTLOADER)) || + !strncmp(ptn->name, FASTBOOT_PARTITION_GPT, + strlen(FASTBOOT_PARTITION_GPT)) || + !strncmp(ptn->name, FASTBOOT_PARTITION_BOOT_A, + strlen(FASTBOOT_PARTITION_BOOT_A)) || + !strncmp(ptn->name, FASTBOOT_PARTITION_BOOT_B, + strlen(FASTBOOT_PARTITION_BOOT_B)) || +#ifdef CONFIG_FASTBOOT_LOCK + !strncmp(ptn->name, FASTBOOT_PARTITION_FBMISC, + strlen(FASTBOOT_PARTITION_FBMISC)) || +#endif + !strncmp(ptn->name, FASTBOOT_PARTITION_MISC, + strlen(FASTBOOT_PARTITION_MISC)))) { #else - if (ptn && (!strncmp(ptn->name, - FASTBOOT_PARTITION_SYSTEM, strlen(FASTBOOT_PARTITION_SYSTEM)) - || !strncmp(ptn->name, - FASTBOOT_PARTITION_DATA, strlen(FASTBOOT_PARTITION_DATA)))) { + if (ptn && (!strncmp(ptn->name, FASTBOOT_PARTITION_BOOTLOADER, + strlen(FASTBOOT_PARTITION_BOOTLOADER)) || + !strncmp(ptn->name, FASTBOOT_PARTITION_MBR, + strlen(FASTBOOT_PARTITION_MBR)) || + !strncmp(ptn->name, FASTBOOT_PARTITION_BOOT, + strlen(FASTBOOT_PARTITION_BOOT)) || +#ifdef CONFIG_FASTBOOT_LOCK + !strncmp(ptn->name, FASTBOOT_PARTITION_FBMISC, + strlen(FASTBOOT_PARTITION_FBMISC)) || +#endif + !strncmp(ptn->name, FASTBOOT_PARTITION_MISC, + strlen(FASTBOOT_PARTITION_MISC)))) { #endif - printf("support sparse flash partition for %s\n", ptn->name); + printf("raw partition for %s\n", ptn->name); return 1; } else return 0; @@ -943,7 +959,7 @@ static void process_flash_mmc(const char *cmdbuf, char *response) sprintf(mmc_dev, "mmc dev %x", fastboot_devinfo.dev_id /*slot no*/); - if (is_sparse_partition(ptn) && + if (!is_raw_partition(ptn) && is_sparse_image(interface.transfer_buffer)) { int mmc_no = 0; struct mmc *mmc; @@ -1293,12 +1309,12 @@ static int _fastboot_parts_load_from_ptable(void) #ifdef CONFIG_EFI_PARTITION /* GPT */ - strcpy(ptable[PTN_MBR_GPT_INDEX].name, "gpt"); + strcpy(ptable[PTN_MBR_GPT_INDEX].name, FASTBOOT_PARTITION_GPT); ptable[PTN_MBR_GPT_INDEX].start = ANDROID_GPT_OFFSET / dev_desc->blksz; ptable[PTN_MBR_GPT_INDEX].length = ANDROID_GPT_SIZE / dev_desc->blksz; #else /* MBR */ - strcpy(ptable[PTN_MBR_GPT_INDEX].name, "mbr"); + strcpy(ptable[PTN_MBR_GPT_INDEX].name, FASTBOOT_PARTITION_MBR); ptable[PTN_MBR_GPT_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz; ptable[PTN_MBR_GPT_INDEX].length = ANDROID_MBR_SIZE / dev_desc->blksz; #endif diff --git a/include/fsl_fastboot.h b/include/fsl_fastboot.h index 1b3ed86e56..7dce98aa3b 100644 --- a/include/fsl_fastboot.h +++ b/include/fsl_fastboot.h @@ -42,6 +42,8 @@ #define FASTBOOT_PARTITION_BOOTLOADER "bootloader" #define FASTBOOT_PARTITION_MISC "misc" +#define FASTBOOT_PARTITION_MBR "mbr" +#define FASTBOOT_PARTITION_GPT "gpt" #ifdef CONFIG_BRILLO_SUPPORT #define FASTBOOT_PARTITION_BOOT_A "boot_a" |