public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot]  GPT overlap on i.MX6
@ 2019-11-27  8:17 Jagan Teki
  2019-11-27 10:45 ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2019-11-27  8:17 UTC (permalink / raw)
  To: u-boot

Hi,

I have created GPT table start from 8MB for kernel, roots etc.  something like

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00004000      0x00023fff      "boota"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
  2     0x00024000      0x00043fff      "bootb"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   21686148-6449-6e6f-744e-656564454649
  3     0x00044000      0x00243fff      "rootfsa"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
  4     0x00244000      0x00443fff      "rootfsb"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   8da63339-0007-60c0-c436-083ac8230908
  5     0x00444000      0x0070bfde      "data"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa

I have not included SPL, U-Boot to the partition list since it start
from 0x400 in i.MX6. So
I'm writing SPL separately using fastboot(with offset) or ums.

But by doing this, the partition header seems overlapped so the output looks

GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a != 0x8e4fd548
find_valid_gpt: *** ERROR: Invalid GPT ***
find_valid_gpt: ***        Using Backup GPT ***
Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00004000      0x00023fff      "boota"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
  2     0x00024000      0x00043fff      "bootb"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   21686148-6449-6e6f-744e-656564454649
  3     0x00044000      0x00243fff      "rootfsa"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
  4     0x00244000      0x00443fff      "rootfsb"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   8da63339-0007-60c0-c436-083ac8230908
  5     0x00444000      0x0070bfde      "data"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa

So, what I understand is If I create the GPT first and then write the
SPL, the SPL writing process will destroy the GPT Table and if I write
SPL first and then create GPT, the GPT creation process will destroy
the SPL.

Is there any way to fix this? I remember we can prevent this overlap
by preserving GPT Table som other or boot partition instead of having
them at the beginning by default.

Any inputs?

Jagan.

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

* [U-Boot] GPT overlap on i.MX6
  2019-11-27  8:17 [U-Boot] GPT overlap on i.MX6 Jagan Teki
@ 2019-11-27 10:45 ` Lukasz Majewski
  2019-11-27 15:56   ` Jagan Teki
  0 siblings, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2019-11-27 10:45 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

> Hi,
> 
> I have created GPT table start from 8MB for kernel, roots etc.
> something like
> 
> Part    Start LBA       End LBA         Name
>         Attributes
>         Type GUID
>         Partition GUID
>   1     0x00004000      0x00023fff      "boota"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
>   2     0x00024000      0x00043fff      "bootb"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   21686148-6449-6e6f-744e-656564454649
>   3     0x00044000      0x00243fff      "rootfsa"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
>   4     0x00244000      0x00443fff      "rootfsb"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   8da63339-0007-60c0-c436-083ac8230908
>   5     0x00444000      0x0070bfde      "data"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> 
> I have not included SPL, U-Boot to the partition list since it start
> from 0x400 in i.MX6. So
> I'm writing SPL separately using fastboot(with offset) or ums.
> 
> But by doing this, the partition header seems overlapped so the
> output looks
> 
> GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a !=
> 0x8e4fd548 find_valid_gpt: *** ERROR: Invalid GPT ***
> find_valid_gpt: ***        Using Backup GPT ***
> Part    Start LBA       End LBA         Name
>         Attributes
>         Type GUID
>         Partition GUID
>   1     0x00004000      0x00023fff      "boota"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
>   2     0x00024000      0x00043fff      "bootb"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   21686148-6449-6e6f-744e-656564454649
>   3     0x00044000      0x00243fff      "rootfsa"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
>   4     0x00244000      0x00443fff      "rootfsb"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   8da63339-0007-60c0-c436-083ac8230908
>   5     0x00444000      0x0070bfde      "data"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> 
> So, what I understand is If I create the GPT first and then write the
> SPL, the SPL writing process will destroy the GPT Table and if I write
> SPL first and then create GPT, the GPT creation process will destroy
> the SPL.
> 
> Is there any way to fix this? I remember we can prevent this overlap
> by preserving GPT Table som other or boot partition instead of having
> them at the beginning by default.
> 
> Any inputs?

