public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ivan Mikhaylov <fr0st61te@gmail.com>
To: Simon Glass <sjg@chromium.org>
Cc: Alper Nebi Yasak <alpernebiyasak@gmail.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	Ivan Mikhaylov <ivan.mikhaylov@siemens.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH 1/3] binman: add sign option for binman
Date: Thu, 15 Sep 2022 22:44:53 +0000	[thread overview]
Message-ID: <8bf99a710da222864dd608f9cd05dc0f1c5dbda1.camel@gmail.com> (raw)
In-Reply-To: <CAPnjgZ1a4ZdPu++7TWVJi7nt5Oy=51GSW5OXTSyoTaJ=EZ7m5w@mail.gmail.com>

On Wed, 2022-09-07 at 15:10 -0600, Simon Glass wrote:
> Hi Ivan,
> 
> Section data comes from the BuildSectionData() method, so you could
> try calling that.
> 
> See also collect_contents_to_file()
> 
> Regards,
> Simon

Simon, I've tried both these ways and they both don't work to me. What
I've got:

def SignEntries(image_fname, input_fname, privatekey_fname, algo,
entry_paths):
    image_fname = os.path.abspath(image_fname)
    image = Image.FromFile(image_fname)
    state.PrepareFromLoadedData(image)
    image.LoadData()

1. BuildSectionData
 
    for entry_path in entry_paths:
        entry = image.FindEntryPath(entry_path)

        try:
            entry.BuildSectionData(True)
        except Exception as e:
            logging.error(traceback.format_exc())


ERROR:root:AttributeError: 'NoneType' object has no attribute 'run'

2. collect_contents_to_file

    for entry_path in entry_paths:
        entry = image.FindEntryPath(entry_path)

        try:
            entry.collect_contents_to_file([entry.name], "prefix",
1024)
        except Exception as e:
            logging.error(traceback.format_exc())

ERROR:root:AttributeError: 'str' object has no attribute
'ObtainContents'

3. GetData

    for entry_path in entry_paths:
        entry = image.FindEntryPath(entry_path)

        print("--- DATA ---")
        data = entry.GetData(True)
        print(data)
        print("~~~ DATA ~~~")

--- DATA ---
Node '/fit/images/u-boot-1/u-boot': GetData: size 0x4
   Node '/fit/images/u-boot-1': GetPaddedDataForEntry: size None
   Node '/fit/images/u-boot-1': GetData: 1 entries, total size 0x4
Node '/fit/images/fdt-1/u-boot-spl-dtb': GetData: size 0x4f7
      Node '/fit/images/fdt-1': GetPaddedDataForEntry: size None
      Node '/fit/images/fdt-1': GetData: 1 entries, total size 0x4f7
Deleted temporary directory '/tmp/binman.z81eqcfz'
binman: 'NoneType' object has no attribute 'run'

There is no problem with getting data from GetData around start of the
year. Maybe some regression?

All this ran with this:
binman -v5 sign -i image.bin -k test_key.key -a sha256,rsa4096 fit

`fit` in entry_paths and image contains FIT section with name `fit`.

binman ls -i image.bin
Name                  Image-pos  Size     Entry-type      Offset 
Uncomp-size
-----------------------------------------------------------------------
--------
main-section                  0   100000  section              0
  fit                     10000      c0a  fit              10000
    u-boot-1              10104        4  section            104
      u-boot              10104        4  u-boot               0
    fdt-1                 101c8      4f7  section            1c8
      u-boot-spl-dtb      101c8      4f7  u-boot-spl-dtb       0
  fdtmap                  10c0a      4f5  fdtmap           10c0a


Seems something went wrong, any ideas? Or did I misuse?

Thanks.

  reply	other threads:[~2022-09-16 12:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 21:43 [PATCH 0/3] Introduce new sign binman's option Ivan Mikhaylov
2022-03-21 21:43 ` [PATCH 1/3] binman: add sign option for binman Ivan Mikhaylov
2022-04-05 18:54   ` Alper Nebi Yasak
2022-04-06 20:28     ` Ivan Mikhaylov
2022-04-06 22:22       ` Alper Nebi Yasak
2022-09-06 16:27         ` Ivan Mikhaylov
2022-09-07 21:10           ` Simon Glass
2022-09-15 22:44             ` Ivan Mikhaylov [this message]
2022-11-18 20:50               ` Simon Glass
2022-12-13 21:51                 ` Ivan Mikhaylov
2022-12-17 22:02                   ` Simon Glass
2022-12-25  1:35                     ` Ivan Mikhaylov
2023-01-13 18:00                       ` Simon Glass
2023-01-16  2:54                         ` Ivan Mikhaylov
2023-02-04 22:23                           ` Simon Glass
2023-02-14 23:37                             ` Ivan Mikhaylov
2023-02-17 23:49                               ` Simon Glass
2022-03-21 21:43 ` [PATCH 2/3] binman: add documentation for binman sign option Ivan Mikhaylov
2022-03-21 21:43 ` [PATCH 3/3] binman: add test for " Ivan Mikhaylov
2022-04-08 15:39   ` Sean Anderson
2022-04-08 19:26     ` Ivan Mikhaylov
2022-04-10 22:37       ` Alper Nebi Yasak
2022-04-11 15:02         ` Sean Anderson
2022-08-13 14:59 ` [PATCH 0/3] Introduce new sign binman's option Simon Glass
2022-08-15 21:51   ` Ivan Mikhaylov

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=8bf99a710da222864dd608f9cd05dc0f1c5dbda1.camel@gmail.com \
    --to=fr0st61te@gmail.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=ivan.mikhaylov@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=sjg@chromium.org \
    --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