From b026e66a5bb6c2b6fda9e353dfe9061306c69da4 Mon Sep 17 00:00:00 2001 From: Zhang Sanshan Date: Mon, 6 Jul 2015 10:26:01 +0800 Subject: MA-6860-1 refine fastboot in uboot Enable fastboot command "fastboot flash data" Custom may need to update data partition in fastboot mode. This patch enable flash data partition in emmc\sd. Signed-off-by: Zhang Sanshan --- common/cmd_fastboot.c | 6 ++++-- drivers/fastboot/fastboot.c | 13 +++++++++---- include/configs/mx6sabreandroid_common.h | 3 ++- include/configs/mx6slevkandroid.h | 3 ++- include/configs/mx6sxsabreautoandroid.h | 3 ++- include/configs/mx6sxsabresdandroid.h | 3 ++- include/configs/mx7dsabresdandroid.h | 1 + include/fastboot.h | 1 + 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index 4f5c3c7..4315134 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -723,8 +723,10 @@ static void process_flash_sata(const char *cmdbuf, char *response) #if defined(CONFIG_FASTBOOT_STORAGE_MMC) static int is_sparse_partition(struct fastboot_ptentry *ptn) { - if (ptn && !strncmp(ptn->name, - FASTBOOT_PARTITION_SYSTEM, strlen(FASTBOOT_PARTITION_SYSTEM))) { + if (ptn && (!strncmp(ptn->name, + FASTBOOT_PARTITION_SYSTEM, strlen(FASTBOOT_PARTITION_SYSTEM)) + || !strncmp(ptn->name, + FASTBOOT_PARTITION_DATA, strlen(FASTBOOT_PARTITION_DATA)))) { printf("support sparse flash partition for %s\n", ptn->name); return 1; } else diff --git a/drivers/fastboot/fastboot.c b/drivers/fastboot/fastboot.c index 8fce951..d76fb70 100644 --- a/drivers/fastboot/fastboot.c +++ b/drivers/fastboot/fastboot.c @@ -65,7 +65,8 @@ enum { PTN_KERNEL_INDEX, PTN_URAMDISK_INDEX, PTN_SYSTEM_INDEX, - PTN_RECOVERY_INDEX + PTN_RECOVERY_INDEX, + PTN_DATA_INDEX }; struct fastboot_device_info fastboot_devinfo; @@ -823,7 +824,7 @@ static int _fastboot_parts_load_from_ptable(void) struct mmc *mmc; block_dev_desc_t *dev_desc; - struct fastboot_ptentry ptable[PTN_RECOVERY_INDEX + 1]; + struct fastboot_ptentry ptable[PTN_DATA_INDEX + 1]; /* sata case in env */ if (fastboot_devinfo.type == DEV_SATA) { @@ -870,7 +871,7 @@ static int _fastboot_parts_load_from_ptable(void) } memset((char *)ptable, 0, - sizeof(struct fastboot_ptentry) * (PTN_RECOVERY_INDEX + 1)); + sizeof(struct fastboot_ptentry) * (PTN_DATA_INDEX + 1)); /* MBR */ strcpy(ptable[PTN_MBR_INDEX].name, "mbr"); ptable[PTN_MBR_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz; @@ -895,8 +896,12 @@ static int _fastboot_parts_load_from_ptable(void) CONFIG_ANDROID_SYSTEM_PARTITION_MMC, user_partition, FASTBOOT_PARTITION_SYSTEM, dev_desc, ptable); + _fastboot_parts_add_ptable_entry(PTN_DATA_INDEX, + CONFIG_ANDROID_DATA_PARTITION_MMC, + user_partition, + FASTBOOT_PARTITION_DATA, dev_desc, ptable); - for (i = 0; i <= PTN_RECOVERY_INDEX; i++) + for (i = 0; i <= PTN_DATA_INDEX; i++) fastboot_flash_add_ptn(&ptable[i]); return 0; diff --git a/include/configs/mx6sabreandroid_common.h b/include/configs/mx6sabreandroid_common.h index dec4148..6e781d3 100644 --- a/include/configs/mx6sabreandroid_common.h +++ b/include/configs/mx6sabreandroid_common.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2013-2015 Freescale Semiconductor, Inc. All Rights Reserved. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -46,6 +46,7 @@ #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 +#define CONFIG_ANDROID_DATA_PARTITION_MMC 4 #undef CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_BOOTCOMMAND diff --git a/include/configs/mx6slevkandroid.h b/include/configs/mx6slevkandroid.h index e5e7be7..d467ed3 100644 --- a/include/configs/mx6slevkandroid.h +++ b/include/configs/mx6slevkandroid.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2013-2015 Freescale Semiconductor, Inc. All Rights Reserved. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -49,6 +49,7 @@ #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 +#define CONFIG_ANDROID_DATA_PARTITION_MMC 4 /*keyboard mapping*/ #define CONFIG_VOL_DOWN_KEY KEY_BACK diff --git a/include/configs/mx6sxsabreautoandroid.h b/include/configs/mx6sxsabreautoandroid.h index 6501592..7b98a0d 100644 --- a/include/configs/mx6sxsabreautoandroid.h +++ b/include/configs/mx6sxsabreautoandroid.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -45,6 +45,7 @@ #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 +#define CONFIG_ANDROID_DATA_PARTITION_MMC 4 #undef CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_BOOTCOMMAND diff --git a/include/configs/mx6sxsabresdandroid.h b/include/configs/mx6sxsabresdandroid.h index 83a2a38..96685be 100644 --- a/include/configs/mx6sxsabresdandroid.h +++ b/include/configs/mx6sxsabresdandroid.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -41,6 +41,7 @@ #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 +#define CONFIG_ANDROID_DATA_PARTITION_MMC 4 #undef CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_BOOTCOMMAND diff --git a/include/configs/mx7dsabresdandroid.h b/include/configs/mx7dsabresdandroid.h index d523a07..2f426d7 100644 --- a/include/configs/mx7dsabresdandroid.h +++ b/include/configs/mx7dsabresdandroid.h @@ -43,6 +43,7 @@ #define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5 #define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2 #define CONFIG_ANDROID_CACHE_PARTITION_MMC 6 +#define CONFIG_ANDROID_DATA_PARTITION_MMC 4 #undef CONFIG_EXTRA_ENV_SETTINGS #undef CONFIG_BOOTCOMMAND diff --git a/include/fastboot.h b/include/fastboot.h index 59250e1..abdbb6d 100644 --- a/include/fastboot.h +++ b/include/fastboot.h @@ -138,6 +138,7 @@ #define FASTBOOT_PARTITION_RECOVERY "recovery" #define FASTBOOT_PARTITION_SYSTEM "system" #define FASTBOOT_PARTITION_BOOTLOADER "bootloader" +#define FASTBOOT_PARTITION_DATA "data" enum { DEV_SATA, -- cgit v1.1