summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-08-13 15:54:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2008-08-13 16:29:17 +0200
commit932b57873db47db89989b86789b216e50a753478 (patch)
tree45121689cbab9b60340f62e6148405fdbea53163 /common
parent0dd24dc17d561fa0a9f8d5b2ffb5c31e1cf7985c (diff)
downloadbarebox-932b57873db47db89989b86789b216e50a753478.tar.gz
move several commands into extra files
move false, true, help, insmod, lsmod, version into extra files Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/command.c79
-rw-r--r--common/module.c58
2 files changed, 2 insertions, 135 deletions
diff --git a/common/command.c b/common/command.c
index c86b005..accaffa 100644
--- a/common/command.c
+++ b/common/command.c
@@ -41,40 +41,6 @@ const char version_string[] =
LIST_HEAD(command_list);
EXPORT_SYMBOL(command_list);
-static int do_version (cmd_tbl_t *cmdtp, int argc, char *argv[])
-{
- printf ("\n%s\n", version_string);
- return 0;
-}
-
-U_BOOT_CMD_START(version)
- .maxargs = 1,
- .cmd = do_version,
- .usage = "print monitor version",
-U_BOOT_CMD_END
-
-static int do_true (cmd_tbl_t *cmdtp, int argc, char *argv[])
-{
- return 0;
-}
-
-U_BOOT_CMD_START(true)
- .maxargs = 1,
- .cmd = do_true,
- .usage = "do nothing, successfully",
-U_BOOT_CMD_END
-
-static int do_false (cmd_tbl_t *cmdtp, int argc, char *argv[])
-{
- return 1;
-}
-
-U_BOOT_CMD_START(false)
- .maxargs = 1,
- .cmd = do_false,
- .usage = "do nothing, unsuccessfully",
-U_BOOT_CMD_END
-
#ifdef CONFIG_SHELL_HUSH
static int do_exit (cmd_tbl_t *cmdtp, int argc, char *argv[])
@@ -117,51 +83,6 @@ void u_boot_cmd_usage(cmd_tbl_t *cmdtp)
}
EXPORT_SYMBOL(u_boot_cmd_usage);
-/*
- * Use puts() instead of printf() to avoid printf buffer overflow
- * for long help messages
- */
-static int do_help (cmd_tbl_t * cmdtp, int argc, char *argv[])
-{
- if (argc == 1) { /* show list of commands */
- for_each_command(cmdtp) {
- if (!cmdtp->usage)
- continue;
- printf("%10s - %s\n", cmdtp->name, cmdtp->usage);
- }
- return 0;
- }
-
- /* command help (long version) */
- if ((cmdtp = find_cmd(argv[1])) != NULL) {
- u_boot_cmd_usage(cmdtp);
- return 0;
- } else {
- printf ("Unknown command '%s' - try 'help'"
- " without arguments for list of all"
- " known commands\n\n", argv[1]
- );
- return 1;
- }
-}
-
-static const __maybe_unused char cmd_help_help[] =
-"Show help information (for 'command')\n"
-"'help' prints online help for the monitor commands.\n\n"
-"Without arguments, it prints a short usage message for all commands.\n\n"
-"To get detailed help information for specific commands you can type\n"
-"'help' with one or more command names as arguments.\n";
-
-static const char *help_aliases[] = { "?", NULL};
-
-U_BOOT_CMD_START(help)
- .maxargs = 2,
- .cmd = do_help,
- .aliases = help_aliases,
- .usage = "print online help",
- U_BOOT_CMD_HELP(cmd_help_help)
-U_BOOT_CMD_END
-
static int compare(struct list_head *a, struct list_head *b)
{
char *na = (char*)list_entry(a, cmd_tbl_t, list)->name;
diff --git a/common/module.c b/common/module.c
index 54c40dd..e45c992 100644
--- a/common/module.c
+++ b/common/module.c
@@ -294,6 +294,7 @@ struct module * load_module(void *mod_image, unsigned long len)
numsyms = sechdrs[symindex].sh_size / sizeof(Elf32_Sym);
sym = (void *)sechdrs[symindex].sh_addr;
+#ifdef CONFIG_COMMAND
cmdindex = find_sec(ehdr, sechdrs, secstrings, ".u_boot_cmd");
if (cmdindex) {
cmd_tbl_t *cmd = (cmd_tbl_t *)sechdrs[cmdindex].sh_addr;
@@ -302,6 +303,7 @@ struct module * load_module(void *mod_image, unsigned long len)
cmd++;
}
}
+#endif
for (i = 0; i < numsyms; i++) {
if (!strcmp(strtab + sym[i].st_name, MODULE_SYMBOL_PREFIX "init_module")) {
@@ -322,59 +324,3 @@ cleanup:
return NULL;
}
-
-static int do_lsmod (cmd_tbl_t *cmdtp, int argc, char *argv[])
-{
- struct module *mod;
-
- list_for_each_entry(mod, &module_list, list)
- printf("%s\n", mod->name);
-
- return 0;
-}
-
-U_BOOT_CMD_START(lsmod)
- .maxargs = 1,
- .cmd = do_lsmod,
- .usage = "list modules",
-U_BOOT_CMD_END
-
-static int do_insmod (cmd_tbl_t *cmdtp, int argc, char *argv[])
-{
- struct module *module;
- void *buf;
- int len;
-
- if (argc < 2) {
- u_boot_cmd_usage(cmdtp);
- return 1;
- }
-
- buf = read_file(argv[1], &len);
- if (!buf) {
- perror("insmod");
- return 1;
- }
-
- module = load_module(buf, len);
-
- free(buf);
-
- if (module) {
- if (module->init)
- module->init();
- }
-
- return 0;
-}
-
-static const __maybe_unused char cmd_insmod_help[] =
-"Usage: insmod <module>\n";
-
-U_BOOT_CMD_START(insmod)
- .maxargs = 2,
- .cmd = do_insmod,
- .usage = "insert a module",
- U_BOOT_CMD_HELP(cmd_insmod_help)
-U_BOOT_CMD_END
-