[PATCH 1/3] binman: add sign option for binman

Ivan Mikhaylov fr0st61te at gmail.com
Sun Dec 25 02:35:13 CET 2022


On Sat, 2022-12-17 at 15:02 -0700, Simon Glass wrote:
> Hi Ivan,
> 
> On Tue, 13 Dec 2022 at 11:51, Ivan Mikhaylov <fr0st61te at gmail.com>
> wrote:
> > 
> > On Fri, 2022-11-18 at 13:50 -0700, Simon Glass wrote:
> > > Hi Ivan,
> > > 
> > > On Thu, 15 Sept 2022 at 13:44, Ivan Mikhaylov
> > > <fr0st61te at gmail.com>
> > > wrote:
> > > > 
> > > > 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'
> > 
> > Hi Simon, sorry for long delay.
> > 
> > binman: 'NoneType' object has no attribute 'run'
> > 
> > Traceback (most recent call last):
> >   File "/home/fr/upstream_uboot/tools/binman/binman", line 133, in
> > RunBinman
> >     ret_code = control.Binman(args)
> >   File "/home/fr/upstream_uboot/tools/binman/control.py", line 684,
> > in
> > Binman
> >     SignEntries(args.image, args.file, args.key, args.algo,
> > args.paths)
> >   File "/home/fr/upstream_uboot/tools/binman/control.py", line 469,
> > in
> > SignEntries
> >     entry.BuildSectionData(True)
> >   File "/home/fr/upstream_uboot/tools/binman/etype/fit.py", line
> > 426,
> > in BuildSectionData
> >     if self.mkimage.run(reset_timestamp=True,
> > output_fname=output_fname,
> > AttributeError: 'NoneType' object has no attribute 'run'
> > 
> 
> You need to call image.CollectBintolls() like ReadEntry() and other
> functions similar to yours that read images from a file. This is the
> only way that the 'mkimage' tool becomes available to fit.py
> 
> See fit.AddBintools() which is called by that function and sets
> 'self.mkimage'
> > 
Simon, thanks, now this part works fine but there is still issue with
updating of fit section, saw that there exists some functions like
WriteData but for section(etype/fit.py) it is not implemented yet. 

ValueError: Node '/fit': Replacing sections is not implemented yet

Also tried SetContents but it doesn't update fit section in place. Any
suggestions here?

Thanks.


More information about the U-Boot mailing list