binman: Update image positions of FIT subentries
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Mon, 7 Feb 2022 22:08:08 +0000 (01:08 +0300)
committerSimon Glass <sjg@chromium.org>
Tue, 22 Feb 2022 17:05:44 +0000 (10:05 -0700)
commit730922205b107acb80e51ee3c9e2e244ba8968b8
tree63e68ac4b16f2b64f8285e3ede8e8294e96a0790
parentee813c86f99006bf37826d195e7212cf98803de6
binman: Update image positions of FIT subentries

Binman keeps track of positions of each entry in the final image, but
currently this data is wrong for things included in FIT entries,
especially since a previous patch makes FIT a subclass of Section and
inherit its implementation.

There are three ways to put data into a FIT image. It can be directly
included as a "data" property, or it can be external to the FIT image
represented by an offset-size pair of properties. This external offset
is either "data-position" from the start of the FIT or "data-offset"
from the end of the FIT, and the size is "data-size" for both. However,
binman doesn't use the "data-offset" method while building FIT entries.

According to the Section docstring, its subclasses should calculate and
set the correct offsets and sizes in SetImagePos() method. Do this for
FIT subentries for the three ways mentioned above, and add tests for the
two ways binman can pack them in.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/etype/fit.py
tools/binman/ftest.py