[PATCH v4 01/13] binman: Ignore noload segments for image numbering
Simon Glass
sjg at chromium.org
Sat Jun 6 00:08:23 CEST 2026
Hi Varadarajan,
On Thu, 4 Jun 2026 at 03:32, Varadarajan Narayanan
<varadarajan.narayanan at oss.qualcomm.com> wrote:
>
> While including the partial images of a split-elf, binman gives the
> segment number as found in the input ELF. However this results in 'gaps'
> if the NOLOAD segments appear in between LOAD segments. Hence track the
> LOAD segments separately and number the partial images accordingly.
>
> Signed-off-by: Varadarajan Narayanan <varadarajan.narayanan at oss.qualcomm.com>
> ---
> tools/binman/elf.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/binman/elf.py b/tools/binman/elf.py
> index 6ac960e0419..b43cf490b37 100644
> --- a/tools/binman/elf.py
> +++ b/tools/binman/elf.py
> @@ -551,6 +551,7 @@ def read_loadable_segments(data):
> raise ValueError(err)
> entry = elf.header['e_entry']
> segments = []
> + n = 0
> for i in range(elf.num_segments()):
> segment = elf.get_segment(i)
> if segment['p_type'] != 'PT_LOAD' or not segment['p_memsz']:
> @@ -558,7 +559,8 @@ def read_loadable_segments(data):
> continue
> start = segment['p_offset']
> rend = start + segment['p_filesz']
> - segments.append((i, segment['p_paddr'], data[start:rend]))
> + segments.append((n, segment['p_paddr'], data[start:rend]))
> + n = n + 1
> return segments, entry
>
> def is_valid(data):
> --
> 2.34.1
>
Please update elf_tests.py to cover this new behaviour.
Regards,
Simon
More information about the U-Boot
mailing list