All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Yannic Moog <Y.Moog@phytec.de>
To: "sjg@chromium.org" <sjg@chromium.org>
Cc: "alpernebiyasak@gmail.com" <alpernebiyasak@gmail.com>,
	Benjamin Hahn <B.Hahn@phytec.de>,
	"trini@konsulko.com" <trini@konsulko.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	Yashwanth Varakala <Y.Varakala@phytec.de>,
	"upstream@lists.phytec.de" <upstream@lists.phytec.de>,
	"tharvey@gateworks.com" <tharvey@gateworks.com>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
	Teresa Remmet <T.Remmet@phytec.de>
Subject: Re: [PATCH RFC 6/6] binman: doc: update Optional entries
Date: Tue, 18 Feb 2025 13:15:07 +0000	[thread overview]
Message-ID: <150cc82d61583d092aed27ce043c6316b093a13a.camel@phytec.de> (raw)
In-Reply-To: <CAFLszTg0UXfcsy8-A9QMq5CSsAvAXHLKRBpHyzdNuwdj17VwKQ@mail.gmail.com>

On Mon, 2025-02-17 at 06:13 -0700, Simon Glass wrote:
> Hi Yannic,
> 
> On Mon, 17 Feb 2025 at 00:21, Yannic Moog <Y.Moog@phytec.de> wrote:
> > 
> > Hi Simon,
> > 
> > On Fri, 2025-02-14 at 06:48 -0700, Simon Glass wrote:
> > > Hi Yannic,
> > > 
> > > On Fri, 14 Feb 2025 at 00:05, Yannic Moog <Y.Moog@phytec.de>
> > > wrote:
> > > > 
> > > > On Thu, 2025-02-13 at 07:01 -0700, Simon Glass wrote:
> > > > > Hi Yannic,
> > > > > 
> > > > > On Thu, 13 Feb 2025 at 00:21, Yannic Moog <Y.Moog@phytec.de>
> > > > > wrote:
> > > > > > 
> > > > > > On Mon, 2025-02-10 at 06:08 -0700, Simon Glass wrote:
> > > > > > > On Wed, 29 Jan 2025 at 03:30, Yannic Moog
> > > > > > > <y.moog@phytec.de> wrote:
> > > > > > > > 
> > > > > > > > The binman documentation of Optional entries is not
> > > > > > > > accurate in the
> > > > > > > > sense that it does not cover blobs entry type. As this
> > > > > > > > is also the most
> > > > > > > > widely used type to have the optional entry, document
> > > > > > > > the interaction
> > > > > > > > with faking blobs.
> > > > > > > > 
> > > > > > > > Signed-off-by: Yannic Moog <y.moog@phytec.de>
> > > > > > > > ---
> > > > > > > >  tools/binman/binman.rst | 9 ++++++++-
> > > > > > > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > > > > > > 
> > > > > > > > diff --git a/tools/binman/binman.rst
> > > > > > > > b/tools/binman/binman.rst
> > > > > > > > index 990fc295770..2bafa6ca408 100644
> > > > > > > > --- a/tools/binman/binman.rst
> > > > > > > > +++ b/tools/binman/binman.rst
> > > > > > > > @@ -1145,7 +1145,14 @@ called on all entries.
> > > > > > > >  It is not possible for an entry to mark itself absent
> > > > > > > > at any other point in the
> > > > > > > >  processing. It must happen in the ObtainContents()
> > > > > > > > method.
> > > > > > > > 
> > > > > > > > -The effect is as if the entry had never been present
> > > > > > > > at all, since the image
> > > > > > > > +The effect depends on the type of entry.
> > > > > > > > +
> > > > > > > > +Blobs
> > > > > > > > +~~~~~
> > > > > > > > +For blobs, the effect depends on whether --fake-ext-
> > > > > > > > blobs is passed
> > > > > > > > +to binman. (This is the case by default)
> > > > > > > > +In case --fake-ext-blobs is set, any missing entries
> > > > > > > > will be faked.
> > > > > > > > +If not set, it is as if the entry had never been
> > > > > > > > present at all, since the image
> > > > > > > >  is packed without it and it disappears from the list
> > > > > > > > of entries.
> > > > > > > 
> > > > > > > I'm not quite following this. The text seems OK but your
> > > > > > > heading
> > > > > > > implies that things other than blobs can be faked. All of
> > > > > > > this
> > > > > > > functionality is only for blobs.
> > > > > > 
> > > > > > The heading is a subsection of "Optional entries". To my
> > > > > > knowledge the "optional" property
> > > > > > is
> > > > > > not
> > > > > > limited to blobs. But blobs get special treatment in
> > > > > > regards to "optional" due to the --
> > > > > > fake-
> > > > > > ext-
> > > > > > blobs option. Hence the subsection.
> > > > > > 
> > > > > > What would you like me to change to make this clearer?
> > > > > 
> > > > > Oh I see. Are you saying that optional entries end up in the
> > > > > image
> > > > > when they are faked, external blobs? If so, that seems like a
> > > > > bug to
> > > > > me.
> > > > 
> > > > To clarify, optional images are faked only when they are
> > > > missing. So in case the image is
> > > > missing, a
> > > > faked image is indeed packaged into the image.
> > > > 
> > > 
> > > OK, but I still think it is a bug.
> > 
> > I didn't question your judgement, I simply don't have the broader
> > goal of binman in mind to be able
> > to judge if this behaviour is unintended.
> > What should happen instead? Should the image simply be absent in
> > the final image?
> > 
> > > Why add an optional thing in this way?
> > 
> > Because it seems like a simple, elegant solution.
> > To elaborate:
> > The goal (in case of OP-TEE) is to have the binary packaged when
> > its there and not packaged when it
> > is not present.
> > Precisely because it is not required for a bootable image, but may
> > be added to enhance functionality
> > . I.e. it is optional.
> > I found the U-Boot doc to explain optional entries and thought it
> > to be a perfect fit.
> > What do you have in mind to achieve this goal?
> 
> I think we are talking about slightly different things.
> 
> If a binary is optional then I don't see much point in including an
> empty (or faked) binary. If it is the only thing missing, the image
> should still boot OK if it just doesn't appear in the image.
> 
> The idea with Binman is to produce a functional image, where
> possible.
> An image without an optional blob is functional, so we should not
> need
> to add it.
> 
> I'm not saying this is a big problem, just that it seems surprising
> and not what I intended.

