
Here's an example of how we sould use this. Obviously the code after the if (cmd) would change.
- k
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 3a20ad2..64e7571 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -377,10 +377,23 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) return 0; }
+cmd_tbl_t cmd_bootm_sub[] = { + U_BOOT_CMD_INIT(start, CFG_MAXARGS, 1, BOOTM_STATE_START, "", ""), + U_BOOT_CMD_INIT(loados, CFG_MAXARGS, 1, BOOTM_STATE_LOADOS, "", ""), + U_BOOT_CMD_INIT(ramdisk, CFG_MAXARGS, 1, BOOTM_STATE_RAMDISK, "", ""), +}; + + int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int ret = 0; int state; + cmd_tbl_t *cmd; + + cmd = __find_cmd(argv[1], &cmd_bootm_sub[0], ARRAY_SIZE(cmd_bootm_sub)); + + if (cmd) + printf("%s %d\n", cmd->name, cmd->cmd);
/* start */ if (strcmp(argv[1], "start") == 0) {