]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: Introduce CMD_HELP
authorMichal Simek <michal.simek@amd.com>
Mon, 30 Jun 2025 12:21:07 +0000 (14:21 +0200)
committerMichal Simek <michal.simek@amd.com>
Tue, 8 Jul 2025 13:00:17 +0000 (15:00 +0200)
Add option to disable help command in size constrained systems to save some
space. There is also no need to have ifdefs around CMDLINE because all
commands depends on it.
And also mark cmd_help dependency in test_help.py.

Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c17f825fb8a74e1d1912a3fd09a9a880c84a8bfd.1751286059.git.michal.simek@amd.com
cmd/Kconfig
cmd/Makefile
cmd/help.c
test/py/tests/test_help.py

index 1ba3cfcb28a785f7c8b5bdc3814be38200102a38..37495c261a6cf623ca1aa3a9d387c6a2f39f73a7 100644 (file)
@@ -190,6 +190,12 @@ config CMD_FWU_METADATA
        help
          Command to read the metadata and dump it's contents
 
+config CMD_HELP
+       bool "help"
+       default y
+       help
+         Command to show help information about other commands.
+
 config CMD_HISTORY
        bool "history"
        depends on CMDLINE_EDITING
index 80cf70b7fe8c1747db37d7cb1428863a671560b5..718eff4ed197461f8731450a4aefaa4e9acff2f3 100644 (file)
@@ -7,7 +7,7 @@ ifndef CONFIG_XPL_BUILD
 # core command
 obj-y += boot.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
-obj-y += help.o
+obj-$(CONFIG_CMD_HELP) += help.o
 obj-y += panic.o
 obj-y += version.o
 
index 56579e28d31d7dfd0aa25130f8eb7093ea631783..1be83ba607d44161516ba6c7eca07e96c36bf587 100644 (file)
@@ -9,13 +9,9 @@
 static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
                   char *const argv[])
 {
-#ifdef CONFIG_CMDLINE
        struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
        const int len = ll_entry_count(struct cmd_tbl, cmd);
        return _do_help(start, len, cmdtp, flag, argc, argv);
-#else
-       return 0;
-#endif
 }
 
 U_BOOT_CMD(
@@ -27,7 +23,6 @@ U_BOOT_CMD(
        "       - print detailed usage of 'command'"
 );
 
-#ifdef CONFIG_CMDLINE
 /*
  * This does not use the U_BOOT_CMD macro as ? can't be used in symbol names
  * nor can we rely on the CONFIG_SYS_LONGHELP helper macro
@@ -39,4 +34,3 @@ ll_entry_declare(struct cmd_tbl, question_mark, cmd) = {
        ""
 #endif /* CONFIG_SYS_LONGHELP */
 };
-#endif
index 12cb36b7b985c104fa0d96491a47095ed78f0986..afb57201ba38b8782353e7c7eaeed7fb84bd921c 100644 (file)
@@ -4,6 +4,7 @@
 
 import pytest
 
+@pytest.mark.buildconfigspec('cmd_help')
 def test_help(ubman):
     """Test that the "help" command can be executed."""