mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* imx8mm & genimage
@ 2023-08-30 14:02 Alexander Shiyan
  2023-08-30 14:25 ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Shiyan @ 2023-08-30 14:02 UTC (permalink / raw)
  To: Barebox List

Hello.

I can't figure out how to correctly write the configuration for
genimage for the imx8mm CPU.
This way of writing works fine:
dd if=barebox-nxp-imx8mm-mgqs.img of=/dev/sdc bs=1024 seek=33 skip=33

For genimage I use the following but it doesn't work...

image imx8mm-mgqs-sdcard.img {
hdimage {
partition-table-type = "gpt"
}

partition boot {
image = "barebox-nxp-imx8mm-mgqs.img"
holes = {"(0; 33K)"}
offset = 0
partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4
}

partition env {
image = "/dev/null"
offset = 8M
partition-type-uuid = 6c3737f2-07f8-45d1-ad45-15d260aab24d
size = 32K
}

partition root {
image = "rootfs.ext4"
partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
}
}



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

* Re: imx8mm & genimage
  2023-08-30 14:02 imx8mm & genimage Alexander Shiyan
@ 2023-08-30 14:25 ` Ahmad Fatoum
  2023-08-30 14:41   ` Alexander Shiyan
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-08-30 14:25 UTC (permalink / raw)
  To: Alexander Shiyan, Barebox List

Hello Alexander,

On 30.08.23 16:02, Alexander Shiyan wrote:
> Hello.
> 
> I can't figure out how to correctly write the configuration for
> genimage for the imx8mm CPU.
> This way of writing works fine:
> dd if=barebox-nxp-imx8mm-mgqs.img of=/dev/sdc bs=1024 seek=33 skip=33
> 
> For genimage I use the following but it doesn't work...

What doesn't work? I would have assumed that genimage refused to build
an image with below description.

> 
> image imx8mm-mgqs-sdcard.img {
> hdimage {
> partition-table-type = "gpt"
> }
> 
> partition boot {
> image = "barebox-nxp-imx8mm-mgqs.img"
> holes = {"(0; 33K)"}
> offset = 0
> partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4

I don't think a GPT partition can exist at offset 0, because that would
overlap the GPT header itself. What you want instead is either:

  - add barebox in non-partitioned space outside of the partition table:
    That is done with in-partition-table = false, see e.g. DistroKit[1]

  - add barebox in a GPT partition at the correct offset (32K?) and strip away
    its first 32K bytes. The only way to achieve this currently with genimage
    is to add an explicit file rule and use
    exec-post = "dd ... of=$IMAGEOUTFILE.skipped && mv $IMAGEOUTFILE.skipped $IMAGEOUTFILE"
    It would surely be nice to give genimage a partition { skip = [...] } option,
    if you feel inclined :-)

For eMMC, the barebox update handler will take care to switch on the
eMMC boot and install barebox and do any skipping of bytes if necessary (e.g. on i.MX8MN/P).

[1]: https://git.pengutronix.de/cgit/DistroKit/tree/configs/platform-v8a/config/images/imx8m.config?h=next&id=d4e41181cc388d528bbccb5e9ba96a6120980a55

Cheers,
Ahmad
    

> }
> 
> partition env {
> image = "/dev/null"
> offset = 8M
> partition-type-uuid = 6c3737f2-07f8-45d1-ad45-15d260aab24d
> size = 32K
> }
> 
> partition root {
> image = "rootfs.ext4"
> partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
> }
> }
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

* Re: imx8mm & genimage
  2023-08-30 14:25 ` Ahmad Fatoum
@ 2023-08-30 14:41   ` Alexander Shiyan
  2023-08-30 14:45     ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Shiyan @ 2023-08-30 14:41 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Barebox List

Hello Ahmad.

"in-partition-table = false" helps me, now boot OK.
33K is valid offset for imx8mm, and we do not overlap GPT (or MBR) due
to the "holes" option.

Thanks!

