mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Alexander Shiyan <eagle.alexander923@gmail.com>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: imx8mm & genimage
Date: Wed, 30 Aug 2023 16:25:10 +0200	[thread overview]
Message-ID: <76a7bbec-5dff-c138-5c70-9b152558fe2f@pengutronix.de> (raw)
In-Reply-To: <CAP1tNvThyufaTqyj8smDj89WeDeh-cggusnRYKMjB0ExAZ=94g@mail.gmail.com>

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 |




  reply	other threads:[~2023-08-30 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 14:02 Alexander Shiyan
2023-08-30 14:25 ` Ahmad Fatoum [this message]
2023-08-30 14:41   ` Alexander Shiyan
2023-08-30 14:45     ` Ahmad Fatoum

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=76a7bbec-5dff-c138-5c70-9b152558fe2f@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=eagle.alexander923@gmail.com \
    /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