boot: Support a fake go with pxe
Provide a way to pass the 'fake go' flag from the bootflow flag through to the PXE implementation, so that a request for a fake go (via 'bootflow boot -f') is handled correctly in the bootmeth and when booting. Add a little more debugging of this in PXE. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -89,6 +89,9 @@ static int extlinux_setup(struct udevice *dev, struct bootflow *bflow,
|
|||||||
false, plat->use_fallback, bflow);
|
false, plat->use_fallback, bflow);
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("ctx", ret);
|
return log_msg_ret("ctx", ret);
|
||||||
|
log_debug("bootfl flags %x\n", bflow->flags);
|
||||||
|
if (bflow->flags & BOOTFLOWF_FAKE_GO)
|
||||||
|
ctx->fake_go = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -103,6 +106,7 @@ int extlinux_boot(struct udevice *dev, struct bootflow *bflow,
|
|||||||
|
|
||||||
/* if we have already selected a label, just boot it */
|
/* if we have already selected a label, just boot it */
|
||||||
if (plat->ctx.label) {
|
if (plat->ctx.label) {
|
||||||
|
plat->ctx.fake_go = bflow->flags & BOOTFLOWF_FAKE_GO;
|
||||||
ret = pxe_do_boot(&plat->ctx);
|
ret = pxe_do_boot(&plat->ctx);
|
||||||
} else {
|
} else {
|
||||||
ret = extlinux_setup(dev, bflow, getfile, allow_abs_path,
|
ret = extlinux_setup(dev, bflow, getfile, allow_abs_path,
|
||||||
|
|||||||
@@ -427,6 +427,11 @@ skip_overlay:
|
|||||||
static int label_process_fdt(struct pxe_context *ctx, struct pxe_label *label,
|
static int label_process_fdt(struct pxe_context *ctx, struct pxe_label *label,
|
||||||
char *kernel_addr, const char **fdt_argp)
|
char *kernel_addr, const char **fdt_argp)
|
||||||
{
|
{
|
||||||
|
log_debug("label '%s' kernel_addr '%s' label->fdt '%s' fdtdir '%s' "
|
||||||
|
"kernel_label '%s' fdt_argp '%s'\n",
|
||||||
|
label->name, kernel_addr, label->fdt, label->fdtdir,
|
||||||
|
label->kernel_label, *fdt_argp);
|
||||||
|
|
||||||
/* For FIT, the label can be identical to kernel one */
|
/* For FIT, the label can be identical to kernel one */
|
||||||
if (label->fdt && !strcmp(label->kernel_label, label->fdt)) {
|
if (label->fdt && !strcmp(label->kernel_label, label->fdt)) {
|
||||||
*fdt_argp = kernel_addr;
|
*fdt_argp = kernel_addr;
|
||||||
@@ -594,7 +599,11 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
|
|||||||
int states;
|
int states;
|
||||||
|
|
||||||
states = ctx->restart ? BOOTM_STATE_RESTART : BOOTM_STATE_START;
|
states = ctx->restart ? BOOTM_STATE_RESTART : BOOTM_STATE_START;
|
||||||
log_debug("using bootm\n");
|
log_debug("using bootm fake_go=%d\n", ctx->fake_go);
|
||||||
|
if (ctx->fake_go)
|
||||||
|
states |= BOOTM_STATE_OS_FAKE_GO;
|
||||||
|
else
|
||||||
|
states |= BOOTM_STATE_OS_GO;
|
||||||
ret = boot_run(&bmi, "ext", states | BOOTM_STATE_FINDOS |
|
ret = boot_run(&bmi, "ext", states | BOOTM_STATE_FINDOS |
|
||||||
BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
|
BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
|
||||||
BOOTM_STATE_LOADOS);
|
BOOTM_STATE_LOADOS);
|
||||||
@@ -782,8 +791,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
|
|||||||
|
|
||||||
if (!conf_fdt_str) {
|
if (!conf_fdt_str) {
|
||||||
if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
|
if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
|
||||||
strcmp("-", label->fdt))
|
strcmp("-", label->fdt)) {
|
||||||
conf_fdt_str = env_get("fdt_addr");
|
conf_fdt_str = env_get("fdt_addr");
|
||||||
|
log_debug("using fdt_addr '%s'\n", conf_fdt_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conf_fdt_str) {
|
if (!conf_fdt_str) {
|
||||||
@@ -792,13 +803,17 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
|
|||||||
buf = map_sysmem(kern_addr, 0);
|
buf = map_sysmem(kern_addr, 0);
|
||||||
if (genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
|
if (genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
|
||||||
if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
|
if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
|
||||||
strcmp("-", label->fdt))
|
strcmp("-", label->fdt)) {
|
||||||
conf_fdt_str = env_get("fdtcontroladdr");
|
conf_fdt_str = env_get("fdtcontroladdr");
|
||||||
|
log_debug("using fdtcontroladdr '%s'\n",
|
||||||
|
conf_fdt_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unmap_sysmem(buf);
|
unmap_sysmem(buf);
|
||||||
}
|
}
|
||||||
if (conf_fdt_str)
|
if (conf_fdt_str)
|
||||||
conf_fdt = hextoul(conf_fdt_str, NULL);
|
conf_fdt = hextoul(conf_fdt_str, NULL);
|
||||||
|
log_debug("conf_fdt %lx\n", conf_fdt);
|
||||||
|
|
||||||
if (ctx->bflow && conf_fdt_str)
|
if (ctx->bflow && conf_fdt_str)
|
||||||
ctx->bflow->fdt_addr = conf_fdt;
|
ctx->bflow->fdt_addr = conf_fdt;
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path,
|
|||||||
* @conf_fdt: FDT address
|
* @conf_fdt: FDT address
|
||||||
* @restart: true to use BOOTM_STATE_RESTART instead of BOOTM_STATE_START (only
|
* @restart: true to use BOOTM_STATE_RESTART instead of BOOTM_STATE_START (only
|
||||||
* supported with FIT / bootm)
|
* supported with FIT / bootm)
|
||||||
|
* @fake_go: Do a 'fake' boot, up to the last possible point, then return
|
||||||
*/
|
*/
|
||||||
struct pxe_context {
|
struct pxe_context {
|
||||||
/**
|
/**
|
||||||
@@ -170,6 +171,7 @@ struct pxe_context {
|
|||||||
char *conf_fdt_str;
|
char *conf_fdt_str;
|
||||||
ulong conf_fdt;
|
ulong conf_fdt;
|
||||||
bool restart;
|
bool restart;
|
||||||
|
bool fake_go;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user