ср, 30 авг. 2023 г. в 17:25, Ahmad Fatoum <a.fatoum@pengutronix.de>:
>
> Hello Alexander,
>
> On 30.08.23 16:02, Alexander Shiyan wrote:
> > Hello.
> >
> > I can't figure out how to correctly write the configuration for
> > genimage for the imx8mm CPU.
> > This way of writing works fine:
> > dd if=barebox-nxp-imx8mm-mgqs.img of=/dev/sdc bs=1024 seek=33 skip=33
> >
> > For genimage I use the following but it doesn't work...
>
> What doesn't work? I would have assumed that genimage refused to build
> an image with below description.
>
> >
> > image imx8mm-mgqs-sdcard.img {
> > hdimage {
> > partition-table-type = "gpt"
> > }
> >
> > partition boot {
> > image = "barebox-nxp-imx8mm-mgqs.img"
> > holes = {"(0; 33K)"}
> > offset = 0
> > partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4
>
> I don't think a GPT partition can exist at offset 0, because that would
> overlap the GPT header itself. What you want instead is either:
>
>   - add barebox in non-partitioned space outside of the partition table:
>     That is done with in-partition-table = false, see e.g. DistroKit[1]
>
>   - add barebox in a GPT partition at the correct offset (32K?) and strip away
>     its first 32K bytes. The only way to achieve this currently with genimage
>     is to add an explicit file rule and use
>     exec-post = "dd ... of=$IMAGEOUTFILE.skipped && mv $IMAGEOUTFILE.skipped $IMAGEOUTFILE"
>     It would surely be nice to give genimage a partition { skip = [...] } option,
>     if you feel inclined :-)
>
> For eMMC, the barebox update handler will take care to switch on the
> eMMC boot and install barebox and do any skipping of bytes if necessary (e.g. on i.MX8MN/P).
>
> [1]: https://git.pengutronix.de/cgit/DistroKit/tree/configs/platform-v8a/config/images/imx8m.config?h=next&id=d4e41181cc388d528bbccb5e9ba96a6120980a55
>
> Cheers,
> Ahmad
>
>
> > }
> >
> > partition env {
> > image = "/dev/null"
> > offset = 8M
> > partition-type-uuid = 6c3737f2-07f8-45d1-ad45-15d260aab24d
> > size = 32K
> > }
> >
> > partition root {
> > image = "rootfs.ext4"
> > partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
> > }
> > }
> >
> >
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>



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

* Re: imx8mm & genimage
  2023-08-30 14:41   ` Alexander Shiyan
@ 2023-08-30 14:45     ` Ahmad Fatoum
  0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-08-30 14:45 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: Barebox List

Hello Alexander,

On 30.08.23 16:41, Alexander Shiyan wrote:
> Hello Ahmad.
> 
> "in-partition-table = false" helps me, now boot OK.
> 33K is valid offset for imx8mm, and we do not overlap GPT (or MBR) due
> to the "holes" option.

I think it would be nicer though to have barebox on SD-Card sit inside
a regular GPT partition now that this is possible without holes shenanigans,
but I haven't found the time to do it in DistroKit (actual customer products
boot from eMMC or NOR).

Cheers,
Ahmad



> 
> Thanks!
> 
> ср, 30 авг. 2023 г. в 17:25, Ahmad Fatoum <a.fatoum@pengutronix.de>:
>>
>> Hello Alexander,
>>
>> On 30.08.23 16:02, Alexander Shiyan wrote:
>>> Hello.
>>>
>>> I can't figure out how to correctly write the configuration for
>>> genimage for the imx8mm CPU.
>>> This way of writing works fine:
>>> dd if=barebox-nxp-imx8mm-mgqs.img of=/dev/sdc bs=1024 seek=33 skip=33
>>>
>>> For genimage I use the following but it doesn't work...
>>
>> What doesn't work? I would have assumed that genimage refused to build
>> an image with below description.
>>
>>>
>>> image imx8mm-mgqs-sdcard.img {
>>> hdimage {
>>> partition-table-type = "gpt"
>>> }
>>>
>>> partition boot {
>>> image = "barebox-nxp-imx8mm-mgqs.img"
>>> holes = {"(0; 33K)"}
>>> offset = 0
>>> partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4
>>
>> I don't think a GPT partition can exist at offset 0, because that would
>> overlap the GPT header itself. What you want instead is either:
>>
>>   - add barebox in non-partitioned space outside of the partition table:
>>     That is done with in-partition-table = false, see e.g. DistroKit[1]
>>
>>   - add barebox in a GPT partition at the correct offset (32K?) and strip away
>>     its first 32K bytes. The only way to achieve this currently with genimage
>>     is to add an explicit file rule and use
>>     exec-post = "dd ... of=$IMAGEOUTFILE.skipped && mv $IMAGEOUTFILE.skipped $IMAGEOUTFILE"
>>     It would surely be nice to give genimage a partition { skip = [...] } option,
>>     if you feel inclined :-)
>>
>> For eMMC, the barebox update handler will take care to switch on the
>> eMMC boot and install barebox and do any skipping of bytes if necessary (e.g. on i.MX8MN/P).
>>
>> [1]: https://git.pengutronix.de/cgit/DistroKit/tree/configs/platform-v8a/config/images/imx8m.config?h=next&id=d4e41181cc388d528bbccb5e9ba96a6120980a55
>>
>> Cheers,
>> Ahmad
>>
>>
>>> }
>>>
>>> partition env {
>>> image = "/dev/null"
>>> offset = 8M
>>> partition-type-uuid = 6c3737f2-07f8-45d1-ad45-15d260aab24d
>>> size = 32K
>>> }
>>>
>>> partition root {
>>> image = "rootfs.ext4"
>>> partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
>>> }
>>> }
>>>
>>>
>>
>> --
>> Pengutronix e.K.                           |                             |
>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

end of thread, other threads:[~2023-08-30 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 14:02 imx8mm & genimage Alexander Shiyan
2023-08-30 14:25 ` Ahmad Fatoum
2023-08-30 14:41   ` Alexander Shiyan
2023-08-30 14:45     ` Ahmad Fatoum

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