Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dba981ae2 | ||
|
|
c1029ccbf8 |
@@ -53,7 +53,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
|
|||||||
{
|
{
|
||||||
ulong kernel_entry;
|
ulong kernel_entry;
|
||||||
unsigned int r0, r2;
|
unsigned int r0, r2;
|
||||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
int fake = (flag & BOOTMS_OS_FAKE_GO);
|
||||||
|
|
||||||
kernel_entry = images->ep;
|
kernel_entry = images->ep;
|
||||||
|
|
||||||
@@ -84,13 +84,13 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
/* No need for those on ARC */
|
/* No need for those on ARC */
|
||||||
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
|
if ((flag & BOOTMS_OS_BD_T) || (flag & BOOTMS_OS_CMDLINE))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return boot_prep_linux(images);
|
return boot_prep_linux(images);
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
boot_jump_linux(images, flag);
|
boot_jump_linux(images, flag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
|
|||||||
#ifdef CONFIG_ARM64
|
#ifdef CONFIG_ARM64
|
||||||
void (*kernel_entry)(void *fdt_addr, void *res0, void *res1,
|
void (*kernel_entry)(void *fdt_addr, void *res0, void *res1,
|
||||||
void *res2);
|
void *res2);
|
||||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
int fake = (flag & BOOTMS_OS_FAKE_GO);
|
||||||
|
|
||||||
kernel_entry = (void (*)(void *fdt_addr, void *res0, void *res1,
|
kernel_entry = (void (*)(void *fdt_addr, void *res0, void *res1,
|
||||||
void *res2))images->ep;
|
void *res2))images->ep;
|
||||||
@@ -335,7 +335,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
|
|||||||
char *s;
|
char *s;
|
||||||
void (*kernel_entry)(int zero, int arch, uint params);
|
void (*kernel_entry)(int zero, int arch, uint params);
|
||||||
unsigned long r2;
|
unsigned long r2;
|
||||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
int fake = (flag & BOOTMS_OS_FAKE_GO);
|
||||||
|
|
||||||
kernel_entry = (void (*)(int, int, uint))images->ep;
|
kernel_entry = (void (*)(int, int, uint))images->ep;
|
||||||
#ifdef CONFIG_CPU_V7M
|
#ifdef CONFIG_CPU_V7M
|
||||||
@@ -385,15 +385,15 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
/* No need for those on ARM */
|
/* No need for those on ARM */
|
||||||
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
|
if (flag & BOOTMS_OS_BD_T || flag & BOOTMS_OS_CMDLINE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP) {
|
if (flag & BOOTMS_OS_PREP) {
|
||||||
boot_prep_linux(images);
|
boot_prep_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
boot_jump_linux(images, flag);
|
boot_jump_linux(images, flag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
/*
|
/*
|
||||||
* allow the PREP bootm subcommand, it is required for bootm to work
|
* allow the PREP bootm subcommand, it is required for bootm to work
|
||||||
*/
|
*/
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
|
if ((flag != 0) && (flag != BOOTMS_OS_GO))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* allocate space for kernel copy of board info */
|
/* allocate space for kernel copy of board info */
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
|
|||||||
ulong dt = (ulong)images->ft_addr;
|
ulong dt = (ulong)images->ft_addr;
|
||||||
ulong rd_start = images->initrd_start;
|
ulong rd_start = images->initrd_start;
|
||||||
ulong cmdline = images->cmdline_start;
|
ulong cmdline = images->cmdline_start;
|
||||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
int fake = (flag & BOOTMS_OS_FAKE_GO);
|
||||||
|
|
||||||
thekernel = (void (*)(char *, ulong, ulong))images->ep;
|
thekernel = (void (*)(char *, ulong, ulong))images->ep;
|
||||||
|
|
||||||
@@ -75,15 +75,15 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
images->cmdline_start = (ulong)env_get("bootargs");
|
images->cmdline_start = (ulong)env_get("bootargs");
|
||||||
|
|
||||||
/* cmdline init is the part of 'prep' and nothing to do for 'bdt' */
|
/* cmdline init is the part of 'prep' and nothing to do for 'bdt' */
|
||||||
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
|
if (flag & BOOTMS_OS_BD_T || flag & BOOTMS_OS_CMDLINE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP) {
|
if (flag & BOOTMS_OS_PREP) {
|
||||||
boot_prep_linux(images);
|
boot_prep_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
boot_jump_linux(images, flag);
|
boot_jump_linux(images, flag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ static int boot_reloc_fdt(struct bootm_headers *images)
|
|||||||
* In case of legacy uImage's, relocation of FDT is already done
|
* In case of legacy uImage's, relocation of FDT is already done
|
||||||
* by bootm_run_states() and should not repeated in 'bootm prep'.
|
* by bootm_run_states() and should not repeated in 'bootm prep'.
|
||||||
*/
|
*/
|
||||||
if (images->state & BOOTM_STATE_FDT) {
|
if (images->state & BOOTMS_FDT) {
|
||||||
debug("## FDT already relocated\n");
|
debug("## FDT already relocated\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
/* No need for those on MIPS */
|
/* No need for those on MIPS */
|
||||||
if (flag & BOOTM_STATE_OS_BD_T)
|
if (flag & BOOTMS_OS_BD_T)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -298,15 +298,15 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
* done after relocation of ramdisk to always pass correct values
|
* done after relocation of ramdisk to always pass correct values
|
||||||
* for rd_start and rd_size to Linux kernel.
|
* for rd_start and rd_size to Linux kernel.
|
||||||
*/
|
*/
|
||||||
if (flag & BOOTM_STATE_OS_CMDLINE)
|
if (flag & BOOTMS_OS_CMDLINE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP) {
|
if (flag & BOOTMS_OS_PREP) {
|
||||||
boot_prep_linux(images);
|
boot_prep_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
boot_jump_linux(images);
|
boot_jump_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
/*
|
/*
|
||||||
* allow the PREP bootm subcommand, it is required for bootm to work
|
* allow the PREP bootm subcommand, it is required for bootm to work
|
||||||
*/
|
*/
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
|
if ((flag != 0) && (flag != BOOTMS_OS_GO))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* flushes data and instruction caches before calling the kernel */
|
/* flushes data and instruction caches before calling the kernel */
|
||||||
|
|||||||
@@ -185,17 +185,17 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_CMDLINE) {
|
if (flag & BOOTMS_OS_CMDLINE) {
|
||||||
boot_cmdline_linux(images);
|
boot_cmdline_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_BD_T) {
|
if (flag & BOOTMS_OS_BD_T) {
|
||||||
boot_bd_t_linux(images);
|
boot_bd_t_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP) {
|
if (flag & BOOTMS_OS_PREP) {
|
||||||
boot_prep_linux(images);
|
boot_prep_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ static void boot_prep_linux(struct bootm_headers *images)
|
|||||||
static void boot_jump_linux(struct bootm_headers *images, int flag)
|
static void boot_jump_linux(struct bootm_headers *images, int flag)
|
||||||
{
|
{
|
||||||
void (*kernel)(ulong hart, void *dtb);
|
void (*kernel)(ulong hart, void *dtb);
|
||||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
int fake = (flag & BOOTMS_OS_FAKE_GO);
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
int ret;
|
int ret;
|
||||||
#endif
|
#endif
|
||||||
@@ -111,15 +111,15 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
/* No need for those on RISC-V */
|
/* No need for those on RISC-V */
|
||||||
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
|
if (flag & BOOTMS_OS_BD_T || flag & BOOTMS_OS_CMDLINE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP) {
|
if (flag & BOOTMS_OS_PREP) {
|
||||||
boot_prep_linux(images);
|
boot_prep_linux(images);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
boot_jump_linux(images, flag);
|
boot_jump_linux(images, flag);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
{
|
{
|
||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return boot_prep_linux(images);
|
return boot_prep_linux(images);
|
||||||
|
|
||||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
if (flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)) {
|
||||||
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
||||||
printf("## Transferring control to Linux (at address %08lx)...\n",
|
printf("## Transferring control to Linux (at address %08lx)...\n",
|
||||||
images->ep);
|
images->ep);
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
/*
|
/*
|
||||||
* allow the PREP bootm subcommand, it is required for bootm to work
|
* allow the PREP bootm subcommand, it is required for bootm to work
|
||||||
*/
|
*/
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
|
if ((flag != 0) && (flag != BOOTMS_OS_GO))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Clear zero page */
|
/* Clear zero page */
|
||||||
|
|||||||
@@ -269,13 +269,13 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
/* No need for those on x86 */
|
/* No need for those on x86 */
|
||||||
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
|
if (flag & BOOTMS_OS_BD_T || flag & BOOTMS_OS_CMDLINE)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
return boot_prep_linux(images);
|
return boot_prep_linux(images);
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_GO)
|
if (flag & BOOTMS_OS_GO)
|
||||||
return boot_jump_linux(images);
|
return boot_jump_linux(images);
|
||||||
|
|
||||||
return boot_jump_linux(images);
|
return boot_jump_linux(images);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
ulong initrd_start, initrd_end;
|
ulong initrd_start, initrd_end;
|
||||||
char *commandline = env_get("bootargs");
|
char *commandline = env_get("bootargs");
|
||||||
|
|
||||||
if (!(flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)))
|
if (!(flag & (BOOTMS_OS_GO | BOOTMS_OS_FAKE_GO)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
show_boot_progress(15);
|
show_boot_progress(15);
|
||||||
@@ -180,7 +180,7 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)
|
|||||||
|
|
||||||
flush_dcache_range((unsigned long)params_start, (unsigned long)params);
|
flush_dcache_range((unsigned long)params_start, (unsigned long)params);
|
||||||
|
|
||||||
if (flag & BOOTM_STATE_OS_FAKE_GO)
|
if (flag & BOOTMS_OS_FAKE_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
82
boot/bootm.c
82
boot/bootm.c
@@ -253,7 +253,7 @@ static int bootm_start(void)
|
|||||||
images.verify = env_get_yesno("verify");
|
images.verify = env_get_yesno("verify");
|
||||||
|
|
||||||
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_START, "bootm_start");
|
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_START, "bootm_start");
|
||||||
images.state = BOOTM_STATE_START;
|
images.state = BOOTMS_START;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -760,7 +760,7 @@ static int bootm_load_os(struct bootm_info *bmi, int boot_progress)
|
|||||||
return BOOTM_ERR_RESET;
|
return BOOTM_ERR_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle BOOTM_STATE_LOADOS */
|
/* Handle BOOTMS_LOADOS */
|
||||||
if (relocated_addr != load) {
|
if (relocated_addr != load) {
|
||||||
printf("Moving Image from 0x%lx to 0x%lx, end=0x%lx\n",
|
printf("Moving Image from 0x%lx to 0x%lx, end=0x%lx\n",
|
||||||
load, relocated_addr,
|
load, relocated_addr,
|
||||||
@@ -1052,16 +1052,16 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
* Work through the states and see how far we get. We stop on
|
* Work through the states and see how far we get. We stop on
|
||||||
* any error.
|
* any error.
|
||||||
*/
|
*/
|
||||||
if (states & BOOTM_STATE_START)
|
if (states & BOOTMS_START)
|
||||||
ret = bootm_start();
|
ret = bootm_start();
|
||||||
|
|
||||||
if (!ret && (states & BOOTM_STATE_PRE_LOAD))
|
if (!ret && (states & BOOTMS_PRE_LOAD))
|
||||||
ret = bootm_pre_load(bmi->addr_img);
|
ret = bootm_pre_load(bmi->addr_img);
|
||||||
|
|
||||||
if (!ret && (states & BOOTM_STATE_FINDOS))
|
if (!ret && (states & BOOTMS_FINDOS))
|
||||||
ret = bootm_find_os(bmi->cmd_name, bmi->addr_img);
|
ret = bootm_find_os(bmi->cmd_name, bmi->addr_img);
|
||||||
|
|
||||||
if (!ret && (states & BOOTM_STATE_FINDOTHER)) {
|
if (!ret && (states & BOOTMS_FINDOTHER)) {
|
||||||
ulong img_addr;
|
ulong img_addr;
|
||||||
|
|
||||||
img_addr = bmi->addr_img ? hextoul(bmi->addr_img, NULL)
|
img_addr = bmi->addr_img ? hextoul(bmi->addr_img, NULL)
|
||||||
@@ -1071,11 +1071,11 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_MEASURED_BOOT) && !ret &&
|
if (IS_ENABLED(CONFIG_MEASURED_BOOT) && !ret &&
|
||||||
(states & BOOTM_STATE_MEASURE))
|
(states & BOOTMS_MEASURE))
|
||||||
bootm_measure(images);
|
bootm_measure(images);
|
||||||
|
|
||||||
/* Load the OS */
|
/* Load the OS */
|
||||||
if (!ret && (states & BOOTM_STATE_LOADOS)) {
|
if (!ret && (states & BOOTMS_LOADOS)) {
|
||||||
iflag = bootm_disable_interrupts();
|
iflag = bootm_disable_interrupts();
|
||||||
board_fixup_os(&images->os);
|
board_fixup_os(&images->os);
|
||||||
ret = bootm_load_os(bmi, 0);
|
ret = bootm_load_os(bmi, 0);
|
||||||
@@ -1087,7 +1087,7 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
|
|
||||||
/* Relocate the ramdisk */
|
/* Relocate the ramdisk */
|
||||||
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
|
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||||
if (!ret && (states & BOOTM_STATE_RAMDISK)) {
|
if (!ret && (states & BOOTMS_RAMDISK)) {
|
||||||
ulong rd_len = images->rd_end - images->rd_start;
|
ulong rd_len = images->rd_end - images->rd_start;
|
||||||
|
|
||||||
ret = boot_ramdisk_high(images->rd_start, rd_len,
|
ret = boot_ramdisk_high(images->rd_start, rd_len,
|
||||||
@@ -1100,7 +1100,7 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB)
|
#if CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB)
|
||||||
if (!ret && (states & BOOTM_STATE_FDT)) {
|
if (!ret && (states & BOOTMS_FDT)) {
|
||||||
boot_fdt_add_mem_rsv_regions(images->ft_addr);
|
boot_fdt_add_mem_rsv_regions(images->ft_addr);
|
||||||
ret = boot_relocate_fdt(&images->ft_addr, &images->ft_len);
|
ret = boot_relocate_fdt(&images->ft_addr, &images->ft_len);
|
||||||
}
|
}
|
||||||
@@ -1110,9 +1110,9 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
boot_fn = bootm_os_get_boot_func(images->os.os);
|
boot_fn = bootm_os_get_boot_func(images->os.os);
|
||||||
need_boot_fn = states & (BOOTM_STATE_OS_CMDLINE |
|
need_boot_fn = states & (BOOTMS_OS_CMDLINE |
|
||||||
BOOTM_STATE_OS_BD_T | BOOTM_STATE_OS_PREP |
|
BOOTMS_OS_BD_T | BOOTMS_OS_PREP |
|
||||||
BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO);
|
BOOTMS_OS_FAKE_GO | BOOTMS_OS_GO);
|
||||||
if (boot_fn == NULL && need_boot_fn) {
|
if (boot_fn == NULL && need_boot_fn) {
|
||||||
if (iflag)
|
if (iflag)
|
||||||
enable_interrupts();
|
enable_interrupts();
|
||||||
@@ -1123,11 +1123,11 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call various other states that are not generally used */
|
/* Call various other states that are not generally used */
|
||||||
if (!ret && (states & BOOTM_STATE_OS_CMDLINE))
|
if (!ret && (states & BOOTMS_OS_CMDLINE))
|
||||||
ret = boot_fn(BOOTM_STATE_OS_CMDLINE, bmi);
|
ret = boot_fn(BOOTMS_OS_CMDLINE, bmi);
|
||||||
if (!ret && (states & BOOTM_STATE_OS_BD_T))
|
if (!ret && (states & BOOTMS_OS_BD_T))
|
||||||
ret = boot_fn(BOOTM_STATE_OS_BD_T, bmi);
|
ret = boot_fn(BOOTMS_OS_BD_T, bmi);
|
||||||
if (!ret && (states & BOOTM_STATE_OS_PREP)) {
|
if (!ret && (states & BOOTMS_OS_PREP)) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
/* For Linux OS do all substitutions at console processing */
|
/* For Linux OS do all substitutions at console processing */
|
||||||
if (images->os.os == IH_OS_LINUX)
|
if (images->os.os == IH_OS_LINUX)
|
||||||
@@ -1138,15 +1138,15 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
ret = CMD_RET_FAILURE;
|
ret = CMD_RET_FAILURE;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ret = boot_fn(BOOTM_STATE_OS_PREP, bmi);
|
ret = boot_fn(BOOTMS_OS_PREP, bmi);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_TRACE
|
#ifdef CONFIG_TRACE
|
||||||
/* Pretend to run the OS, then run a user command */
|
/* Pretend to run the OS, then run a user command */
|
||||||
if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
|
if (!ret && (states & BOOTMS_OS_FAKE_GO)) {
|
||||||
char *cmd_list = env_get("fakegocmd");
|
char *cmd_list = env_get("fakegocmd");
|
||||||
|
|
||||||
ret = boot_selected_os(BOOTM_STATE_OS_FAKE_GO, bmi, boot_fn);
|
ret = boot_selected_os(BOOTMS_OS_FAKE_GO, bmi, boot_fn);
|
||||||
if (!ret && cmd_list)
|
if (!ret && cmd_list)
|
||||||
ret = run_command_list(cmd_list, -1, 0);
|
ret = run_command_list(cmd_list, -1, 0);
|
||||||
}
|
}
|
||||||
@@ -1159,8 +1159,8 @@ int bootm_run_states(struct bootm_info *bmi, int states)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now run the OS! We hope this doesn't return */
|
/* Now run the OS! We hope this doesn't return */
|
||||||
if (!ret && (states & BOOTM_STATE_OS_GO))
|
if (!ret && (states & BOOTMS_OS_GO))
|
||||||
ret = boot_selected_os(BOOTM_STATE_OS_GO, bmi, boot_fn);
|
ret = boot_selected_os(BOOTMS_OS_GO, bmi, boot_fn);
|
||||||
|
|
||||||
/* Deal with any fallout */
|
/* Deal with any fallout */
|
||||||
err:
|
err:
|
||||||
@@ -1182,10 +1182,10 @@ int boot_run(struct bootm_info *bmi, const char *cmd, int extra_states)
|
|||||||
int states;
|
int states;
|
||||||
|
|
||||||
bmi->cmd_name = cmd;
|
bmi->cmd_name = cmd;
|
||||||
states = BOOTM_STATE_MEASURE | BOOTM_STATE_OS_PREP |
|
states = BOOTMS_MEASURE | BOOTMS_OS_PREP |
|
||||||
BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO;
|
BOOTMS_OS_FAKE_GO | BOOTMS_OS_GO;
|
||||||
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
||||||
states |= BOOTM_STATE_RAMDISK;
|
states |= BOOTMS_RAMDISK;
|
||||||
states |= extra_states;
|
states |= extra_states;
|
||||||
|
|
||||||
log_debug("cmd '%s' states %x addr_img '%s' conf_ramdisk '%s' conf_fdt '%s' images %p\n",
|
log_debug("cmd '%s' states %x addr_img '%s' conf_ramdisk '%s' conf_fdt '%s' images %p\n",
|
||||||
@@ -1197,9 +1197,9 @@ int boot_run(struct bootm_info *bmi, const char *cmd, int extra_states)
|
|||||||
|
|
||||||
int bootm_run(struct bootm_info *bmi)
|
int bootm_run(struct bootm_info *bmi)
|
||||||
{
|
{
|
||||||
return boot_run(bmi, "bootm", BOOTM_STATE_START | BOOTM_STATE_FINDOS |
|
return boot_run(bmi, "bootm", BOOTMS_START | BOOTMS_FINDOS |
|
||||||
BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
|
BOOTMS_PRE_LOAD | BOOTMS_FINDOTHER |
|
||||||
BOOTM_STATE_LOADOS);
|
BOOTMS_LOADOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bootz_run(struct bootm_info *bmi)
|
int bootz_run(struct bootm_info *bmi)
|
||||||
@@ -1208,7 +1208,7 @@ int bootz_run(struct bootm_info *bmi)
|
|||||||
ulong zi_start, zi_end;
|
ulong zi_start, zi_end;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = bootm_run_states(bmi, BOOTM_STATE_START);
|
ret = bootm_run_states(bmi, BOOTMS_START);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -1222,7 +1222,7 @@ int bootz_run(struct bootm_info *bmi)
|
|||||||
lmb_reserve(images->ep, zi_end - zi_start);
|
lmb_reserve(images->ep, zi_end - zi_start);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
|
* Handle the BOOTMS_FINDOTHER state ourselves as we do not
|
||||||
* have a header that provide this informaiton.
|
* have a header that provide this informaiton.
|
||||||
*/
|
*/
|
||||||
if (bootm_find_images(images->ep, bmi->conf_ramdisk, bmi->conf_fdt,
|
if (bootm_find_images(images->ep, bmi->conf_ramdisk, bmi->conf_fdt,
|
||||||
@@ -1230,7 +1230,7 @@ int bootz_run(struct bootm_info *bmi)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are doing the BOOTM_STATE_LOADOS state ourselves, so must
|
* We are doing the BOOTMS_LOADOS state ourselves, so must
|
||||||
* disable interrupts ourselves
|
* disable interrupts ourselves
|
||||||
*/
|
*/
|
||||||
bootm_disable_interrupts();
|
bootm_disable_interrupts();
|
||||||
@@ -1244,9 +1244,9 @@ int booti_run(struct bootm_info *bmi)
|
|||||||
{
|
{
|
||||||
bmi->ignore_bootm_len = true;
|
bmi->ignore_bootm_len = true;
|
||||||
|
|
||||||
return boot_run(bmi, "booti", BOOTM_STATE_START | BOOTM_STATE_FINDOS |
|
return boot_run(bmi, "booti", BOOTMS_START | BOOTMS_FINDOS |
|
||||||
BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
|
BOOTMS_PRE_LOAD | BOOTMS_FINDOTHER |
|
||||||
BOOTM_STATE_LOADOS);
|
BOOTMS_LOADOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bootm_boot_start(ulong addr, const char *cmdline)
|
int bootm_boot_start(ulong addr, const char *cmdline)
|
||||||
@@ -1256,14 +1256,14 @@ int bootm_boot_start(ulong addr, const char *cmdline)
|
|||||||
int states;
|
int states;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD |
|
states = BOOTMS_START | BOOTMS_FINDOS | BOOTMS_PRE_LOAD |
|
||||||
BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS |
|
BOOTMS_FINDOTHER | BOOTMS_LOADOS |
|
||||||
BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
|
BOOTMS_OS_PREP | BOOTMS_OS_FAKE_GO |
|
||||||
BOOTM_STATE_OS_GO;
|
BOOTMS_OS_GO;
|
||||||
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
||||||
states |= BOOTM_STATE_RAMDISK;
|
states |= BOOTMS_RAMDISK;
|
||||||
if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
|
if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
|
||||||
states |= BOOTM_STATE_OS_CMDLINE;
|
states |= BOOTMS_OS_CMDLINE;
|
||||||
images.state |= states;
|
images.state |= states;
|
||||||
|
|
||||||
snprintf(addr_str, sizeof(addr_str), "%lx", addr);
|
snprintf(addr_str, sizeof(addr_str), "%lx", addr);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ static int do_bootm_netbsd(int flag, struct bootm_info *bmi)
|
|||||||
ulong kernel_data, kernel_len;
|
ulong kernel_data, kernel_len;
|
||||||
char *cmdline;
|
char *cmdline;
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -142,7 +142,7 @@ static int do_bootm_rtems(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
void (*entry_point)(struct bd_info *);
|
void (*entry_point)(struct bd_info *);
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -175,7 +175,7 @@ static int do_bootm_ose(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
void (*entry_point)(void);
|
void (*entry_point)(void);
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -209,7 +209,7 @@ static int do_bootm_plan9(int flag, struct bootm_info *bmi)
|
|||||||
void (*entry_point)(void);
|
void (*entry_point)(void);
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -314,7 +314,7 @@ static int do_bootm_vxworks_legacy(int flag, struct bootm_info *bmi)
|
|||||||
{
|
{
|
||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
do_bootvx_fdt(images);
|
do_bootvx_fdt(images);
|
||||||
@@ -345,11 +345,11 @@ int do_bootm_vxworks(int flag, struct bootm_info *bmi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (std_dtb) {
|
if (std_dtb) {
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
printf(" Using standard DTB\n");
|
printf(" Using standard DTB\n");
|
||||||
return do_bootm_linux(flag, bmi);
|
return do_bootm_linux(flag, bmi);
|
||||||
} else {
|
} else {
|
||||||
if (flag & BOOTM_STATE_OS_PREP)
|
if (flag & BOOTMS_OS_PREP)
|
||||||
printf(" !!! WARNING !!! Using legacy DTB\n");
|
printf(" !!! WARNING !!! Using legacy DTB\n");
|
||||||
return do_bootm_vxworks_legacy(flag, bmi);
|
return do_bootm_vxworks_legacy(flag, bmi);
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ static int do_bootm_qnxelf(int flag, struct bootm_info *bmi)
|
|||||||
char str[16];
|
char str[16];
|
||||||
int dcache;
|
int dcache;
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -399,7 +399,7 @@ static int do_bootm_elf(int flag, struct bootm_info *bmi)
|
|||||||
{
|
{
|
||||||
Bootelf_flags flags = { .autostart = 1 };
|
Bootelf_flags flags = { .autostart = 1 };
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bootelf(bmi->images->ep, flags, 0, NULL);
|
bootelf(bmi->images->ep, flags, 0, NULL);
|
||||||
@@ -414,7 +414,7 @@ static int do_bootm_integrity(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
void (*entry_point)(void);
|
void (*entry_point)(void);
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FIT)
|
#if defined(CONFIG_FIT)
|
||||||
@@ -447,7 +447,7 @@ static int do_bootm_openrtos(int flag, struct bootm_info *bmi)
|
|||||||
struct bootm_headers *images = bmi->images;
|
struct bootm_headers *images = bmi->images;
|
||||||
void (*entry_point)(void);
|
void (*entry_point)(void);
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
entry_point = (void (*)(void))images->ep;
|
entry_point = (void (*)(void))images->ep;
|
||||||
@@ -492,7 +492,7 @@ static int do_bootm_efi(int flag, struct bootm_info *bmi)
|
|||||||
int ret;
|
int ret;
|
||||||
void *image_buf;
|
void *image_buf;
|
||||||
|
|
||||||
if (flag != BOOTM_STATE_OS_GO)
|
if (flag != BOOTMS_OS_GO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* We expect to return */
|
/* We expect to return */
|
||||||
@@ -578,7 +578,7 @@ int boot_selected_os(int state, struct bootm_info *bmi, boot_os_fn *boot_fn)
|
|||||||
/* Stand-alone may return when 'autostart' is 'no' */
|
/* Stand-alone may return when 'autostart' is 'no' */
|
||||||
if (bmi->images->os.type == IH_TYPE_STANDALONE ||
|
if (bmi->images->os.type == IH_TYPE_STANDALONE ||
|
||||||
IS_ENABLED(CONFIG_SANDBOX) ||
|
IS_ENABLED(CONFIG_SANDBOX) ||
|
||||||
state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */
|
state == BOOTMS_OS_FAKE_GO) /* We expect to return */
|
||||||
return 0;
|
return 0;
|
||||||
bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
|
bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
|
||||||
debug("\n## Control returned to monitor - resetting...\n");
|
debug("\n## Control returned to monitor - resetting...\n");
|
||||||
|
|||||||
14
cmd/booti.c
14
cmd/booti.c
@@ -33,7 +33,7 @@ static int booti_start(struct bootm_info *bmi)
|
|||||||
unsigned long decomp_len;
|
unsigned long decomp_len;
|
||||||
int ctype;
|
int ctype;
|
||||||
|
|
||||||
ret = bootm_run_states(bmi, BOOTM_STATE_START);
|
ret = bootm_run_states(bmi, BOOTMS_START);
|
||||||
|
|
||||||
/* Setup Linux kernel Image entry point */
|
/* Setup Linux kernel Image entry point */
|
||||||
if (!bmi->addr_img) {
|
if (!bmi->addr_img) {
|
||||||
@@ -76,7 +76,7 @@ static int booti_start(struct bootm_info *bmi)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Handle BOOTM_STATE_LOADOS */
|
/* Handle BOOTMS_LOADOS */
|
||||||
if (relocated_addr != ld) {
|
if (relocated_addr != ld) {
|
||||||
printf("Moving Image from 0x%lx to 0x%lx, end=0x%lx\n", ld,
|
printf("Moving Image from 0x%lx to 0x%lx, end=0x%lx\n", ld,
|
||||||
relocated_addr, relocated_addr + image_size);
|
relocated_addr, relocated_addr + image_size);
|
||||||
@@ -90,7 +90,7 @@ static int booti_start(struct bootm_info *bmi)
|
|||||||
lmb_reserve(images->ep, le32_to_cpu(image_size));
|
lmb_reserve(images->ep, le32_to_cpu(image_size));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
|
* Handle the BOOTMS_FINDOTHER state ourselves as we do not
|
||||||
* have a header that provide this informaiton.
|
* have a header that provide this informaiton.
|
||||||
*/
|
*/
|
||||||
if (bootm_find_images(image_load_addr, bmi->conf_ramdisk, bmi->conf_fdt,
|
if (bootm_find_images(image_load_addr, bmi->conf_ramdisk, bmi->conf_fdt,
|
||||||
@@ -125,7 +125,7 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are doing the BOOTM_STATE_LOADOS state ourselves, so must
|
* We are doing the BOOTMS_LOADOS state ourselves, so must
|
||||||
* disable interrupts ourselves
|
* disable interrupts ourselves
|
||||||
*/
|
*/
|
||||||
bootm_disable_interrupts();
|
bootm_disable_interrupts();
|
||||||
@@ -136,10 +136,10 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||||||
else if (IS_ENABLED(CONFIG_ARM64))
|
else if (IS_ENABLED(CONFIG_ARM64))
|
||||||
images.os.arch = IH_ARCH_ARM64;
|
images.os.arch = IH_ARCH_ARM64;
|
||||||
|
|
||||||
states = BOOTM_STATE_MEASURE | BOOTM_STATE_OS_PREP |
|
states = BOOTMS_MEASURE | BOOTMS_OS_PREP |
|
||||||
BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO;
|
BOOTMS_OS_FAKE_GO | BOOTMS_OS_GO;
|
||||||
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
|
||||||
states |= BOOTM_STATE_RAMDISK;
|
states |= BOOTMS_RAMDISK;
|
||||||
|
|
||||||
ret = bootm_run_states(&bmi, states);
|
ret = bootm_run_states(&bmi, states);
|
||||||
|
|
||||||
|
|||||||
34
cmd/bootm.c
34
cmd/bootm.c
@@ -40,22 +40,22 @@ static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
/* we overload the cmd field with our state machine info instead of a
|
/* we overload the cmd field with our state machine info instead of a
|
||||||
* function pointer */
|
* function pointer */
|
||||||
static struct cmd_tbl cmd_bootm_sub[] = {
|
static struct cmd_tbl cmd_bootm_sub[] = {
|
||||||
U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
|
U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTMS_START, "", ""),
|
||||||
U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
|
U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTMS_LOADOS, "", ""),
|
||||||
#ifdef CONFIG_CMD_BOOTM_PRE_LOAD
|
#ifdef CONFIG_CMD_BOOTM_PRE_LOAD
|
||||||
U_BOOT_CMD_MKENT(preload, 0, 1, (void *)BOOTM_STATE_PRE_LOAD, "", ""),
|
U_BOOT_CMD_MKENT(preload, 0, 1, (void *)BOOTMS_PRE_LOAD, "", ""),
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
|
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||||
U_BOOT_CMD_MKENT(ramdisk, 0, 1, (void *)BOOTM_STATE_RAMDISK, "", ""),
|
U_BOOT_CMD_MKENT(ramdisk, 0, 1, (void *)BOOTMS_RAMDISK, "", ""),
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_OF_LIBFDT
|
#ifdef CONFIG_OF_LIBFDT
|
||||||
U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)BOOTM_STATE_FDT, "", ""),
|
U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)BOOTMS_FDT, "", ""),
|
||||||
#endif
|
#endif
|
||||||
U_BOOT_CMD_MKENT(cmdline, 0, 1, (void *)BOOTM_STATE_OS_CMDLINE, "", ""),
|
U_BOOT_CMD_MKENT(cmdline, 0, 1, (void *)BOOTMS_OS_CMDLINE, "", ""),
|
||||||
U_BOOT_CMD_MKENT(bdt, 0, 1, (void *)BOOTM_STATE_OS_BD_T, "", ""),
|
U_BOOT_CMD_MKENT(bdt, 0, 1, (void *)BOOTMS_OS_BD_T, "", ""),
|
||||||
U_BOOT_CMD_MKENT(prep, 0, 1, (void *)BOOTM_STATE_OS_PREP, "", ""),
|
U_BOOT_CMD_MKENT(prep, 0, 1, (void *)BOOTMS_OS_PREP, "", ""),
|
||||||
U_BOOT_CMD_MKENT(fake, 0, 1, (void *)BOOTM_STATE_OS_FAKE_GO, "", ""),
|
U_BOOT_CMD_MKENT(fake, 0, 1, (void *)BOOTMS_OS_FAKE_GO, "", ""),
|
||||||
U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""),
|
U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTMS_OS_GO, "", ""),
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
||||||
@@ -85,19 +85,19 @@ static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
|
|
||||||
if (c) {
|
if (c) {
|
||||||
state = (long)c->cmd;
|
state = (long)c->cmd;
|
||||||
if (state == BOOTM_STATE_START)
|
if (state == BOOTMS_START)
|
||||||
state |= BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOS |
|
state |= BOOTMS_PRE_LOAD | BOOTMS_FINDOS |
|
||||||
BOOTM_STATE_FINDOTHER;
|
BOOTMS_FINDOTHER;
|
||||||
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
||||||
if (state == BOOTM_STATE_PRE_LOAD)
|
if (state == BOOTMS_PRE_LOAD)
|
||||||
state |= BOOTM_STATE_START;
|
state |= BOOTMS_START;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* Unrecognized command */
|
/* Unrecognized command */
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((state & BOOTM_STATE_START) != BOOTM_STATE_START) &&
|
if (((state & BOOTMS_START) != BOOTMS_START) &&
|
||||||
images.state >= state) {
|
images.state >= state) {
|
||||||
printf("Trying to execute a command out of order\n");
|
printf("Trying to execute a command out of order\n");
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
@@ -120,7 +120,7 @@ static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
ret = bootm_run_states(&bmi, state);
|
ret = bootm_run_states(&bmi, state);
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
#if defined(CONFIG_CMD_BOOTM_PRE_LOAD)
|
||||||
if (!ret && (state & BOOTM_STATE_PRE_LOAD))
|
if (!ret && (state & BOOTMS_PRE_LOAD))
|
||||||
env_set_hex("loadaddr_verified",
|
env_set_hex("loadaddr_verified",
|
||||||
bootm_get_addr(argc, argv) + image_load_offset);
|
bootm_get_addr(argc, argv) + image_load_offset);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ void bootm_init(struct bootm_info *bmi);
|
|||||||
* - loaded (first part of) image to header load address,
|
* - loaded (first part of) image to header load address,
|
||||||
* - disabled interrupts.
|
* - disabled interrupts.
|
||||||
*
|
*
|
||||||
* @flag: Flags indicating what to do (BOOTM_STATE_...)
|
* @flag: Flags indicating what to do (BOOTMS_...)
|
||||||
* @bmi: Bootm information
|
* @bmi: Bootm information
|
||||||
* Return: 1 on error. On success the OS boots so this function does
|
* Return: 1 on error. On success the OS boots so this function does
|
||||||
* not return.
|
* not return.
|
||||||
@@ -180,7 +180,7 @@ int bootm_measure(struct bootm_headers *images);
|
|||||||
* bootm_run_states() - Execute selected states of the bootm command.
|
* bootm_run_states() - Execute selected states of the bootm command.
|
||||||
*
|
*
|
||||||
* Note that if states contains more than one flag it MUST contain
|
* Note that if states contains more than one flag it MUST contain
|
||||||
* BOOTM_STATE_START, since this handles the addr_fit, conf_ramdisk and conf_fit
|
* BOOTMS_START, since this handles the addr_fit, conf_ramdisk and conf_fit
|
||||||
* members of @bmi
|
* members of @bmi
|
||||||
*
|
*
|
||||||
* Also note that aside from boot_os_fn functions and bootm_load_os, no other
|
* Also note that aside from boot_os_fn functions and bootm_load_os, no other
|
||||||
@@ -188,9 +188,9 @@ int bootm_measure(struct bootm_headers *images);
|
|||||||
* value, without special handling.
|
* value, without special handling.
|
||||||
*
|
*
|
||||||
* @bmi: bootm information
|
* @bmi: bootm information
|
||||||
* @states Mask containing states to run (BOOTM_STATE_...)
|
* @states Mask containing states to run (BOOTMS_...)
|
||||||
* Return: 0 if ok, something else on error. Some errors will cause this
|
* Return: 0 if ok, something else on error. Some errors will cause this
|
||||||
* function to perform a reboot! If states contains BOOTM_STATE_OS_GO
|
* function to perform a reboot! If states contains BOOTMS_OS_GO
|
||||||
* then the intent is to boot an OS, so this function will not return
|
* then the intent is to boot an OS, so this function will not return
|
||||||
* unless the image type is standalone.
|
* unless the image type is standalone.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ struct fdt_region;
|
|||||||
#include <linux/kconfig.h>
|
#include <linux/kconfig.h>
|
||||||
|
|
||||||
#define IMAGE_INDENT_STRING ""
|
#define IMAGE_INDENT_STRING ""
|
||||||
|
#define BIT(nr) (1UL << (nr))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ struct fdt_region;
|
|||||||
#include <asm/u-boot.h>
|
#include <asm/u-boot.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <linker_lists.h>
|
#include <linker_lists.h>
|
||||||
|
#include <linux/bitops.h>
|
||||||
|
|
||||||
#define IMAGE_INDENT_STRING " "
|
#define IMAGE_INDENT_STRING " "
|
||||||
|
|
||||||
@@ -343,6 +345,61 @@ struct image_info {
|
|||||||
uint8_t arch; /* CPU architecture */
|
uint8_t arch; /* CPU architecture */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum bootm_state - States which the bootm machine goes through (in order)
|
||||||
|
*
|
||||||
|
* @BOOTMS_START: Set up the state structure (struct bootm_headers)
|
||||||
|
* @BOOTMS_PRE_LOAD: Do any neceessary processing before images are read. For
|
||||||
|
* now this just implements a whole-image signature, if enabled. See
|
||||||
|
* CONFIG_IMAGE_PRE_LOAD_SIG
|
||||||
|
* @BOOTMS_FINDOS: Determine the operatiing system to be loaded
|
||||||
|
* @BOOTMS_FINDOTHER: Find any other images to be loaded, e.g. device tree /
|
||||||
|
* ramdisk
|
||||||
|
*
|
||||||
|
* Note: After this state the OS, ramdisk, devicetree, etc. should be determined
|
||||||
|
* and be present in struct bootm_headers, i.e. from now on the state should
|
||||||
|
* only consider those images.
|
||||||
|
*
|
||||||
|
* @BOOTMS_MEASURE: Measure images to the TPM, if enabled
|
||||||
|
* @BOOTMS_LOADOS: Load the OS into the correct place in memory
|
||||||
|
* @BOOTMS_RAMDISK: Relocate any ramdisk into the correct place in memory
|
||||||
|
* @BOOTMS_FDT: Load any device tree into the correct place in memory
|
||||||
|
* @BOOTMS_OS_CMDLINE: Set up the command line for the OS
|
||||||
|
*
|
||||||
|
* Note: After this state all images should be in the correct place in memory,
|
||||||
|
* ready for execution. This includes decompression, relocations, etc. From now
|
||||||
|
* only images can be modified but not loaded/moved.
|
||||||
|
*
|
||||||
|
* @BOOTMS_OS_BD_T: Write U-Boot's bd_info information so the OS can use it;
|
||||||
|
* Only used on PowerPC
|
||||||
|
* @BOOTMS_OS_PREP: Set up tables needed by the OS: this includes devicetree
|
||||||
|
* fix-ups and moving to the final location, command line (if not done in
|
||||||
|
* the @BOOTMS_OS_CMDLINE state), setting up ATAGS (only used with very old
|
||||||
|
* kernels). After this point, we should be ready to jump to the OS without
|
||||||
|
* any further changes to images in memory
|
||||||
|
* @BOOTMS_OS_FAKE_GO: Fake a jump to the OS; this does everything except
|
||||||
|
* actually jumping to the OS. It can be useful for tracing or for
|
||||||
|
* bootstage timing, but is not used in production code.
|
||||||
|
* @BOOTMS_OS_GO: Jump to the OS. Note that this stage should *only* shut down
|
||||||
|
* any active drivers and do the actual jump. Loading and relocating images
|
||||||
|
* must have happened in earlier stages
|
||||||
|
*/
|
||||||
|
enum bootm_state {
|
||||||
|
BOOTMS_START = BIT(0),
|
||||||
|
BOOTMS_PRE_LOAD = BIT(1),
|
||||||
|
BOOTMS_FINDOS = BIT(2),
|
||||||
|
BOOTMS_FINDOTHER = BIT(3),
|
||||||
|
BOOTMS_MEASURE = BIT(4),
|
||||||
|
BOOTMS_LOADOS = BIT(5),
|
||||||
|
BOOTMS_RAMDISK = BIT(6),
|
||||||
|
BOOTMS_FDT = BIT(7),
|
||||||
|
BOOTMS_OS_CMDLINE = BIT(8),
|
||||||
|
BOOTMS_OS_BD_T = BIT(9),
|
||||||
|
BOOTMS_OS_PREP = BIT(10),
|
||||||
|
BOOTMS_OS_FAKE_GO = BIT(11), /* 'Almost' run the OS */
|
||||||
|
BOOTMS_OS_GO = BIT(12),
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Legacy and FIT format headers used by do_bootm() and do_bootm_<os>()
|
* Legacy and FIT format headers used by do_bootm() and do_bootm_<os>()
|
||||||
* routines.
|
* routines.
|
||||||
@@ -397,21 +454,7 @@ struct bootm_headers {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int verify; /* env_get("verify")[0] != 'n' */
|
int verify; /* env_get("verify")[0] != 'n' */
|
||||||
|
enum bootm_state state;
|
||||||
#define BOOTM_STATE_START 0x00000001
|
|
||||||
#define BOOTM_STATE_FINDOS 0x00000002
|
|
||||||
#define BOOTM_STATE_FINDOTHER 0x00000004
|
|
||||||
#define BOOTM_STATE_LOADOS 0x00000008
|
|
||||||
#define BOOTM_STATE_RAMDISK 0x00000010
|
|
||||||
#define BOOTM_STATE_FDT 0x00000020
|
|
||||||
#define BOOTM_STATE_OS_CMDLINE 0x00000040
|
|
||||||
#define BOOTM_STATE_OS_BD_T 0x00000080
|
|
||||||
#define BOOTM_STATE_OS_PREP 0x00000100
|
|
||||||
#define BOOTM_STATE_OS_FAKE_GO 0x00000200 /* 'Almost' run the OS */
|
|
||||||
#define BOOTM_STATE_OS_GO 0x00000400
|
|
||||||
#define BOOTM_STATE_PRE_LOAD 0x00000800
|
|
||||||
#define BOOTM_STATE_MEASURE 0x00001000
|
|
||||||
int state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct bootm_headers images;
|
extern struct bootm_headers images;
|
||||||
|
|||||||
Reference in New Issue
Block a user