[U-Boot] [PATCH v2 1/6] spl: add Kconfig option to clear bss early

Simon Glass sjg at chromium.org
Sat Mar 30 20:03:14 UTC 2019


Hi Simon,

On Fri, 22 Mar 2019 at 02:16, Simon Goldschmidt
<simon.k.r.goldschmidt at gmail.com> wrote:
>
> Hi Simon,
>
> On Fri, Mar 22, 2019 at 8:53 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi,
> >
> > On Sat, 16 Mar 2019 at 04:13, Simon Goldschmidt
> > <simon.k.r.goldschmidt at gmail.com> wrote:
> > >
> > > This introduces a new Kconfig option SPL_CLEAR_BSS_F. If enabled, it clears
> > > the bss before calling board_init_f() instead of clearing it before calling
> > > board_init_r().
> > >
> > > This also ensures that variables placed in BSS can be shared between
> > > board_init_f() and board_init_r() in SPL.
> > >
> > > Make the new option depend on ARM for now until more implementations follow.
> > >
> > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> > > ---
> > >
> > > Changes in v2:
> > > - make CONFIG_SPL_CLEAR_BSS_F depend on ARM for now
> > >
> > >  common/spl/Kconfig | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> >
> > The current restriction is that you are not allowed to use BSS before
> > board_init_r().
>
> I understood that, but I did not understand why. This is perfectly valid for
> U-Boot proper or for SPL if SPL_SEPARATE_BSS is used and bss is in
> SDRAM. However, the latter seems to be seldom used and for the "default"
> case where bss is in SRAM, it's available right from the start and clearing
> it after board_init_f() has been run seems quite unuseful and unexpected.

Well this is the API. We have to have some order and conventions
otherwise things just decend into chaos, with so many options that it
all becomes bewildering.

See 'Board Initialisation Flow:' in the README.

>
> >
> > Can you please add a motivation to change this?
>
> The motivation is to allow SPL to use full malloc in board_init_f()
> like required
> by socfpga_arria10 (see patch 5/6). Without this, the malloc pointers get
> overwritten after board_init_f() and further calls to malloc() fail.

Can you call spl_early_init() instead?

Regards,
Simon


More information about the U-Boot mailing list