diff options
author | Shantur Rathore <i@shantur.com> | 2023-11-19 16:54:59 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-12-09 13:16:08 -0500 |
commit | e31317e161928aadb8941cb63ce49d6faa8002f4 (patch) | |
tree | dfe544378fe8ab442b8fd76d281a3c9069fcc62e /boot/bootmeth_efi.c | |
parent | c5440a6ae85d0b68e511c1b0b81dc97a3df719e5 (diff) | |
download | u-boot-e31317e161928aadb8941cb63ce49d6faa8002f4.tar.gz |
bootflow: bootmeth_efi: set bflow->fname from bootfile name
We need to set boot->fname before calling efi_set_bootdev
otherwise this crashes as bflow->fname is null.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Shantur Rathore <i@shantur.com>
Diffstat (limited to 'boot/bootmeth_efi.c')
-rw-r--r-- | boot/bootmeth_efi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 682cf5b23b7..fd224f7c91a 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -323,7 +323,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow) char file_addr[17], fname[256]; char *tftp_argv[] = {"tftp", file_addr, fname, NULL}; struct cmd_tbl cmdtp = {}; /* dummy */ - const char *addr_str, *fdt_addr_str; + const char *addr_str, *fdt_addr_str, *bootfile_name; int ret, arch, size; ulong addr, fdt_addr; char str[36]; @@ -360,6 +360,12 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow) return log_msg_ret("sz", -EINVAL); bflow->size = size; + /* bootfile should be setup by dhcp*/ + bootfile_name = env_get("bootfile"); + if (!bootfile_name) + return log_msg_ret("bootfile_name", ret); + bflow->fname = strdup(bootfile_name); + /* do the hideous EFI hack */ efi_set_bootdev("Net", "", bflow->fname, map_sysmem(addr, 0), bflow->size); |