layout: Add -i <region>[:<file>] support

Add an optional sub-parameter to the -i parameter to allow building the
image to be written from multiple files. This will also allow regions to
be read from flash and written to separate image files.

This is a rebase of a patch that was ported from chromiumos. A lot of
things have changed, but the idea is the same.

Original patch by Louis Yung-Chieh Lo <>:
Summary: Support -i partition:file feature for both read and write.
Commit: 9c7525f
Review URL:

Ported version by Stefan Tauner <>
and Carl-Daniel Hailfinger <>:
Summary: [PATCH 2/6] layout: Add -i <region>[:<file>] support.
Review URL:

Change-Id: Ic5465659605d8431d931053967b40290195cfd99
Signed-off-by: David Hendricks <>
Signed-off-by: Stefan Tauner <>
Signed-off-by: Carl-Daniel Hailfinger <>
Signed-off-by: Arthur Heymans <>
Signed-off-by: Nico Huber <>
Signed-off-by: Edward O'Callaghan <>
Signed-off-by: Daniel Campello <>
Co-Authored-by: Edward O'Callaghan <>
Co-Authored-by: Daniel Campello <>
Tested-by: build bot (Jenkins) <>
Reviewed-by: Sam McNally <>
Reviewed-by: Edward O'Callaghan <>
6 files changed