Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Gero Schwäricke via buildroot" <buildroot@buildroot.org>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [RFC PATCH 1/2] support/scripts/genimage.sh: support creating a bmap image
Date: Wed, 22 May 2024 17:19:53 +0200	[thread overview]
Message-ID: <20240522151953.GA1331364@theia> (raw)
In-Reply-To: <ZkzdeFeoYMkyGv7w@landeda>

On Tue, May 21, 2024 at 07:44:24PM +0200, Yann E. MORIN wrote:
> Michael, All,
> 
> On 2024-05-21 11:28 +0200, Michael Nazzareno Trimarchi spake thusly:
> > On Tue, May 21, 2024 at 7:25 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > I think the question by Thomas was whether, given an input sparse file,
> > > genimage will keep the generated image sparse in the same places the
> > > input file was (only shifted by the offset that input file was copied
> > > at in the image).
> [--SNIP--]
> > Seems I did not understand the question. My idea on the topic is how
> > we can generate
> > images that we can easily flash. Now I understand the question of
> > Thomas and thank you.
> > 
> > Yann can I ask how we can use an image generated as you describe before?
> 
>     $ make pc_x86_64_efi_defconfig
>     $ make
>     $ ls -sl output/images/{rootfs.ext2,disk.img}
> 
> I tried a bit earlier, and the genimage file is indeed sparse, but I
> could not find a tool that would report the list of holes/non-holes in a
> file, and their offset, e.g. something like:
> 
>                 size    offset
>     non-hole    2MiB    @0
>     hole        1MiB    @2MiB
>     non-hole    16MiB   @3MiB
>  and so on...
> 
> So I could not validate whether the hole/non-hole structure is the same
> in the generated disk.img and the rootfs.ext2. If you have any idea how
> to do that, I'm all eyes.

Hi Yann,

iiuc, the bmaptool mainly uses the FIEMAP ioctl. I found this tool [1], 
which prints the FIEMAP values.

Here's a quick test I did:

$ truncate -s 1G /tmp/image.raw
$ ./fiemap /tmp/image.raw
File /tmp/image.raw has 0 extents:
#       Logical          Physical         Length           Flags

$ stat /tmp/image.raw 
  File: /tmp/image.raw
  Size: 1073741824      Blocks: 0          IO Block: 4096   regular file
Device: 10305h/66309d   Inode: 25692108    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/gschwaer)   Gid: ( 1000/gschwaer)
Access: 2024-05-22 17:09:41.463441946 +0200
Modify: 2024-05-22 17:09:41.463441946 +0200
Change: 2024-05-22 17:09:41.463441946 +0200
 Birth: -
$ echo test >> /tmp/image.raw 
$ ./fiemap /tmp/image.raw
File /tmp/image.raw has 1 extents:
#       Logical          Physical         Length           Flags
0:      0000000040000000 0000006208224000 0000000000001000 0001
$ stat /tmp/image.raw 
  File: /tmp/image.raw
  Size: 1073741829      Blocks: 8          IO Block: 4096   regular file
Device: 10305h/66309d   Inode: 25692114    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/gschwaer)   Gid: ( 1000/gschwaer)
Access: 2024-05-22 16:54:48.729576604 +0200
Modify: 2024-05-22 16:59:24.905638708 +0200
Change: 2024-05-22 16:59:24.905638708 +0200
 Birth: -

You can see the allocated section starting at logical 0x40000000 (1G).
Without the `echo` line, the extents list is empty, suggesting the file
has zero allocated blocks. `stat` also hints that the file is sparse,
by the small number of blocks (why 8? idk). I think this can be used to
verify the behavior of genimage.

[1] https://github.com/ColinIanKing/fiemap

Best,
Gero

> 
> Regards,
> Yann E. MORIN.
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 



–––


grandcentrix GmbH | A Vodafone Company · Holzmarkt 1 · 50676 
*Cologne* | Phoenixseestrasse 18 · 44263 *Dortmund* · Germany
| in 
<https://www.linkedin.com/company/grandcentrix> | phone: +49-221-677-860-0 
| email: hello@grandcentrix.net <mailto:hello@grandcentrix.net>


grandcentrix cares about privacy 
<https://grandcentrix.net/de/pages/privacymail/>

Amtsgericht Köln | HRB  
70119 | Geschäftsführer: M. Krömer,  R. Hänel | USt.-IdNr.: DE266333969

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-05-22 15:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-21  9:53 [Buildroot] [RFC PATCH 0/2] Add support to genimage.sh for creating a bmap image Dario Binacchi
2024-04-21  9:53 ` [Buildroot] [RFC PATCH 1/2] support/scripts/genimage.sh: support " Dario Binacchi
2024-04-23 11:33   ` Gero Schwäricke via buildroot
2024-04-23 12:55     ` Quentin Schulz via buildroot
2024-04-24  7:50       ` Gero Schwäricke via buildroot
2024-04-24  8:06     ` Gero Schwäricke via buildroot
2024-05-10 19:54   ` Thomas Petazzoni via buildroot
2024-05-10 20:17     ` Michael Nazzareno Trimarchi
2024-05-21  5:25       ` Yann E. MORIN
2024-05-21  9:28         ` Michael Nazzareno Trimarchi
2024-05-21 17:44           ` Yann E. MORIN
2024-05-22 15:19             ` Gero Schwäricke via buildroot [this message]
2024-05-31  9:47             ` Thomas Petazzoni via buildroot
2024-05-31  9:44         ` Thomas Petazzoni via buildroot
2024-05-20  8:05     ` Dario Binacchi
2024-05-20  9:23       ` Thomas Petazzoni via buildroot
2024-05-21 15:06         ` Dario Binacchi
2024-05-21 20:36         ` Yann E. MORIN
2024-05-22 15:59           ` Gero Schwäricke via buildroot
2024-07-15 14:05   ` Thomas Petazzoni via buildroot
2024-07-15 14:23     ` Arnout Vandecappelle via buildroot
2024-07-15 14:27       ` Thomas Petazzoni via buildroot
2024-07-16  6:16         ` Dario Binacchi
2024-08-27 18:55     ` Peter Korsgaard
2024-08-28 13:42       ` Thomas Petazzoni via buildroot
2024-08-28 13:58         ` Peter Korsgaard
2024-08-29 21:44           ` Thomas Petazzoni via buildroot
2024-08-30  7:14             ` Peter Korsgaard
2024-08-30 15:29               ` Thomas Petazzoni via buildroot
2024-08-30 15:32                 ` Michael Nazzareno Trimarchi
2024-08-31 13:28                   ` Peter Korsgaard
2024-08-31 13:20                 ` Peter Korsgaard
2024-04-21  9:53 ` [Buildroot] [RFC PATCH 2/2] configs/ti_am62x_sk_defconfig: create the " Dario Binacchi

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=20240522151953.GA1331364@theia \
    --to=buildroot@buildroot.org \
    --cc=gero.schwaericke@grandcentrix.net \
    --cc=yann.morin.1998@free.fr \
    /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