diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index 515e0fea6f..cc02615043 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -15,7 +15,7 @@ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { -#ifndef CONFIG_CMDLINE +#if !defined(CONFIG_CMDLINE) && !defined(CONFIG_U_BOOT_CMD_ALWAYS) /DISCARD/ : { *(.u_boot_list_2_cmd_*) } #endif #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) diff --git a/cmd/Kconfig b/cmd/Kconfig index 4e32dc6323..b522771ce0 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -30,6 +30,14 @@ config SYS_PROMPT This string is displayed in the command line to the left of the 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" config AUTOBOOT diff --git a/include/command.h b/include/command.h index 767cabb3df..681084b9ea 100644 --- a/include/command.h +++ b/include/command.h @@ -221,4 +221,14 @@ int board_run_command(const char *cmdline); U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \ _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 */