From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: Simon Glass <sjg@chromium.org>
Cc: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>,
Tom Rini <trini@konsulko.com>,
Philippe Reynes <philippe.reynes@softathome.com>,
huang lin <hl@rock-chips.com>,
Jeffy Chen <jeffy.chen@rock-chips.com>,
Kever Yang <kever.yang@rock-chips.com>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v2 12/25] binman: Change how faked blobs are created
Date: Fri, 4 Mar 2022 00:09:31 +0300 [thread overview]
Message-ID: <22d5d296-65b4-2a97-5879-d038d400efc5@gmail.com> (raw)
In-Reply-To: <20220223230040.159317-13-sjg@chromium.org>
On 24/02/2022 02:00, Simon Glass wrote:
> At present fake blobs are created but internally an empty blob is used.
> Change it to use the contents of the faked file. Also return whether the
> blob was faked, in case the caller needs to know that.
>
> Add a TODO to put fake blobs in their own directory.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Add a patch to change how faked blobs are created
>
> tools/binman/binman.rst | 3 ++-
> tools/binman/entry.py | 9 ++++++---
> tools/binman/etype/blob.py | 7 ++++---
> tools/binman/etype/blob_ext_list.py | 2 +-
> 4 files changed, 13 insertions(+), 8 deletions(-)
I feel a bit uneasy about all this fake file stuff, but can't figure out
exactly why. I guess the patch doesn't make it that worse.
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
> diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
> index 85f8337a31..a90364f2fb 100644
> --- a/tools/binman/binman.rst
> +++ b/tools/binman/binman.rst
> @@ -1500,7 +1500,8 @@ Some ideas:
> - Figure out how to make Fdt support changing the node order, so that
> Node.AddSubnode() can support adding a node before another, existing node.
> Perhaps it should completely regenerate the flat tree?
> -
> +- Put faked files into a separate subdir and remove them on start-up, to avoid
> + seeing them as 'real' files on a subsequent run
Do we need to create actual files, or is it a convenience thing for blob
entry types (because they already read their contents from files)?
Also, maybe it's better to create them somewhere in the /tmp/binman.*
directories so they disappear without effort.
>
> --
> Simon Glass <sjg@chromium.org>
> diff --git a/tools/binman/entry.py b/tools/binman/entry.py
> index 00a13c5839..2fb0050da5 100644
> --- a/tools/binman/entry.py
> +++ b/tools/binman/entry.py
> @@ -997,15 +997,18 @@ features to produce new behaviours.
> fname (str): Filename to check
>
> Returns:
> - fname (str): Filename of faked file
> + tuple:
> + fname (str): Filename of faked file
> + bool: True if the blob was faked, False if not
> """
> if self.allow_fake and not pathlib.Path(fname).is_file():
> outfname = tools.get_output_filename(os.path.basename(fname))
> with open(outfname, "wb") as out:
> out.truncate(1024)
> self.faked = True
> - return outfname
> - return fname
> + tout.info(f"Entry '{self._node.path}': Faked file '{outfname}'")
> + return outfname, True
> + return fname, False
Can't callers use self.faked for this?
I think I see an edge case when calling this multiple times for the same
filename, only the first call would recognize it being a fake file and
only the first-entry-to-call would consider itself faked.
>
> def CheckFakedBlobs(self, faked_blobs_list):
> """Check if any entries in this section have faked external blobs
> diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
> index 25ec5d26c9..89f089e740 100644
> --- a/tools/binman/etype/blob.py
> +++ b/tools/binman/etype/blob.py
> @@ -41,10 +41,11 @@ class Entry_blob(Entry):
> self.external and self.section.GetAllowMissing())
> # Allow the file to be missing
> if not self._pathname:
> - self._pathname = self.check_fake_fname(self._filename)
> - self.SetContents(b'')
> + self._pathname, faked = self.check_fake_fname(self._filename)
> self.missing = True
> - return True
> + if not faked:
> + self.SetContents(b'')
> + return True
>
> self.ReadBlobContents()
> return True
>
> [...]
next prev parent reply other threads:[~2022-03-03 21:17 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 23:00 [PATCH v2 00/25] binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script Simon Glass
2022-02-23 23:00 ` [PATCH v2 01/25] dtoc: Make GetArgs() more flexible Simon Glass
2022-03-03 21:07 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 02/25] moveconfig: Remove remove_defconfig() Simon Glass
2022-03-03 21:07 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 03/25] moveconfig: Use re.fullmatch() to avoid extra check Simon Glass
2022-03-03 21:07 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 04/25] spl: Correct Kconfig help for TPL_BINMAN_SYMBOLS Simon Glass
2022-03-03 21:08 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 05/25] dtoc: Tidy up implementation of AddStringList() Simon Glass
2022-03-03 21:08 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 06/25] elf: Rename load_segments() and module failure Simon Glass
2022-03-03 21:08 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 07/25] binman: Tweak collect_contents_to_file() and docs Simon Glass
2022-03-03 21:08 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 08/25] binman: Rename ExpandToLimit to extend_to_limit Simon Glass
2022-03-03 21:08 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 09/25] binman: Rename ExpandEntries to gen_entries Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 10/25] binman: Refactor fit to generate output at the end Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 11/25] binman: Rename tools parameter to btools Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 12/25] binman: Change how faked blobs are created Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak [this message]
2022-03-06 3:08 ` Simon Glass
2022-03-10 19:29 ` Alper Nebi Yasak
2022-03-12 5:02 ` Simon Glass
2022-03-14 21:29 ` Alper Nebi Yasak
2022-03-14 22:20 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 13/25] binman: Make fake blobs zero-sized by default Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 14/25] binman: Allow mkimage to use a non-zero fake-blob size Simon Glass
2022-03-03 21:09 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-03-10 19:30 ` Alper Nebi Yasak
2022-03-12 5:02 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 15/25] binman: Read the fit entries only once Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 16/25] binman: Fix some pylint warnings in fit Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 17/25] binman: Add a consistent way to report errors with fit Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 18/25] binman: Update fit to use node instead of subnode Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 19/25] binman: Keep a separate list of entries for fit Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-03-10 19:30 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 20/25] binman: Support splitting an ELF file into multiple nodes Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 21/25] rockchip: evb-rk3288: Drop raw-image support Simon Glass
2022-02-23 23:00 ` [PATCH v2 22/25] rockchip: Include binman script in 64-bit boards Simon Glass
2022-03-03 21:10 ` Alper Nebi Yasak
2022-02-23 23:00 ` [PATCH v2 23/25] rockchip: Support building the all output files in binman Simon Glass
2022-03-02 22:16 ` Peter Geis
2022-03-03 21:11 ` Alper Nebi Yasak
2022-03-03 22:34 ` Peter Geis
2022-03-06 3:08 ` Simon Glass
2022-02-23 23:00 ` [PATCH v2 24/25] rockchip: Convert all boards to use binman Simon Glass
2022-02-23 23:00 ` [PATCH v2 25/25] rockchip: Drop the FIT generator script Simon Glass
2022-03-01 2:48 ` [RFC] [PATCH] binman: support mkimage split files Peter Geis
2022-03-03 21:11 ` Alper Nebi Yasak
2022-03-04 17:47 ` Peter Geis
2022-03-04 19:56 ` [PATCH v2] binman: support mkimage separate files Peter Geis
2022-03-06 3:08 ` Simon Glass
2022-03-06 14:44 ` Peter Geis
2022-03-10 19:29 ` Alper Nebi Yasak
2022-03-10 23:19 ` Peter Geis
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=22d5d296-65b4-2a97-5879-d038d400efc5@gmail.com \
--to=alpernebiyasak@gmail.com \
--cc=hl@rock-chips.com \
--cc=ivan.mikhaylov@siemens.com \
--cc=jeffy.chen@rock-chips.com \
--cc=kever.yang@rock-chips.com \
--cc=philippe.reynes@softathome.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox