boot: pxe: Refactor label_run_boot() to avoid cmdline

Adjust the remaining call in this function to use the bootm API. This
will allow PXE to work without the command line.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2025-03-05 17:25:14 -07:00 committed by Tom Rini
parent feb8d7fd74
commit e2e87b8401
3 changed files with 35 additions and 17 deletions

View file

@ -432,6 +432,23 @@ int zboot_go(struct bootm_info *bmi)
return ret;
}
int zboot_run(struct bootm_info *bmi)
{
int ret;
ret = zboot_load(bmi);
if (ret)
return log_msg_ret("ld", ret);
ret = zboot_setup(bmi);
if (ret)
return log_msg_ret("set", ret);
ret = zboot_go(bmi);
if (ret)
return log_msg_ret("go", ret);
return -EFAULT;
}
int zboot_run_args(ulong addr, ulong size, ulong initrd, ulong initrd_size,
ulong base, char *cmdline)
{
@ -440,17 +457,11 @@ int zboot_run_args(ulong addr, ulong size, ulong initrd, ulong initrd_size,
bootm_init(&bmi);
zboot_start(&bmi, addr, size, initrd, initrd_size, base, cmdline);
ret = zboot_load(&bmi);
ret = zboot_run(&bmi);
if (ret)
return log_msg_ret("ld", ret);
ret = zboot_setup(&bmi);
if (ret)
return log_msg_ret("set", ret);
ret = zboot_go(&bmi);
if (ret)
return log_msg_ret("go", ret);
return log_msg_ret("zra", ret);
return -EFAULT;
return 0;
}
static void print_num(const char *name, ulong value)

View file

@ -585,10 +585,8 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
char *kernel_addr, char *initrd_addr_str,
char *initrd_filesize, char *initrd_str)
{
char *zboot_argv[] = { "zboot", NULL, "0", NULL, NULL };
struct bootm_info bmi;
ulong kernel_addr_r;
int zboot_argc = 3;
void *buf;
int ret;
@ -601,14 +599,14 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
return ret;
bmi.addr_img = kernel_addr;
zboot_argv[1] = kernel_addr;
bootm_x86_set(&bmi, bzimage_addr, hextoul(kernel_addr, NULL));
if (initrd_addr_str) {
bmi.conf_ramdisk = initrd_str;
zboot_argv[3] = initrd_addr_str;
zboot_argv[4] = initrd_filesize;
zboot_argc = 5;
bootm_x86_set(&bmi, initrd_addr,
hextoul(initrd_addr_str, NULL));
bootm_x86_set(&bmi, initrd_size,
hextoul(initrd_filesize, NULL));
}
if (!bmi.conf_fdt) {
@ -642,7 +640,7 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
/* Try booting an x86_64 Linux kernel image */
} else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) {
log_debug("using zboot\n");
do_zboot_parent(ctx->cmdtp, 0, zboot_argc, zboot_argv, NULL);
ret = zboot_run(&bmi);
}
unmap_sysmem(buf);

View file

@ -315,6 +315,15 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags);
*/
int bootm_process_cmdline_env(int flags);
/**
* zboot_run() - Run through the various steps to boot a zimage
*
* @bmi: Bootm information, with bzimage_size, initrd_addr, initrd_size and
* cmdline set up. If base_ptr is 0, then bzimage_addr must be set to the start
* of the bzImage. Otherwise base_ptr and load_address must be provided.
*/
int zboot_run(struct bootm_info *bmi);
/**
* zboot_run_args() - Run through the various steps to boot a zimage
*