/*
* Boot support
*/
-#include <common.h>
#include <bootm.h>
#include <command.h>
#include <env.h>
static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
+ struct bootm_info bmi;
int ret = 0;
long state;
struct cmd_tbl *c;
return CMD_RET_USAGE;
}
- ret = do_bootm_states(cmdtp, flag, argc, argv, state, &images, 0);
+ bootm_init(&bmi);
+ if (argc)
+ bmi.addr_img = argv[0];
+ if (argc > 1)
+ bmi.conf_ramdisk = argv[1];
+ if (argc > 2)
+ bmi.conf_fdt = argv[2];
+ bmi.cmd_name = "bootm";
+ bmi.boot_progress = false;
+
+ /* set up argc and argv[] since some OSes use them */
+ bmi.argc = argc;
+ bmi.argv = argv;
+
+ ret = bootm_run_states(&bmi, state);
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
if (!ret && (state & BOOTM_STATE_PRE_LOAD))
bootm_get_addr(argc, argv) + image_load_offset);
#endif
- return ret;
+ return ret ? CMD_RET_FAILURE : 0;
}
/*******************************************************************/
int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
- static int relocated = 0;
-
- if (!relocated) {
- int i;
-
- /* relocate names of sub-command table */
- for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++)
- cmd_bootm_sub[i].name += gd->reloc_off;
-
- relocated = 1;
- }
-#endif
+ struct bootm_info bmi;
+ int ret;
/* determine if we have a sub command */
argc--; argv++;
return do_bootm_subcommand(cmdtp, flag, argc, argv);
}
- return do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START |
- BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
- BOOTM_STATE_LOADOS |
-#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
- BOOTM_STATE_RAMDISK |
-#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
- BOOTM_STATE_OS_CMDLINE |
-#endif
- BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
- BOOTM_STATE_OS_GO, &images, 1);
+ bootm_init(&bmi);
+ if (argc)
+ bmi.addr_img = argv[0];
+ if (argc > 1)
+ bmi.conf_ramdisk = argv[1];
+ if (argc > 2)
+ bmi.conf_fdt = argv[2];
+
+ /* set up argc and argv[] since some OSes use them */
+ bmi.argc = argc;
+ bmi.argv = argv;
+
+ ret = bootm_run(&bmi);
+
+ return ret ? CMD_RET_FAILURE : 0;
}
int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
return 0;
}
-#ifdef CONFIG_SYS_LONGHELP
-static char bootm_help_text[] =
+U_BOOT_LONGHELP(bootm,
"[addr [arg ...]]\n - boot application image stored in memory\n"
"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
"\t'arg' can be the address of an initrd image\n"
#if defined(CONFIG_TRACE)
"\tfake - OS specific fake start without go\n"
#endif
- "\tgo - start OS";
-#endif
+ "\tgo - start OS");
U_BOOT_CMD(
bootm, CONFIG_SYS_MAXARGS, 1, do_bootm,
#endif
-
/*******************************************************************/
/* iminfo - print header info for a requested image */
/*******************************************************************/
);
#endif
-
/*******************************************************************/
/* imls - list all images found in flash */
/*******************************************************************/