fiptool: revive replace_image() to keep the image order by update command
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 27 Jan 2017 02:57:54 +0000 (11:57 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 27 Jan 2017 06:01:23 +0000 (15:01 +0900)
commitea39d557aefe6d8bbd9b08901f2b6f2122e417fe
treeb56690061f65c5dfc7fbcbd923a3207bfbc337b3
parent67973fb4f73411e08f0de39fed0ca21f97de73eb
fiptool: revive replace_image() to keep the image order by update command

Commit e0f083a09b29 ("fiptool: Prepare ground for expanding the set
of images at runtime") introduced another side effect; the "update"
command now changes the image order in the FIP.

Let's say you have an FIP with BL2, BL31, BL32, BL33.  If you update
for example, BL32 with the "update" command, you will get a new FIP
with BL2, BL31, BL33, BL32, in this order.

It happens like this; remove_image() removes the old image from the
linked list, add_image() adds the new image at the tail of the list,
then images are packed in the new order.  Prior to that commit,
images were updated by replace_image(), but it was deleted by the
re-work.  Revive replace_image() that is re-implemented to work with
the linked list.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
tools/fiptool/fiptool.c