On the diagram of GPT description [1] there is the info that partitions
can start from LBA 34 (0x200 * 34) = 0x4400 

From the above it seems like you starts from 0x4000 your boota
partition, which then overwrites the "Entries 5-128" which shall be 0
and are protected by CRC written in the Primary GPT Header.

Please try to adjust your partition scheme to start from 0x4400.

> 
> Jagan.


Links:

[1] - https://en.wikipedia.org/wiki/GUID_Partition_Table

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191127/d4980a45/attachment.sig>

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

* [U-Boot] GPT overlap on i.MX6
  2019-11-27 10:45 ` Lukasz Majewski
@ 2019-11-27 15:56   ` Jagan Teki
  2019-11-27 16:17     ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2019-11-27 15:56 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On Wed, Nov 27, 2019 at 4:15 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi Jagan,
>
> > Hi,
> >
> > I have created GPT table start from 8MB for kernel, roots etc.
> > something like
> >
> > Part    Start LBA       End LBA         Name
> >         Attributes
> >         Type GUID
> >         Partition GUID
> >   1     0x00004000      0x00023fff      "boota"
> >         attrs:  0x0000000000000004
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> >   2     0x00024000      0x00043fff      "bootb"
> >         attrs:  0x0000000000000004
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   21686148-6449-6e6f-744e-656564454649
> >   3     0x00044000      0x00243fff      "rootfsa"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> >   4     0x00244000      0x00443fff      "rootfsb"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   8da63339-0007-60c0-c436-083ac8230908
> >   5     0x00444000      0x0070bfde      "data"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> >
> > I have not included SPL, U-Boot to the partition list since it start
> > from 0x400 in i.MX6. So
> > I'm writing SPL separately using fastboot(with offset) or ums.
> >
> > But by doing this, the partition header seems overlapped so the
> > output looks
> >
> > GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a !=
> > 0x8e4fd548 find_valid_gpt: *** ERROR: Invalid GPT ***
> > find_valid_gpt: ***        Using Backup GPT ***
> > Part    Start LBA       End LBA         Name
> >         Attributes
> >         Type GUID
> >         Partition GUID
> >   1     0x00004000      0x00023fff      "boota"
> >         attrs:  0x0000000000000004
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> >   2     0x00024000      0x00043fff      "bootb"
> >         attrs:  0x0000000000000004
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   21686148-6449-6e6f-744e-656564454649
> >   3     0x00044000      0x00243fff      "rootfsa"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> >   4     0x00244000      0x00443fff      "rootfsb"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   8da63339-0007-60c0-c436-083ac8230908
> >   5     0x00444000      0x0070bfde      "data"
> >         attrs:  0x0000000000000000
> >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> >
> > So, what I understand is If I create the GPT first and then write the
> > SPL, the SPL writing process will destroy the GPT Table and if I write
> > SPL first and then create GPT, the GPT creation process will destroy
> > the SPL.
> >
> > Is there any way to fix this? I remember we can prevent this overlap
> > by preserving GPT Table som other or boot partition instead of having
> > them at the beginning by default.
> >
> > Any inputs?
>
> On the diagram of GPT description [1] there is the info that partitions
> can start from LBA 34 (0x200 * 34) = 0x4400
>
> From the above it seems like you starts from 0x4000 your boota
> partition, which then overwrites the "Entries 5-128" which shall be 0
> and are protected by CRC written in the Primary GPT Header.
>
> Please try to adjust your partition scheme to start from 0x4400.

I still see the overlap. I have created boota at 0x4400 and the write
the SPL at 0x400

icorem6qdl-rqs> mmc part

Partition Map for MMC device 2  --   Partition Type: EFI

