From: Steve Rae <srae@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] disk: part_efi: add support for the Alternate GPT
Date: Mon, 5 May 2014 09:12:48 -0700 [thread overview]
Message-ID: <5367B880.5010906@broadcom.com> (raw)
In-Reply-To: <53676CF6.40704@samsung.com>
On 14-05-05 03:50 AM, Przemyslaw Marczak wrote:
> Hello Steve,
>
> On 04/30/2014 12:31 AM, Steve Rae wrote:
>> Check the Alternate GPT table if the Primary GPT table is invalid.
>>
>> Signed-off-by: Steve Rae <srae@broadcom.com>
>> ---
>>
>> disk/part_efi.c | 20 ++++++++++++++++++--
>> 1 file changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/disk/part_efi.c b/disk/part_efi.c
>> index 216a292..ad899fa 100644
>> --- a/disk/part_efi.c
>> +++ b/disk/part_efi.c
>> @@ -93,7 +93,15 @@ void print_part_efi(block_dev_desc_t * dev_desc)
>> if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
>> gpt_head, &gpt_pte) != 1) {
>> printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
>> - return;
>> + if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
>> + gpt_head, &gpt_pte) != 1) {
>> + printf("%s: *** ERROR: Invalid Alternate GPT ***\n",
>> + __func__);
>> + return;
>> + } else {
>> + printf("%s: *** Using Alternate GPT ***\n",
>> + __func__);
>> + }
>> }
>>
>> debug("%s: gpt-entry at %p\n", __func__, gpt_pte);
>> @@ -142,7 +150,15 @@ int get_partition_info_efi(block_dev_desc_t *
>> dev_desc, int part,
>> if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
>> gpt_head, &gpt_pte) != 1) {
>> printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
>> - return -1;
>> + if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
>> + gpt_head, &gpt_pte) != 1) {
>> + printf("%s: *** ERROR: Invalid Alternate GPT ***\n",
>> + __func__);
>> + return -1;
>> + } else {
>> + printf("%s: *** Using Alternate GPT ***\n",
>> + __func__);
>> + }
>> }
>>
>> if (part > le32_to_cpu(gpt_head->num_partition_entries) ||
>>
>
> This looks ok, we can still use u-boot filesystem commands after gpt
> header block corruption, but the gpt is still...corrupted.
>
> Maybe we need additional gpt subcommand for restore gpt in case when
> backup of gpt header is valid?
>
> Actually we have only "gpt write" command but it needs proper
> environment variables. So I think that "gpt restore" is welcome.
>
> Thank you,
Agree -- maybe I can find time to work on a "gpt restore" in the near
future....
Thanks, Steve
next prev parent reply other threads:[~2014-05-05 16:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 22:31 [U-Boot] [PATCH] disk: part_efi: add support for the Alternate GPT Steve Rae
2014-05-05 10:50 ` Przemyslaw Marczak
2014-05-05 16:12 ` Steve Rae [this message]
2014-05-05 18:26 ` Steve Rae
2014-05-05 18:43 ` Tom Rini
2014-05-05 19:22 ` Steve Rae
2014-05-05 19:41 ` Tom Rini
2014-05-05 19:54 ` Steve Rae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5367B880.5010906@broadcom.com \
--to=srae@broadcom.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox