All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC BUG] CONFIG_OF_SEPARATE - ARM64 Incorrect calculation for uboot-spl.bin padding
@ 2019-08-28 16:36 Anand Gore
  0 siblings, 0 replies; only message in thread
From: Anand Gore @ 2019-08-28 16:36 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-28 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-28 16:36 [U-Boot] [RFC BUG] CONFIG_OF_SEPARATE - ARM64 Incorrect calculation for uboot-spl.bin padding Anand Gore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.