GUID Partition Table Entry Array CRC is wrong: 0xfca8e0bf != 0xc10fdc7b
find_valid_gpt: *** ERROR: Invalid GPT ***
find_valid_gpt: ***        Using Backup GPT ***
Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00004400      0x000243ff      "bootA"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
  2     0x00024400      0x000443ff      "bootB"
        attrs:  0x0000000000000004
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   21686148-6449-6e6f-744e-656564454649
  3     0x00044400      0x002443ff      "rootfsA"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
  4     0x00244400      0x004443ff      "rootfsB"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   8da63339-0007-60c0-c436-083ac8230908
  5     0x00444400      0x0070bfde      "data"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   d61c5b08-c376-f243-a883-15dd900766c3

Jagan.

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

* [U-Boot] GPT overlap on i.MX6
  2019-11-27 15:56   ` Jagan Teki
@ 2019-11-27 16:17     ` Lukasz Majewski
  2019-11-28  5:15       ` Jagan Teki
  0 siblings, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2019-11-27 16:17 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

> Hi Lukasz,
> 
> On Wed, Nov 27, 2019 at 4:15 PM Lukasz Majewski <lukma@denx.de> wrote:
> >
> > Hi Jagan,
> >  
> > > Hi,
> > >
> > > I have created GPT table start from 8MB for kernel, roots etc.
> > > something like
> > >
> > > Part    Start LBA       End LBA         Name
> > >         Attributes
> > >         Type GUID
> > >         Partition GUID
> > >   1     0x00004000      0x00023fff      "boota"
> > >         attrs:  0x0000000000000004
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > >   2     0x00024000      0x00043fff      "bootb"
> > >         attrs:  0x0000000000000004
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   21686148-6449-6e6f-744e-656564454649
> > >   3     0x00044000      0x00243fff      "rootfsa"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > >   4     0x00244000      0x00443fff      "rootfsb"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > >   5     0x00444000      0x0070bfde      "data"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > >
> > > I have not included SPL, U-Boot to the partition list since it
> > > start from 0x400 in i.MX6. So
> > > I'm writing SPL separately using fastboot(with offset) or ums.
> > >
> > > But by doing this, the partition header seems overlapped so the
> > > output looks
> > >
> > > GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a !=
> > > 0x8e4fd548 find_valid_gpt: *** ERROR: Invalid GPT ***
> > > find_valid_gpt: ***        Using Backup GPT ***
> > > Part    Start LBA       End LBA         Name
> > >         Attributes
> > >         Type GUID
> > >         Partition GUID
> > >   1     0x00004000      0x00023fff      "boota"
> > >         attrs:  0x0000000000000004
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > >   2     0x00024000      0x00043fff      "bootb"
> > >         attrs:  0x0000000000000004
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   21686148-6449-6e6f-744e-656564454649
> > >   3     0x00044000      0x00243fff      "rootfsa"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > >   4     0x00244000      0x00443fff      "rootfsb"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > >   5     0x00444000      0x0070bfde      "data"
> > >         attrs:  0x0000000000000000
> > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > >
> > > So, what I understand is If I create the GPT first and then write
> > > the SPL, the SPL writing process will destroy the GPT Table and
> > > if I write SPL first and then create GPT, the GPT creation
> > > process will destroy the SPL.
> > >
> > > Is there any way to fix this? I remember we can prevent this
> > > overlap by preserving GPT Table som other or boot partition
> > > instead of having them at the beginning by default.
> > >
> > > Any inputs?  
> >
> > On the diagram of GPT description [1] there is the info that
> > partitions can start from LBA 34 (0x200 * 34) = 0x4400
> >
> > From the above it seems like you starts from 0x4000 your boota
> > partition, which then overwrites the "Entries 5-128" which shall be
> > 0 and are protected by CRC written in the Primary GPT Header.
> >
> > Please try to adjust your partition scheme to start from 0x4400.  
> 
> I still see the overlap. I have created boota at 0x4400 and the write
> the SPL at 0x400
             ^^^^^^ - this overwrites the GPT header IMHO.

You may dump the eMMC and check if this is the case (even with u-boot's
md.l utility)


I had similar problem on some Beagle Bone Black (AM33x) board.

The ROM wanted to boot from the fixed eMMC LBA offset which was clashing
with GPT.

Fortunately, it was also possible to boot from FAT (it was checked
before the raw offset from eMMC case) partition, so I used this option
instead.


But hey, isn't it possible to store SPL/u-boot to the eMMC's boot (the
separate HW partition) partition and store GPT to the user accessible
one (the large one - e.g. 4 GiB)?


> 
> icorem6qdl-rqs> mmc part
> 
> Partition Map for MMC device 2  --   Partition Type: EFI
> 
> GUID Partition Table Entry Array CRC is wrong: 0xfca8e0bf !=
> 0xc10fdc7b find_valid_gpt: *** ERROR: Invalid GPT ***
> find_valid_gpt: ***        Using Backup GPT ***
> Part    Start LBA       End LBA         Name
>         Attributes
>         Type GUID
>         Partition GUID
>   1     0x00004400      0x000243ff      "bootA"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
>   2     0x00024400      0x000443ff      "bootB"
>         attrs:  0x0000000000000004
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   21686148-6449-6e6f-744e-656564454649
>   3     0x00044400      0x002443ff      "rootfsA"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
>   4     0x00244400      0x004443ff      "rootfsB"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   8da63339-0007-60c0-c436-083ac8230908
>   5     0x00444400      0x0070bfde      "data"
>         attrs:  0x0000000000000000
>         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
>         guid:   d61c5b08-c376-f243-a883-15dd900766c3
> 
> Jagan.




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191127/a864af6f/attachment.sig>

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

* [U-Boot] GPT overlap on i.MX6
  2019-11-27 16:17     ` Lukasz Majewski
