From 5b861eea7927da63f016b75265e454a19ab19d0b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 15 Sep 2020 03:43:29 +0200 Subject: [PATCH] rockchip: make_fit_atf: ignore empty PT_LOAD segment The linker sometimes creates PT_LOAD segments with length (p_filesz) zero as described in https://man7.org/linux/man-pages/man5/elf.5.html. This leads to build failures. We should ignore empty segments. Signed-off-by: Heinrich Schuchardt Tested-by: Tom Rini Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index d15c32b..f3224d2 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -189,8 +189,9 @@ def unpack_elf(filename): p_type, p_flags, p_offset = struct.unpack_from(' 0: + p_data = elf[p_offset:p_offset + p_filesz] + segments.append((index, e_entry, p_paddr, p_data)) return segments def main(): -- 2.7.4