diff options
author | Shantur Rathore <i@shantur.com> | 2023-11-19 16:55:00 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-12-09 13:16:08 -0500 |
commit | 184fc0379dd0d750d8d032fb5a147150c13547c2 (patch) | |
tree | 9e986b0060e8ada661c2984d654075bb7abe5dc4 /boot/bootmeth_efi.c | |
parent | e31317e161928aadb8941cb63ce49d6faa8002f4 (diff) | |
download | u-boot-184fc0379dd0d750d8d032fb5a147150c13547c2.tar.gz u-boot-184fc0379dd0d750d8d032fb5a147150c13547c2.tar.bz2 u-boot-184fc0379dd0d750d8d032fb5a147150c13547c2.zip |
bootflow: bootmeth_efi: Handle fdt not available.
While booting with efi, if fdt isn't available externally,
just use the built-in one.
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 | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index fd224f7c91..e884dc6293 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -313,6 +313,7 @@ static int distro_efi_try_bootflow_files(struct udevice *dev, */ } else { log_debug("No device tree available\n"); + bflow->flags |= BOOTFLOWF_USE_BUILTIN_FDT; } return 0; @@ -391,6 +392,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow) bflow->fdt_addr = fdt_addr; } else { log_debug("No device tree available\n"); + bflow->flags |= BOOTFLOWF_USE_BUILTIN_FDT; } bflow->state = BOOTFLOWST_READY; @@ -429,13 +431,11 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow) return log_msg_ret("read", ret); /* - * use the provided device tree if available, else fall back to - * the control FDT + * use the provided device tree if not using the built-in fdt */ - if (bflow->fdt_fname) + if (bflow->flags & ~BOOTFLOWF_USE_BUILTIN_FDT) fdt = bflow->fdt_addr; - else - fdt = (ulong)map_to_sysmem(gd->fdt_blob); + } else { /* * This doesn't actually work for network devices: @@ -452,7 +452,14 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow) * At some point we can add a real interface to bootefi so we can call * this directly. For now, go through the CLI, like distro boot. */ - snprintf(cmd, sizeof(cmd), "bootefi %lx %lx", kernel, fdt); + if (bflow->flags & BOOTFLOWF_USE_BUILTIN_FDT) { + log_debug("Booting with built-in fdt\n"); + snprintf(cmd, sizeof(cmd), "bootefi %lx", kernel); + } else { + log_debug("Booting with external fdt\n"); + snprintf(cmd, sizeof(cmd), "bootefi %lx %lx", kernel, fdt); + } + if (run_command(cmd, 0)) return log_msg_ret("run", -EINVAL); |