@ 2019-11-28  5:15       ` Jagan Teki
  2019-11-28  9:46         ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2019-11-28  5:15 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On Wed, Nov 27, 2019 at 9:47 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> Hi Jagan,
>
> > Hi Lukasz,
> >
> > On Wed, Nov 27, 2019 at 4:15 PM Lukasz Majewski <lukma@denx.de> wrote:
> > >
> > > Hi Jagan,
> > >
> > > > Hi,
> > > >
> > > > I have created GPT table start from 8MB for kernel, roots etc.
> > > > something like
> > > >
> > > > Part    Start LBA       End LBA         Name
> > > >         Attributes
> > > >         Type GUID
> > > >         Partition GUID
> > > >   1     0x00004000      0x00023fff      "boota"
> > > >         attrs:  0x0000000000000004
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > > >   2     0x00024000      0x00043fff      "bootb"
> > > >         attrs:  0x0000000000000004
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   21686148-6449-6e6f-744e-656564454649
> > > >   3     0x00044000      0x00243fff      "rootfsa"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > > >   4     0x00244000      0x00443fff      "rootfsb"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > > >   5     0x00444000      0x0070bfde      "data"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > > >
> > > > I have not included SPL, U-Boot to the partition list since it
> > > > start from 0x400 in i.MX6. So
> > > > I'm writing SPL separately using fastboot(with offset) or ums.
> > > >
> > > > But by doing this, the partition header seems overlapped so the
> > > > output looks
> > > >
> > > > GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a !=
> > > > 0x8e4fd548 find_valid_gpt: *** ERROR: Invalid GPT ***
> > > > find_valid_gpt: ***        Using Backup GPT ***
> > > > Part    Start LBA       End LBA         Name
> > > >         Attributes
> > > >         Type GUID
> > > >         Partition GUID
> > > >   1     0x00004000      0x00023fff      "boota"
> > > >         attrs:  0x0000000000000004
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > > >   2     0x00024000      0x00043fff      "bootb"
> > > >         attrs:  0x0000000000000004
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   21686148-6449-6e6f-744e-656564454649
> > > >   3     0x00044000      0x00243fff      "rootfsa"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > > >   4     0x00244000      0x00443fff      "rootfsb"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > > >   5     0x00444000      0x0070bfde      "data"
> > > >         attrs:  0x0000000000000000
> > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > > >
> > > > So, what I understand is If I create the GPT first and then write
> > > > the SPL, the SPL writing process will destroy the GPT Table and
> > > > if I write SPL first and then create GPT, the GPT creation
> > > > process will destroy the SPL.
> > > >
> > > > Is there any way to fix this? I remember we can prevent this
> > > > overlap by preserving GPT Table som other or boot partition
> > > > instead of having them at the beginning by default.
> > > >
> > > > Any inputs?
> > >
> > > On the diagram of GPT description [1] there is the info that
> > > partitions can start from LBA 34 (0x200 * 34) = 0x4400
> > >
> > > From the above it seems like you starts from 0x4000 your boota
> > > partition, which then overwrites the "Entries 5-128" which shall be
> > > 0 and are protected by CRC written in the Primary GPT Header.
> > >
> > > Please try to adjust your partition scheme to start from 0x4400.
> >
> > I still see the overlap. I have created boota at 0x4400 and the write
> > the SPL at 0x400
>              ^^^^^^ - this overwrites the GPT header IMHO.

True, this overlap GPT. and we don't have an option since ROM
expecting the SPL at 0x400.

>
> You may dump the eMMC and check if this is the case (even with u-boot's
> md.l utility)
>
>
> I had similar problem on some Beagle Bone Black (AM33x) board.
>
> The ROM wanted to boot from the fixed eMMC LBA offset which was clashing
> with GPT.
>
> Fortunately, it was also possible to boot from FAT (it was checked
> before the raw offset from eMMC case) partition, so I used this option
> instead.

You mean create FAT partition and copy SPL/U-Boot binaries on the directory?

>
>
> But hey, isn't it possible to store SPL/u-boot to the eMMC's boot (the
> separate HW partition) partition and store GPT to the user accessible
> one (the large one - e.g. 4 GiB)?

Yes, this is what I'm thinking of. But how to preserve the GPT at
another partition or user accessible area than beginning (which is
done by default).

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

* [U-Boot] GPT overlap on i.MX6
  2019-11-28  5:15       ` Jagan Teki
