Skip to contentSkip to conversation

CONFIG_OF_SEPARATE - ARM64 Incorrect calculation for uboot-spl.bin padding

RFC Anand Gore 1 participant 1 message Aug 28, 2019

lore
Share & tools
lore

Anand Gore

author
#0 lore raw

Hello,

While trying to use the CONFIG_OF_SEPARATE option for ARM64, I noticed that the )/$(SPL_BIN)-pad.bin creates a 0 byte size in scripts/Makefile.spl in the following rule.

scripts/Makefile.spl:

# 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); \

        dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null;

The issue is that the armv8 uboot-spl.lds script doesn’t have bss_size defined. Even if we add the bss_size, the lds script (arch/arm/cpu/armv8/u-boot-spl.lds ) has 2 memory regions, sram for TEXT and sdram for BSS. There could be a potential gap between the 2 sections. Due to this, function board_fdt_blob_setup will calculate the wrong address to look for the loaded dtb.

If we keep the padding issue but use following code (both for SPL/TPL and u-boot), the *PLs find the dtb at the right location.

__weak void *board_fdt_blob_setup(void)

{

        void *fdt_blob = NULL;

#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_ARM64)

        /* FDT is at end of BSS unless it is in a different memory region */

        if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))

                fdt_blob = (ulong *)&_image_binary_end;

        else

                fdt_blob = (ulong *)&__bss_end;

#else

        /* FDT is at end of image */

        fdt_blob = (ulong *)&_end;

#endif

        return fdt_blob;

}

Can someone suggest what the preferred solution is for ARM64?

Thanks

Anand