All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
@ 2014-09-22 21:29 Steve Rae
  2014-09-23 12:21 ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Rae @ 2014-09-22 21:29 UTC (permalink / raw
  To: u-boot

Implement a feature to allow fastboot to write the downloaded image
to the space reserved for the Protective MBR and the Primary GUID
Partition Table.

Signed-off-by: Steve Rae <srae@broadcom.com>
---
This series depends on:
  http://patchwork.ozlabs.org/patch/383184/ (to 388186)

 README          |  7 +++++++
 common/fb_mmc.c | 19 ++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/README b/README
index e8341b7..2e4e0c4 100644
--- a/README
+++ b/README
@@ -1639,6 +1639,13 @@ The following options need to be configured:
 		regarding the non-volatile storage device. Define this to
 		the eMMC device that fastboot should use to store the image.
 
+		CONFIG_FASTBOOT_GPT_NAME
+		The fastboot "flash" command supports writing the downloaded
+		image to the Protective MBR and the Primary GUID Partition
+		Table. This occurs when the specified "partition name" on the
+		"fastboot flash" command line matches this value.
+		Default is GPT_ENTRY_NAME (currently "gpt") if undefined.
+
 - Journaling Flash filesystem support:
 		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
 		CONFIG_JFFS2_NAND_DEV
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index fb06d8a..89fbf23 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -4,12 +4,17 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <config.h>
 #include <common.h>
 #include <fb_mmc.h>
 #include <part.h>
 #include <aboot.h>
 #include <sparse_format.h>
 
+#ifndef CONFIG_FASTBOOT_GPT_NAME
+#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
+#endif
+
 /* The 64 defined bytes plus the '\0' */
 #define RESPONSE_LEN	(64 + 1)
 
@@ -62,9 +67,9 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 			unsigned int download_bytes, char *response)
 {
-	int ret;
 	block_dev_desc_t *dev_desc;
 	disk_partition_t info;
+	lbaint_t blksz;
 
 	/* initialize the response buffer */
 	response_str = response;
@@ -76,8 +81,16 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 		return;
 	}
 
