cli: allow users to determine history buffer allocation method

This commit allows users to choose the appropriate memory
allocation method between static allocated and dynamically
calloc. The previous static-array way will not obviously
contribute to the final binary size since it is uninitialized,
and might have better performance than the dynamical one.
Now we provide the users with both the two options.

Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>
This commit is contained in:
Hanyuan Zhao
2024-03-05 15:37:35 +08:00
committed by Tom Rini
parent 4495134030
commit 421359ac52
2 changed files with 36 additions and 11 deletions

View File

@@ -189,6 +189,17 @@ config CMD_HISTORY
Show the command-line history, i.e. a list of commands that are in
the history buffer.
config CMD_HISTORY_USE_CALLOC
bool "dynamically allocate memory"
default y
depends on CMD_HISTORY
help
Saying Y to this will use calloc to get the space for history
storing. Otherwise the history buffer will be an uninitialized
static array directly, without the memory allocation, and it is
writable after relocation to RAM. If u-boot is running from ROM
all the time or unsure, say Y to this.
config CMD_LICENSE
bool "license"
select BUILD_BIN2C