@ 2019-11-28  9:46         ` Lukasz Majewski
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Majewski @ 2019-11-28  9:46 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

> Hi Lukasz,
> 
> On Wed, Nov 27, 2019 at 9:47 PM Lukasz Majewski <lukma@denx.de> wrote:
> >
> > Hi Jagan,
> >  
> > > Hi Lukasz,
> > >
> > > On Wed, Nov 27, 2019 at 4:15 PM Lukasz Majewski <lukma@denx.de>
> > > wrote:  
> > > >
> > > > Hi Jagan,
> > > >  
> > > > > Hi,
> > > > >
> > > > > I have created GPT table start from 8MB for kernel, roots etc.
> > > > > something like
> > > > >
> > > > > Part    Start LBA       End LBA         Name
> > > > >         Attributes
> > > > >         Type GUID
> > > > >         Partition GUID
> > > > >   1     0x00004000      0x00023fff      "boota"
> > > > >         attrs:  0x0000000000000004
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > > > >   2     0x00024000      0x00043fff      "bootb"
> > > > >         attrs:  0x0000000000000004
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   21686148-6449-6e6f-744e-656564454649
> > > > >   3     0x00044000      0x00243fff      "rootfsa"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > > > >   4     0x00244000      0x00443fff      "rootfsb"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > > > >   5     0x00444000      0x0070bfde      "data"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > > > >
> > > > > I have not included SPL, U-Boot to the partition list since it
> > > > > start from 0x400 in i.MX6. So
> > > > > I'm writing SPL separately using fastboot(with offset) or ums.
> > > > >
> > > > > But by doing this, the partition header seems overlapped so
> > > > > the output looks
> > > > >
> > > > > GUID Partition Table Entry Array CRC is wrong: 0x6a1aba0a !=
> > > > > 0x8e4fd548 find_valid_gpt: *** ERROR: Invalid GPT ***
> > > > > find_valid_gpt: ***        Using Backup GPT ***
> > > > > Part    Start LBA       End LBA         Name
> > > > >         Attributes
> > > > >         Type GUID
> > > > >         Partition GUID
> > > > >   1     0x00004000      0x00023fff      "boota"
> > > > >         attrs:  0x0000000000000004
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> > > > >   2     0x00024000      0x00043fff      "bootb"
> > > > >         attrs:  0x0000000000000004
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   21686148-6449-6e6f-744e-656564454649
> > > > >   3     0x00044000      0x00243fff      "rootfsa"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   b921b045-1df0-41c3-af44-4c6f280d3fae
> > > > >   4     0x00244000      0x00443fff      "rootfsb"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   8da63339-0007-60c0-c436-083ac8230908
> > > > >   5     0x00444000      0x0070bfde      "data"
> > > > >         attrs:  0x0000000000000000
> > > > >         type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
> > > > >         guid:   4f72ab70-69be-5948-81ff-4fc3daf24faa
> > > > >
> > > > > So, what I understand is If I create the GPT first and then
> > > > > write the SPL, the SPL writing process will destroy the GPT
> > > > > Table and if I write SPL first and then create GPT, the GPT
> > > > > creation process will destroy the SPL.
> > > > >
> > > > > Is there any way to fix this? I remember we can prevent this
> > > > > overlap by preserving GPT Table som other or boot partition
> > > > > instead of having them at the beginning by default.
> > > > >
> > > > > Any inputs?  
> > > >
> > > > On the diagram of GPT description [1] there is the info that
> > > > partitions can start from LBA 34 (0x200 * 34) = 0x4400
> > > >
> > > > From the above it seems like you starts from 0x4000 your boota
> > > > partition, which then overwrites the "Entries 5-128" which
> > > > shall be 0 and are protected by CRC written in the Primary GPT
> > > > Header.
> > > >
> > > > Please try to adjust your partition scheme to start from
> > > > 0x4400.  
> > >
> > > I still see the overlap. I have created boota at 0x4400 and the
> > > write the SPL at 0x400  
> >              ^^^^^^ - this overwrites the GPT header IMHO.  
> 
> True, this overlap GPT. and we don't have an option since ROM
> expecting the SPL at 0x400.

The ROM expects some LBA from eMMC being accessible. 

Maybe it would be possible to add some specific for your application
DCD code to enable eMMC's boot{01} partition?

Also IIRC i.MX6 allows playing around with some fuses, so maybe you can
specify eMMC to use boot{01} HW partition?

> 
> >
> > You may dump the eMMC and check if this is the case (even with
> > u-boot's md.l utility)
> >
> >
> > I had similar problem on some Beagle Bone Black (AM33x) board.
> >
> > The ROM wanted to boot from the fixed eMMC LBA offset which was
> > clashing with GPT.
> >
> > Fortunately, it was also possible to boot from FAT (it was checked
> > before the raw offset from eMMC case) partition, so I used this
> > option instead.  
> 
> You mean create FAT partition and copy SPL/U-Boot binaries on the
> directory?

Yes, this worked with BBB.

> 
> >
> >
> > But hey, isn't it possible to store SPL/u-boot to the eMMC's boot
> > (the separate HW partition) partition and store GPT to the user
> > accessible one (the large one - e.g. 4 GiB)?  
> 
> Yes, this is what I'm thinking of. But how to preserve the GPT at
> another partition or user accessible area than beginning (which is
> done by default).

Maybe you can use DCD? Or play around with fuses?

ROM booting options are quite verbose - and I don't believe that NXP
did not consider the use case with GPT and single eMMC as the memory
medium.

(All my boards use SPI-NOR / NOR-FLASH for boot up, and then switch to
eMMC if needed).






Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191128/4bd7a7d5/attachment.sig>

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

end of thread, other threads:[~2019-11-28  9:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-27  8:17 [U-Boot] GPT overlap on i.MX6 Jagan Teki
2019-11-27 10:45 ` Lukasz Majewski
2019-11-27 15:56   ` Jagan Teki
2019-11-27 16:17     ` Lukasz Majewski
2019-11-28  5:15       ` Jagan Teki
2019-11-28  9:46         ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox