When converting some MIPS-based platforms from CONFIG_OF_EMBED to CONFIG_OF_SEPARATE and CONFIG_MULTI_DTB_FIT, I had trouble with getting to the right offset of the DTB blob.
It turns out that the mips-relocs utility chops off unused space in the ".rel" section, but in doing so it bring the "_end" symbol out of sync with the actual end of the generated binary. When the DT blob is tacked on, the "_end" symbol will not point to the start of the blob as desired, but somewhere into the blob - causing the DT parse to fail. This fix skips the ".rel" section shrinking to keep "_end" pointing to the right place. Another possible solution would be to update "_end", but that is beyond my current skills I'm afraid. Signed-off-by: Lars Povlsen <lars.povl...@microsemi.com> --- tools/Makefile | 1 + tools/mips-relocs.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tools/Makefile b/tools/Makefile index 0c3341e..aabb5b8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -196,6 +196,7 @@ hostprogs-y += fdtgrep fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o hostprogs-$(CONFIG_MIPS) += mips-relocs +HOSTCFLAGS_mips-relocs.o := $(if $(CONFIG_OF_SEPARATE),-DCONFIG_OF_SEPARATE -Wno-unused-but-set-variable -Wno-unused-variable) # We build some files with extra pedantic flags to try to minimize things # that won't build on some weird host compiler -- though there are lots of diff --git a/tools/mips-relocs.c b/tools/mips-relocs.c index 442cc8f..9c5bf07 100644 --- a/tools/mips-relocs.c +++ b/tools/mips-relocs.c @@ -401,6 +401,8 @@ int main(int argc, char *argv[]) return -ENOMEM; } + // Shrinking the .rel section mess up the _end symbol when CONFIG_OF_SEPARATE used +#if !defined(CONFIG_OF_SEPARATE) /* Update the .rel section's size */ set_shdr_field(i_rel_shdr, sh_size, rel_actual_size); @@ -414,6 +416,7 @@ int main(int argc, char *argv[]) set_phdr_field(i, p_filesz, load_sz); break; } +#endif /* Make sure data is written back to the file */ err = msync(elf, st.st_size, MS_SYNC); -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot