
From: Simon Glass <sjg@chromium.org> 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> --- boot/ext_pxe_common.c | 4 ++++ boot/pxe_utils.c | 21 ++++++++++++++++++--- include/pxe_utils.h | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/boot/ext_pxe_common.c b/boot/ext_pxe_common.c index 67d7b68d310..3b1412b86d3 100644 --- a/boot/ext_pxe_common.c +++ b/boot/ext_pxe_common.c @@ -89,6 +89,9 @@ static int extlinux_setup(struct udevice *dev, struct bootflow *bflow, false, plat->use_fallback, bflow); if (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; } @@ -103,6 +106,7 @@ int extlinux_boot(struct udevice *dev, struct bootflow *bflow, /* if we have already selected a label, just boot it */ if (plat->ctx.label) { + plat->ctx.fake_go = bflow->flags & BOOTFLOWF_FAKE_GO; ret = pxe_do_boot(&plat->ctx); } else { ret = extlinux_setup(dev, bflow, getfile, allow_abs_path, diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 13fd815451d..981023a3012 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -427,6 +427,11 @@ skip_overlay: static int label_process_fdt(struct pxe_context *ctx, struct pxe_label *label, 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 */ if (label->fdt && !strcmp(label->kernel_label, label->fdt)) { *fdt_argp = kernel_addr; @@ -594,7 +599,11 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label, int states; 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 | BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS); @@ -782,8 +791,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) if (!conf_fdt_str) { if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) || - strcmp("-", label->fdt)) + strcmp("-", label->fdt)) { conf_fdt_str = env_get("fdt_addr"); + log_debug("using fdt_addr '%s'\n", 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); if (genimg_get_format(buf) != IMAGE_FORMAT_FIT) { if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) || - strcmp("-", label->fdt)) + strcmp("-", label->fdt)) { conf_fdt_str = env_get("fdtcontroladdr"); + log_debug("using fdtcontroladdr '%s'\n", + conf_fdt_str); + } } unmap_sysmem(buf); } if (conf_fdt_str) conf_fdt = hextoul(conf_fdt_str, NULL); + log_debug("conf_fdt %lx\n", conf_fdt); if (ctx->bflow && conf_fdt_str) ctx->bflow->fdt_addr = conf_fdt; diff --git a/include/pxe_utils.h b/include/pxe_utils.h index 9100a861ba1..7ecb5788d0b 100644 --- a/include/pxe_utils.h +++ b/include/pxe_utils.h @@ -135,6 +135,7 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path, * @conf_fdt: FDT address * @restart: true to use BOOTM_STATE_RESTART instead of BOOTM_STATE_START (only * supported with FIT / bootm) + * @fake_go: Do a 'fake' boot, up to the last possible point, then return */ struct pxe_context { /** @@ -170,6 +171,7 @@ struct pxe_context { char *conf_fdt_str; ulong conf_fdt; bool restart; + bool fake_go; }; /** -- 2.43.0