imx8mm & genimage

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Aug 30 07:45:37 PDT 2023


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 at 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 |




More information about the barebox mailing list