-	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
-	if (ret) {
+	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
+		printf("%s: updating GUID Partition Table (including MBR)\n",
+		       __func__);
+		/* start at Protective MBR */
+		info.start = (GPT_PRIMARY_PARTITION_TABLE_LBA - 1);
+		blksz = dev_desc->blksz;
+		info.blksz = blksz;
+		/* assume that the Partition Entry Array starts in LBA 2 */
+		info.size = (2 + (GPT_ENTRY_NUMBERS * GPT_ENTRY_SIZE) / blksz);
+	} else if (get_partition_info_efi_by_name(dev_desc, cmd, &info)) {
 		error("cannot find partition: '%s'\n", cmd);
 		fastboot_fail("cannot find partition");
 		return;
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-09-22 21:29 Steve Rae
@ 2014-09-23 12:21 ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2014-09-23 12:21 UTC (permalink / raw
  To: u-boot

On Monday, September 22, 2014 at 11:29:10 PM, Steve Rae wrote:
> Implement a feature to allow fastboot to write the downloaded image
> to the space reserved for the Protective MBR and the Primary GUID
> Partition Table.
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>

Please CC Lukasz ...

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
@ 2014-12-04 22:36 Steve Rae
  2014-12-06 13:00 ` Marek Vasut
  2014-12-08 11:21 ` Lukasz Majewski
  0 siblings, 2 replies; 8+ messages in thread
From: Steve Rae @ 2014-12-04 22:36 UTC (permalink / raw
  To: u-boot

Implement a feature to allow fastboot to write the downloaded image
to the space reserved for the Protective MBR and the Primary GUID
Partition Table.

Signed-off-by: Steve Rae <srae@broadcom.com>
---

 README          |  7 +++++++
 common/fb_mmc.c | 19 ++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 66770b6..3b6ef7f 100644
--- a/README
+++ b/README
@@ -1769,6 +1769,13 @@ The following options need to be configured:
 		regarding the non-volatile storage device. Define this to
 		the eMMC device that fastboot should use to store the image.
 
+		CONFIG_FASTBOOT_GPT_NAME
+		The fastboot "flash" command supports writing the downloaded
+		image to the Protective MBR and the Primary GUID Partition
+		Table. This occurs when the specified "partition name" on the
+		"fastboot flash" command line matches this value.
+		Default is GPT_ENTRY_NAME (currently "gpt") if undefined.
+
 - Journaling Flash filesystem support:
 		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
 		CONFIG_JFFS2_NAND_DEV
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index fb06d8a..89fbf23 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -4,12 +4,17 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <config.h>
 #include <common.h>
 #include <fb_mmc.h>
 #include <part.h>
 #include <aboot.h>
 #include <sparse_format.h>
 
+#ifndef CONFIG_FASTBOOT_GPT_NAME
+#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
+#endif
+
 /* The 64 defined bytes plus the '\0' */
 #define RESPONSE_LEN	(64 + 1)
 
@@ -62,9 +67,9 @@ static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 			unsigned int download_bytes, char *response)
 {
-	int ret;
 	block_dev_desc_t *dev_desc;
 	disk_partition_t info;
+	lbaint_t blksz;
 
 	/* initialize the response buffer */
 	response_str = response;
@@ -76,8 +81,16 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
 		return;
 	}
 
-	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
-	if (ret) {
+	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
+		printf("%s: updating GUID Partition Table (including MBR)\n",
+		       __func__);
+		/* start at Protective MBR */
+		info.start = (GPT_PRIMARY_PARTITION_TABLE_LBA - 1);
+		blksz = dev_desc->blksz;
+		info.blksz = blksz;
+		/* assume that the Partition Entry Array starts in LBA 2 */
+		info.size = (2 + (GPT_ENTRY_NUMBERS * GPT_ENTRY_SIZE) / blksz);
+	} else if (get_partition_info_efi_by_name(dev_desc, cmd, &info)) {
 		error("cannot find partition: '%s'\n", cmd);
 		fastboot_fail("cannot find partition");
 		return;
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-12-04 22:36 [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition Steve Rae
@ 2014-12-06 13:00 ` Marek Vasut
  2014-12-08 11:24   ` Lukasz Majewski
  2014-12-08 11:21 ` Lukasz Majewski
  1 sibling, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2014-12-06 13:00 UTC (permalink / raw
  To: u-boot

On Thursday, December 04, 2014 at 11:36:33 PM, Steve Rae wrote:
> Implement a feature to allow fastboot to write the downloaded image
> to the space reserved for the Protective MBR and the Primary GUID
> Partition Table.
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>

Lukasz, what do you think please ?

In my option, there's nothing really explicitly problematic:

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-12-04 22:36 [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition Steve Rae
  2014-12-06 13:00 ` Marek Vasut
@ 2014-12-08 11:21 ` Lukasz Majewski
  2014-12-08 18:21   ` Steve Rae
  1 sibling, 1 reply; 8+ messages in thread
From: Lukasz Majewski @ 2014-12-08 11:21 UTC (permalink / raw
  To: u-boot

Hi Steve,

> Implement a feature to allow fastboot to write the downloaded image
> to the space reserved for the Protective MBR and the Primary GUID
> Partition Table.
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
>  README          |  7 +++++++
>  common/fb_mmc.c | 19 ++++++++++++++++---
>  2 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/README b/README
> index 66770b6..3b6ef7f 100644
> --- a/README
> +++ b/README
> @@ -1769,6 +1769,13 @@ The following options need to be configured:
>  		regarding the non-volatile storage device. Define
> this to the eMMC device that fastboot should use to store the image.
>  
> +		CONFIG_FASTBOOT_GPT_NAME
> +		The fastboot "flash" command supports writing the
> downloaded
> +		image to the Protective MBR and the Primary GUID
> Partition
> +		Table. This occurs when the specified "partition
> name" on the
> +		"fastboot flash" command line matches this value.
> +		Default is GPT_ENTRY_NAME (currently "gpt") if
> undefined. +
>  - Journaling Flash filesystem support:
>  		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF,
> CONFIG_JFFS2_NAND_SIZE, CONFIG_JFFS2_NAND_DEV
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index fb06d8a..89fbf23 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -4,12 +4,17 @@
>   * SPDX-License-Identifier:	GPL-2.0+
>   */
>  
> +#include <config.h>
>  #include <common.h>
>  #include <fb_mmc.h>
>  #include <part.h>
>  #include <aboot.h>
>  #include <sparse_format.h>
>  
> +#ifndef CONFIG_FASTBOOT_GPT_NAME
> +#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
> +#endif
> +
>  /* The 64 defined bytes plus the '\0' */
>  #define RESPONSE_LEN	(64 + 1)
>  
> @@ -62,9 +67,9 @@ static void write_raw_image(block_dev_desc_t
> *dev_desc, disk_partition_t *info, void fb_mmc_flash_write(const char
> *cmd, void *download_buffer, unsigned int download_bytes, char
> *response) {
> -	int ret;
>  	block_dev_desc_t *dev_desc;
>  	disk_partition_t info;
> +	lbaint_t blksz;
>  
>  	/* initialize the response buffer */
>  	response_str = response;
> @@ -76,8 +81,16 @@ void fb_mmc_flash_write(const char *cmd, void
> *download_buffer, return;
>  	}
>  
> -	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
> -	if (ret) {
> +	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
> +		printf("%s: updating GUID Partition Table (including
> MBR)\n",
> +		       __func__);
> +		/* start at Protective MBR */
> +		info.start = (GPT_PRIMARY_PARTITION_TABLE_LBA - 1);
> +		blksz = dev_desc->blksz;
> +		info.blksz = blksz;
> +		/* assume that the Partition Entry Array starts in
> LBA 2 */
> +		info.size = (2 + (GPT_ENTRY_NUMBERS *
> GPT_ENTRY_SIZE) / blksz);
> +	} else if (get_partition_info_efi_by_name(dev_desc, cmd,
> &info)) { error("cannot find partition: '%s'\n", cmd);
>  		fastboot_fail("cannot find partition");
>  		return;

Sorry for a late reply. I've just come back from a short holidays.

I'm curious if you have encountered any problems with GPT replaced in
that way?

It seems strange to me that you only change primary GPT partition
without taking care of the secondary (backup) one.

From my experience when you export your eMMC to Host PC via UMS, host's
PC tools will complain about mismatch in the GPT tables.

Moreover, I would suggest transactional update of GPT by checking GPT
image CRC before writing. In this way you can always perform recovery if
needed.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-12-06 13:00 ` Marek Vasut
@ 2014-12-08 11:24   ` Lukasz Majewski
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2014-12-08 11:24 UTC (permalink / raw
  To: u-boot

Hi Marek,

> On Thursday, December 04, 2014 at 11:36:33 PM, Steve Rae wrote:
> > Implement a feature to allow fastboot to write the downloaded image
> > to the space reserved for the Protective MBR and the Primary GUID
> > Partition Table.
> > 
> > Signed-off-by: Steve Rae <srae@broadcom.com>
> 
> Lukasz, what do you think please ?

I've just commented to this e-mail.

> 
> In my option, there's nothing really explicitly problematic:
> 
> Reviewed-by: Marek Vasut <marex@denx.de>
> 
> Best regards,
> Marek Vasut

BTW: Marek, do you plan to send USB PR to Tom in a near future?

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-12-08 11:21 ` Lukasz Majewski
@ 2014-12-08 18:21   ` Steve Rae
  2014-12-09  8:22     ` Lukasz Majewski
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Rae @ 2014-12-08 18:21 UTC (permalink / raw
  To: u-boot

Hi Lukasz,

On 14-12-08 03:21 AM, Lukasz Majewski wrote:
> Hi Steve,
>
>> Implement a feature to allow fastboot to write the downloaded image
>> to the space reserved for the Protective MBR and the Primary GUID
>> Partition Table.
>>
>> Signed-off-by: Steve Rae <srae@broadcom.com>
>> ---
>>
>>   README          |  7 +++++++
>>   common/fb_mmc.c | 19 ++++++++++++++++---
>>   2 files changed, 23 insertions(+), 3 deletions(-)
>>
>> diff --git a/README b/README
>> index 66770b6..3b6ef7f 100644
>> --- a/README
>> +++ b/README
>> @@ -1769,6 +1769,13 @@ The following options need to be configured:
>>   		regarding the non-volatile storage device. Define
>> this to the eMMC device that fastboot should use to store the image.
>>
>> +		CONFIG_FASTBOOT_GPT_NAME
>> +		The fastboot "flash" command supports writing the
>> downloaded
>> +		image to the Protective MBR and the Primary GUID
>> Partition
>> +		Table. This occurs when the specified "partition
>> name" on the
>> +		"fastboot flash" command line matches this value.
>> +		Default is GPT_ENTRY_NAME (currently "gpt") if
>> undefined. +
>>   - Journaling Flash filesystem support:
>>   		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF,
>> CONFIG_JFFS2_NAND_SIZE, CONFIG_JFFS2_NAND_DEV
>> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
>> index fb06d8a..89fbf23 100644
>> --- a/common/fb_mmc.c
>> +++ b/common/fb_mmc.c
>> @@ -4,12 +4,17 @@
>>    * SPDX-License-Identifier:	GPL-2.0+
>>    */
>>
>> +#include <config.h>
>>   #include <common.h>
>>   #include <fb_mmc.h>
>>   #include <part.h>
>>   #include <aboot.h>
>>   #include <sparse_format.h>
>>
>> +#ifndef CONFIG_FASTBOOT_GPT_NAME
>> +#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
>> +#endif
>> +
>>   /* The 64 defined bytes plus the '\0' */
>>   #define RESPONSE_LEN	(64 + 1)
>>
>> @@ -62,9 +67,9 @@ static void write_raw_image(block_dev_desc_t
>> *dev_desc, disk_partition_t *info, void fb_mmc_flash_write(const char
>> *cmd, void *download_buffer, unsigned int download_bytes, char
>> *response) {
>> -	int ret;
>>   	block_dev_desc_t *dev_desc;
>>   	disk_partition_t info;
>> +	lbaint_t blksz;
>>
>>   	/* initialize the response buffer */
>>   	response_str = response;
>> @@ -76,8 +81,16 @@ void fb_mmc_flash_write(const char *cmd, void
>> *download_buffer, return;
>>   	}
>>
>> -	ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
>> -	if (ret) {
>> +	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
>> +		printf("%s: updating GUID Partition Table (including
>> MBR)\n",
>> +		       __func__);
>> +		/* start at Protective MBR */
>> +		info.start = (GPT_PRIMARY_PARTITION_TABLE_LBA - 1);
>> +		blksz = dev_desc->blksz;
>> +		info.blksz = blksz;
>> +		/* assume that the Partition Entry Array starts in
>> LBA 2 */
>> +		info.size = (2 + (GPT_ENTRY_NUMBERS *
>> GPT_ENTRY_SIZE) / blksz);
>> +	} else if (get_partition_info_efi_by_name(dev_desc, cmd,
>> &info)) { error("cannot find partition: '%s'\n", cmd);
>>   		fastboot_fail("cannot find partition");
>>   		return;
>
> Sorry for a late reply. I've just come back from a short holidays.
>
> I'm curious if you have encountered any problems with GPT replaced in
> that way?

No -- this "technique" seems to be fine (for the Primary GPT)....

>
> It seems strange to me that you only change primary GPT partition
> without taking care of the secondary (backup) one.

It seems that the device operates correctly with or without the Backup 
GPT, and it doesn't seem to matter if they are the same or not.
Thus, we have gone back and forth on this one - should we automatically 
update the Backup GPT whenever the Primary GPT is updated, or should 
there be a second step (possibly a "fastboot oem" command) to update the 
Backup GPT... (currently, we are proposing the latter)
What would you suggest?

>
>  From my experience when you export your eMMC to Host PC via UMS, host's
> PC tools will complain about mismatch in the GPT tables.

( I have never done this - what tools are you using? Could you provide 
instructions for me to try? Thanks! )

>
> Moreover, I would suggest transactional update of GPT by checking GPT
> image CRC before writing. In this way you can always perform recovery if
> needed.

This is a good idea - I'll look into it - Thanks!
>

Thanks, Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition
  2014-12-08 18:21   ` Steve Rae
@ 2014-12-09  8:22     ` Lukasz Majewski
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2014-12-09  8:22 UTC (permalink / raw
  To: u-boot

Hi Steve,

> Hi Lukasz,
> 
> On 14-12-08 03:21 AM, Lukasz Majewski wrote:
> > Hi Steve,
> >
> >> Implement a feature to allow fastboot to write the downloaded image
> >> to the space reserved for the Protective MBR and the Primary GUID
> >> Partition Table.
> >>
> >> Signed-off-by: Steve Rae <srae@broadcom.com>
> >> ---
> >>
> >>   README          |  7 +++++++
> >>   common/fb_mmc.c | 19 ++++++++++++++++---
> >>   2 files changed, 23 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/README b/README
> >> index 66770b6..3b6ef7f 100644
> >> --- a/README
> >> +++ b/README
> >> @@ -1769,6 +1769,13 @@ The following options need to be configured:
> >>   		regarding the non-volatile storage device. Define
> >> this to the eMMC device that fastboot should use to store the
> >> image.
> >>
> >> +		CONFIG_FASTBOOT_GPT_NAME
> >> +		The fastboot "flash" command supports writing the
> >> downloaded
> >> +		image to the Protective MBR and the Primary GUID
> >> Partition
> >> +		Table. This occurs when the specified "partition
> >> name" on the
> >> +		"fastboot flash" command line matches this value.
> >> +		Default is GPT_ENTRY_NAME (currently "gpt") if
> >> undefined. +
> >>   - Journaling Flash filesystem support:
> >>   		CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF,
> >> CONFIG_JFFS2_NAND_SIZE, CONFIG_JFFS2_NAND_DEV
> >> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> >> index fb06d8a..89fbf23 100644
> >> --- a/common/fb_mmc.c
> >> +++ b/common/fb_mmc.c
> >> @@ -4,12 +4,17 @@
> >>    * SPDX-License-Identifier:	GPL-2.0+
> >>    */
> >>
> >> +#include <config.h>
> >>   #include <common.h>
> >>   #include <fb_mmc.h>
> >>   #include <part.h>
> >>   #include <aboot.h>
> >>   #include <sparse_format.h>
> >>
> >> +#ifndef CONFIG_FASTBOOT_GPT_NAME
> >> +#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
> >> +#endif
> >> +
> >>   /* The 64 defined bytes plus the '\0' */
> >>   #define RESPONSE_LEN	(64 + 1)
> >>
> >> @@ -62,9 +67,9 @@ static void write_raw_image(block_dev_desc_t
> >> *dev_desc, disk_partition_t *info, void fb_mmc_flash_write(const
> >> char *cmd, void *download_buffer, unsigned int download_bytes, char
> >> *response) {
> >> -	int ret;
> >>   	block_dev_desc_t *dev_desc;
> >>   	disk_partition_t info;
> >> +	lbaint_t blksz;
> >>
> >>   	/* initialize the response buffer */
> >>   	response_str = response;
> >> @@ -76,8 +81,16 @@ void fb_mmc_flash_write(const char *cmd, void
> >> *download_buffer, return;
> >>   	}
> >>
> >> -	ret = get_partition_info_efi_by_name(dev_desc, cmd,
> >> &info);
> >> -	if (ret) {
> >> +	if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
> >> +		printf("%s: updating GUID Partition Table
> >> (including MBR)\n",
> >> +		       __func__);
> >> +		/* start at Protective MBR */
> >> +		info.start = (GPT_PRIMARY_PARTITION_TABLE_LBA -
> >> 1);
> >> +		blksz = dev_desc->blksz;
> >> +		info.blksz = blksz;
> >> +		/* assume that the Partition Entry Array starts in
> >> LBA 2 */
> >> +		info.size = (2 + (GPT_ENTRY_NUMBERS *
> >> GPT_ENTRY_SIZE) / blksz);
> >> +	} else if (get_partition_info_efi_by_name(dev_desc, cmd,
> >> &info)) { error("cannot find partition: '%s'\n", cmd);
> >>   		fastboot_fail("cannot find partition");
> >>   		return;
> >
> > Sorry for a late reply. I've just come back from a short holidays.
> >
> > I'm curious if you have encountered any problems with GPT replaced
> > in that way?
> 
> No -- this "technique" seems to be fine (for the Primary GPT)....
> 
> >
> > It seems strange to me that you only change primary GPT partition
> > without taking care of the secondary (backup) one.
> 
> It seems that the device operates correctly with or without the
> Backup GPT, and it doesn't seem to matter if they are the same or not.
> Thus, we have gone back and forth on this one - should we
> automatically update the Backup GPT whenever the Primary GPT is
> updated, or should there be a second step (possibly a "fastboot oem"
> command) to update the Backup GPT... (currently, we are proposing the
> latter) What would you suggest?

I'd suggest updating both of them. 

However, it is important to check all available CRC's in the received
image.

In my opinion a separate command for Secondary GPT - "fastboot oem" -
seems like an overkill.

> 
> >
> >  From my experience when you export your eMMC to Host PC via UMS,
> > host's PC tools will complain about mismatch in the GPT tables.
> 
> ( I have never done this - what tools are you using? Could you
> provide instructions for me to try? Thanks! )

For Exynos based boards (e.g. Odroid-U3, Trats2) it is possible to use
USB mass storage gadget (ums command in u-boot prompt), which exports
the content of eMMC to host PC and is treated as an ordinary USB stick.

Also you can try "parted" linux utility.

> 
> >
> > Moreover, I would suggest transactional update of GPT by checking
> > GPT image CRC before writing. In this way you can always perform
> > recovery if needed.
> 
> This is a good idea - I'll look into it - Thanks!
> >
> 
> Thanks, Steve



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-09  8:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 22:36 [U-Boot] [PATCH v1] fastboot: handle flash write to GPT partition Steve Rae
2014-12-06 13:00 ` Marek Vasut
2014-12-08 11:24   ` Lukasz Majewski
2014-12-08 11:21 ` Lukasz Majewski
2014-12-08 18:21   ` Steve Rae
2014-12-09  8:22     ` Lukasz Majewski
  -- strict thread matches above, loose matches on Subject: below --
2014-09-22 21:29 Steve Rae
2014-09-23 12:21 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.