From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anand Gore Date: Wed, 28 Aug 2019 09:36:28 -0700 Subject: [U-Boot] [RFC BUG] CONFIG_OF_SEPARATE - ARM64 Incorrect calculation for uboot-spl.bin padding Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de 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=3D$(shell $(NM) $< | awk 'BEGIN {size =3D 0} /__bss_s= ize/ {size =3D $$1} END {print "ibase=3D16; " toupper(size)}' | bc); \ dd if=3D/dev/zero of=3D$@ bs=3D1 count=3D$${bss_size_str} 2>/dev/nu= ll; The issue is that the armv8 uboot-spl.lds script doesn=E2=80=99t have bss_s= ize 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 =3D 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 =3D (ulong *)&_image_binary_end; else fdt_blob =3D (ulong *)&__bss_end; #else /* FDT is at end of image */ fdt_blob =3D (ulong *)&_end; #endif return fdt_blob; } Can someone suggest what the preferred solution is for ARM64? Thanks Anand