I am with you on this. It was suprising to me, too. And I agree there
is no point (at least to me) in including it in the final image.
So we were talking about the same thing, I simply want to make sure we
are on the same page.

> 
> Perhaps we do need to fake the blob in case it is used by some other
> tool. But I wonder if we can stop Binman adding the faked blob into
> the image, if it is optional?

From my point of view, It would be better to stop binman from adding
faked blobs than what I proposed in these RFC patches. I didn't know,
however, if there was a use case for adding them to the images that I
am not aware of.
Since you now confirm that it was never your intention to have them
included in the first place I think we can go ahead in preventing
binman from adding faked blobs to images.
I'll work on it for the next version.

Yannic

> 
> 
> > 
> > Yannic
> > 
> > > 
> > > 
> > > > Here is the image map from an (phycore-)imx8mp build.
> > > > 
> > > > Missing tee-os (faked):
> > > > 
> > > > ImagePos    Offset      Size  Name
> > > > 00000000  00000000  00159e10  image
> > > > 00000000   00000000  00159e10  section
> > > > [...]
> > > > 00058000    00058000  00101e10  fit
> > > > 0005b000     00003000  000e4910  uboot
> > > > 0005b000      00000000  000e4910  blob-ext
> > > > 0013f910     000e7910  00008458  atf
> > > > 0013f910      00000000  00008458  atf-blob
> > > > 00147d68     000efd68  00000000  tee
> > > > 00147d68      00000000  00000000  tee-os
> > > > 
> > > > tee-os present:
> > > > 
> > > > ImagePos    Offset      Size  Name
> > > > 00000000  00000000  0022b5b0  image
> > > > 00000000   00000000  0022b5b0  section
> > > > [...]
> > > > 00058000    00058000  001d35b0  fit
> > > > 0005b000     00003000  000e4910  uboot
> > > > 0005b000      00000000  000e4910  blob-ext
> > > > 0013f910     000e7910  00008458  atf
> > > > 0013f910      00000000  00008458  atf-blob
> > > > 00147d68     000efd68  000d17a0  tee
> > > > 00147d68      00000000  000d17a0  tee-os
> > > > 
> > > > Yannic
> 
> Regards,
> Simon


  reply	other threads:[~2025-02-18 13:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29 10:29 [PATCH RFC 0/6] Fix handling of optional blobs in binman Yannic Moog
2025-01-29 10:29 ` [PATCH RFC 1/6] tools: binman: ftest.py: fake ext blobs per default Yannic Moog
2025-02-10 13:06   ` Simon Glass
2025-02-13  7:15     ` Yannic Moog
2025-02-13 14:01       ` Simon Glass
2025-02-14  7:18         ` Yannic Moog
2025-02-14 13:48           ` Simon Glass
2025-02-17  7:07             ` Yannic Moog
2025-01-29 10:29 ` [PATCH RFC 2/6] tools: binman: ftest: pass allow_fake_blob to _DoReadFileDtb Yannic Moog
2025-02-10 13:09   ` Simon Glass
2025-01-29 10:29 ` [PATCH RFC 3/6] tools: binman: ftest: fix tests that require non-faked ext blobs Yannic Moog
2025-02-10 13:09   ` Simon Glass
2025-02-13  7:15     ` Yannic Moog
2025-01-29 10:29 ` [PATCH RFC 4/6] binman: fix faked optional entry handling Yannic Moog
2025-02-10 13:09   ` Simon Glass
2025-01-29 10:29 ` [PATCH RFC 5/6] binman: test: assert optional blobs don't cause non-functionality Yannic Moog
2025-02-10 13:07   ` Simon Glass
2025-01-29 10:29 ` [PATCH RFC 6/6] binman: doc: update Optional entries Yannic Moog
2025-02-10 13:08   ` Simon Glass
2025-02-13  7:21     ` Yannic Moog
2025-02-13 14:01       ` Simon Glass
2025-02-14  7:05         ` Yannic Moog
2025-02-14 13:48           ` Simon Glass
2025-02-17  7:21             ` Yannic Moog
2025-02-17 13:13               ` Simon Glass
2025-02-18 13:15                 ` Yannic Moog [this message]
2025-02-19  0:01                   ` Simon Glass
2025-02-10 13:08 ` [PATCH RFC 0/6] Fix handling of optional blobs in binman Simon Glass

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=150cc82d61583d092aed27ce043c6316b093a13a.camel@phytec.de \
    --to=y.moog@phytec.de \
    --cc=B.Hahn@phytec.de \
    --cc=T.Remmet@phytec.de \
    --cc=Y.Varakala@phytec.de \
    --cc=alpernebiyasak@gmail.com \
    --cc=festevam@gmail.com \
    --cc=sjg@chromium.org \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=upstream@lists.phytec.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.