When CONFIG_SPL_SEPARATE_BSS is enabled, fdt_find_separate() expects the SPL control DTB at _image_binary_end. However, u-boot-spl-dtb.bin is currently generated by concatenating u-boot-spl-nodtb.bin and the SPL DTB directly, without padding up to _image_binary_end.
On evb-ast2600 this places the appended SPL DTB at 0xc92c while _image_binary_end is 0xc930. The SPL therefore checks four bytes past the FDT header and fails early with: Missing DTB No serial driver found Add padding between the xPL nodtb binary and the DTB when separate BSS is enabled, so the DTB is placed where fdt_find_separate() expects it. Signed-off-by: Quentin Strydom <[email protected]> --- scripts/Makefile.xpl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.xpl b/scripts/Makefile.xpl index a3fd3e1375f..fcb79df3cc4 100644 --- a/scripts/Makefile.xpl +++ b/scripts/Makefile.xpl @@ -332,8 +332,8 @@ endif ifneq ($(build_dtb),) $(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \ - $(if $(CONFIG_$(PHASE_)SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \ - $(FINAL_DTB_CONTAINER) FORCE + $(if $(CONFIG_$(PHASE_)SEPARATE_BSS),$(obj)/$(SPL_BIN)-image-end-pad.bin,$(obj)/$(SPL_BIN)-pad.bin) \ + $(FINAL_DTB_CONTAINER) FORCE $(call if_changed,cat) $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE @@ -343,6 +343,17 @@ $(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE $(call if_changed,copy) endif +# Create a file that pads from the end of the xPL nodtb binary to _image_binary_end +$(obj)/$(SPL_BIN)-image-end-pad.bin: $(obj)/$(SPL_BIN) $(obj)/$(SPL_BIN)-nodtb.bin + @image_end=$$($(NM) $(obj)/$(SPL_BIN) | awk '/ _image_binary_end/ {print "ibase=16; " toupper($$1)}' | bc); \ + actual=$$(wc -c < $(obj)/$(SPL_BIN)-nodtb.bin); \ + count=$$((image_end - actual)); \ + if [ $$count -lt 0 ]; then \ + echo "Invalid xPL padding: image_end=$$image_end actual=$$actual"; \ + exit 1; \ + fi; \ + dd if=/dev/zero of=$@ bs=1 count=$$count 2>/dev/null + # Create a file that pads from the end of u-boot-spl-nodtb.bin to bss_end $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ -- 2.43.0

