Message ID | 20210116145343.4.I66e525bc185416fb67c5ff72d9fadde9d60f7ae4@changeid |
---|---|
State | Superseded |
Delegated to: | Bin Meng |
Headers | show |
Series | x86: Minor improvements mostly for image loading | expand |
Hi Simon, On Sun, Jan 17, 2021 at 5:54 AM Simon Glass <sjg@chromium.org> wrote: > > The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built > with any particular alignment. It ends at the start of the BSS section. > The BSS section selects its own alignment, which may larger. I don't see start of the BSS section has alignment in the linker script. > This means that there can be a gap of a few bytes between the image > ending and BSS starting. > > Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with > perhaps some padding for BSS), the expected result is not obtained. U-Boot > uses the end of BSS to find the devicetree, so this means that it cannot > be found. Please explain this in more details, maybe showing a failure case with exact bss start/size and where U-Boot expects to get the device tree but it's not > > Add 32-byte alignment of BSS so that the image size is correct and > appending the devicetree will place it at the end of BSS. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > arch/x86/cpu/u-boot-spl.lds | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds > index e6c22895b35..e0c70b076b8 100644 > --- a/arch/x86/cpu/u-boot-spl.lds > +++ b/arch/x86/cpu/u-boot-spl.lds > @@ -43,6 +43,7 @@ SECTIONS > __binman_sym_start = .; > KEEP(*(SORT(.binman_sym*))); > __binman_sym_end = .; > + . = ALIGN(32); Is 32 safe enough? > } > > _image_binary_end = .; > -- Regards, Bin
Hi Bin, On Wed, 20 Jan 2021 at 22:35, Bin Meng <bmeng.cn@gmail.com> wrote: > > Hi Simon, > > On Sun, Jan 17, 2021 at 5:54 AM Simon Glass <sjg@chromium.org> wrote: > > > > The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built > > with any particular alignment. It ends at the start of the BSS section. > > The BSS section selects its own alignment, which may larger. > > I don't see start of the BSS section has alignment in the linker script. > > > This means that there can be a gap of a few bytes between the image > > ending and BSS starting. > > > > Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with > > perhaps some padding for BSS), the expected result is not obtained. U-Boot > > uses the end of BSS to find the devicetree, so this means that it cannot > > be found. > > Please explain this in more details, maybe showing a failure case with > exact bss start/size and where U-Boot expects to get the device tree > but it's not > > > > > Add 32-byte alignment of BSS so that the image size is correct and > > appending the devicetree will place it at the end of BSS. > > > > Signed-off-by: Simon Glass <sjg@chromium.org> > > --- > > > > arch/x86/cpu/u-boot-spl.lds | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds > > index e6c22895b35..e0c70b076b8 100644 > > --- a/arch/x86/cpu/u-boot-spl.lds > > +++ b/arch/x86/cpu/u-boot-spl.lds > > @@ -43,6 +43,7 @@ SECTIONS > > __binman_sym_start = .; > > KEEP(*(SORT(.binman_sym*))); > > __binman_sym_end = .; > > + . = ALIGN(32); > > Is 32 safe enough? I'll send a new version expanding this. I have not seen >32-byte alignment so far. > > > } > > > > _image_binary_end = .; > > -- Regards, Simon
diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds index e6c22895b35..e0c70b076b8 100644 --- a/arch/x86/cpu/u-boot-spl.lds +++ b/arch/x86/cpu/u-boot-spl.lds @@ -43,6 +43,7 @@ SECTIONS __binman_sym_start = .; KEEP(*(SORT(.binman_sym*))); __binman_sym_end = .; + . = ALIGN(32); } _image_binary_end = .;
The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built with any particular alignment. It ends at the start of the BSS section. The BSS section selects its own alignment, which may larger. This means that there can be a gap of a few bytes between the image ending and BSS starting. Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with perhaps some padding for BSS), the expected result is not obtained. U-Boot uses the end of BSS to find the devicetree, so this means that it cannot be found. Add 32-byte alignment of BSS so that the image size is correct and appending the devicetree will place it at the end of BSS. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/x86/cpu/u-boot-spl.lds | 1 + 1 file changed, 1 insertion(+)