Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] genimage raw partition from multiple files
Date: Wed, 2 Aug 2017 19:55:18 +0200	[thread overview]
Message-ID: <20170802195518.2f279e2b@windsurf.home> (raw)
In-Reply-To: <67c75046-efbc-0881-e7c1-656b11168102@gmail.com>

Hello,

On Wed, 2 Aug 2017 19:25:02 +0200, Micha? ?yszczek wrote:

> > Note that spl is 64k big, and uboot-real must be at offset 256k. Also
> > this *MUST* be a partition of type 0xa2. Can such thing be done fully in
> > genimage without post-install script?
> >   
> 
> Ok, after messing with source code a little bit a found a way to do what
> I want. Let's say want to create partition of type 0xA2 for uboot. That
> partition should contain spl image and full uboot. First create image of
> that partition - this image will be built from "subpartitions"
> 
> 
> image uboot.img {
>         hdimage {
>                 partition-table = "no"
>         }
> 
>         partition spl {
>                 in-partition-table = "no"
>                 image = "u-boot-spl.bin.crc"
>                 offset = 0
>                 size = 64k
>         }
> 
>         partition uboot-full {
>                 in-partition-table = "no"
>                 image = "u-boot.img"
>                 offset = 256k
>         }
> 
>         size = 1M
> }
> 
> 2 things are very important here, first is "partition-table = "no"" in
> hdimage, this will tell hdimage not add ANYTHING from itself, so no
> partition table, no dos magic (55 aa), no mbr at all. All partitions
> should also have "in-partition-table = "no"" to prevent any additional
> bytes from genimage.
> 
> When image is created like that it can be normally added into partition
> table
> 
> 
> image sdcard.img {
>         hdimage {
>         }
> 
>         partition uboot-env {
>                 in-partition-table = "no"
>                 image = "uboot-env.bin"
>                 offset = 17408 # 512 * 34 -> just after gpt
>         }
> 
>         partition uboot {
>                 partition-type = 0xa2
>                 image = "uboot.img"
>         }
> 
>  	partition rootfs {
>                 partition-type = 0x83
>                 image = "rootfs.ext2"
>                 size = 500M
>         }
> }
> 
> 
> And that's all, image will generate as expected. This may look like
> hack, but it is quite clean solution I think. We can avoid any scripts
> to create such partition for bootloader, and everything is in one place.

And those two snippets of genimage configuration can be in a single
genimage.cfg, and both uboot.img and then sdcard.img will be produced
by a single genimage invocation ? Or do we need a first genimage
invocation to generate uboot.img, and then a second genimage invocation
to generate sdcard.img (which requires uboot.img) ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-08-02 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 13:55 [Buildroot] genimage raw partition from multiple files Michał Łyszczek
2017-08-02 17:25 ` Michał Łyszczek
2017-08-02 17:55   ` Thomas Petazzoni [this message]
2017-08-02 18:09     ` Michał Łyszczek
2017-08-02 18:11       ` Thomas Petazzoni

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=20170802195518.2f279e2b@windsurf.home \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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