static int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd);
const int len = ll_entry_count(cmd_tbl_t, cmd);
return _do_help(start, len, cmdtp, flag, argc, argv);
+#else
+ return 0;
+#endif
}
U_BOOT_CMD(
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_CMDLINE
/*
* Run a command using the selected parser.
*
return 0;
#endif
}
+#endif /* CONFIG_CMDLINE */
int run_command_list(const char *cmd, int len, int flag)
{
* doing a malloc() which is actually required only in a case that
* is pretty rare.
*/
+#ifdef CONFIG_CMDLINE
rcode = cli_simple_run_command_list(buff, flag);
+#else
+ rcode = board_run_command(buff);
+#endif
#endif
if (need_buff)
free(buff);
*/
void cli_secure_boot_cmd(const char *cmd)
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp;
+#endif
int rc;
if (!cmd) {
disable_ctrlc(1);
/* Find the command directly. */
+#ifdef CONFIG_CMDLINE
cmdtp = find_cmd(cmd);
if (!cmdtp) {
printf("## Error: \"%s\" not defined\n", cmd);
/* Run the command, forcing no flags and faking argc and argv. */
rc = (cmdtp->cmd)(cmdtp, 0, 1, (char **)&cmd);
+#else
+ rc = board_run_command(cmd);
+#endif
+
/* Shouldn't ever return from boot command. */
printf("## Error: \"%s\" returned (code %d)\n", cmd, rc);
parse_file_outer();
/* This point is never reached */
for (;;);
-#else
+#elif defined(CONFIG_CMDINE)
cli_simple_loop();
+#else
+ printf("## U-Boot command line is disabled. Please enable CONFIG_CMDLINE\n");
#endif /*CONFIG_SYS_HUSH_PARSER*/
}
/* find command table entry for a command */
cmd_tbl_t *find_cmd_tbl(const char *cmd, cmd_tbl_t *table, int table_len)
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp;
cmd_tbl_t *cmdtp_temp = table; /* Init value */
const char *p;
if (n_found == 1) { /* exactly one match */
return cmdtp_temp;
}
+#endif /* CONFIG_CMDLINE */
return NULL; /* not found or ambiguous command */
}
static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp = ll_entry_start(cmd_tbl_t, cmd);
const int count = ll_entry_count(cmd_tbl_t, cmd);
const cmd_tbl_t *cmdend = cmdtp + count;
cmdv[n_found] = NULL;
return n_found;
+#else
+ return 0;
+#endif
}
static int make_argv(char *s, int argvsz, char *argv[])
int *repeatable, unsigned long *ticks);
void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
+
+/**
+ * board_run_command() - Fallback function to execute a command
+ *
+ * When no command line features are enabled in U-Boot, this function is
+ * called to execute a command. Typically the function can look at the
+ * command and perform a few very specific tasks, such as booting the
+ * system in a particular way.
+ *
+ * This function is only used when CONFIG_CMDLINE is not enabled.
+ *
+ * In normal situations this function should not return, since U-Boot will
+ * simply hang.
+ *
+ * @cmdline: Command line string to execute
+ * @return 0 if OK, 1 for error
+ */
+int board_run_command(const char *cmdline);
#endif /* __ASSEMBLY__ */
/*