common: add U_BOOT_CMD_ALWAYS() support

This function is used to support some special U-Boot commands with
U_BOOT_CMD_ALWAYS() declared even when CONFIG_CMDLINE is disabled.

It's used when developers requires a critial u-boot.bin by disabling
the U_BOOT_CMD() and using a simple CLI instead.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I768637592a4d85c7fea00564e96fb80f21ab65fe
This commit is contained in:
Joseph Chen 2020-05-15 08:55:20 +08:00 committed by Jianhong Chen
parent aedbab3f0f
commit 3d8049ad2f
3 changed files with 19 additions and 1 deletions

View File

@ -15,7 +15,7 @@ OUTPUT_ARCH(arm)
ENTRY(_start) ENTRY(_start)
SECTIONS SECTIONS
{ {
#ifndef CONFIG_CMDLINE #if !defined(CONFIG_CMDLINE) && !defined(CONFIG_U_BOOT_CMD_ALWAYS)
/DISCARD/ : { *(.u_boot_list_2_cmd_*) } /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
#endif #endif
#if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)

View File

@ -30,6 +30,14 @@ config SYS_PROMPT
This string is displayed in the command line to the left of the This string is displayed in the command line to the left of the
cursor. cursor.
config U_BOOT_CMD_ALWAYS
bool "Enable cmd with U_BOOT_CMD_ALWAYS() declared"
depends on !CMDLINE
help
This function is used to support some special U-Boot commands with
U_BOOT_CMD_ALWAYS() declared even when CONFIG_CMDLINE is disabled.
It reduces the image size and works with simple CLI.
menu "Autoboot options" menu "Autoboot options"
config AUTOBOOT config AUTOBOOT

View File

@ -221,4 +221,14 @@ int board_run_command(const char *cmdline);
U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \ U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \
_usage, _help, NULL) _usage, _help, NULL)
#ifdef CONFIG_U_BOOT_CMD_ALWAYS
#define U_BOOT_CMD_ALWAYS(_name, _maxargs, _rep, _cmd, _usage, _help) \
ll_entry_declare(cmd_tbl_t, _name, cmd) = \
{ #_name, _maxargs, _rep, _cmd, _usage, \
_CMD_HELP(_help) _CMD_COMPLETE(NULL) }
#else
#define U_BOOT_CMD_ALWAYS(_name, _maxargs, _rep, _cmd, _usage, _help) \
U_BOOT_CMD(_name, _maxargs, _rep, _cmd, _usage, _help)
#endif
#endif /* __COMMAND_H */ #endif /* __COMMAND_H */