[PATCH 1/2] command: Allocate history buffer using calloc()

Simon Glass sjg at chromium.org
Wed Dec 13 20:51:16 CET 2023


Hi Marek,

On Sun, 3 Dec 2023 at 13:44, Marek Vasut <marek.vasut at mailbox.org> wrote:
>
> On 12/3/23 18:44, Simon Glass wrote:
> > Hi Marek,
> >
> > On Sat, 2 Dec 2023 at 13:53, Marek Vasut
> > <marek.vasut+renesas at mailbox.org> wrote:
> >>
> >> The history buffer is currently a static array which can be some
> >> 10-40 kiB depending on configuration, and so adds considerably to
> >> the U-Boot binary size. Allocate it dynamically instead to reduce
> >> the U-Boot binary size.
> >>
> >> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> >> ---
> >> Cc: Simon Glass <sjg at chromium.org>
> >> ---
> >>   common/cli_readline.c | 26 +++++++++++++++++---------
> >>   1 file changed, 17 insertions(+), 9 deletions(-)
> >
> > This is very intriguing...
> >
> > I would expect this to end up in BSS, so not part of the image, but
> > allocated when U-Boot starts.
> >
> > What do you mean by U-Boot binary size? Which architecture is this?
>
> ARM64 , I spotted it at rcar3_salvator-x_defconfig but it has been a
> while since I created those patches , they were on hold for a while .

Yes, then really we should fix that bug.

E.g. __rel_dyn_start (OVERLAY) is missing for arm64. This affects all boards:

For firefly-rk3288 (ARMv7):
 11 .bss_start    00000000  0106c578  0106c578  0007d0a4  2**0
                  CONTENTS
 12 .bss          0000cc44  0106c578  0106c578  0007d0a8  2**3
                  CONTENTS
 13 .bss_end      00000000  010791bc  010791bc  00089cec  2**0
                  CONTENTS

For rcar3_salvator-x (ARMv8):

 10 .bss_start    00000000  00000000000f1a18  00000000000f1a18  00101a18  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 11 .bss          00011108  00000000000f1a40  00000000000f1a40  00101a18  2**6
                  ALLOC
 12 .bss_end      00000000  0000000000102b48  0000000000102b48  00112b48  2**0
                  CONTENTS, ALLOC, LOAD, DATA

The 'LOAD' attributes are a bug.

Regards,
Simon


More information about the U-Boot mailing list