While booting with efi, if fdt isn't available externally,
just use the built-in one.

Signed-off-by: Shantur Rathore <i...@shantur.com>
---
 boot/bootmeth_efi.c | 10 +++++++++-
 include/bootflow.h  |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index a65d8ff582..c1e15b83a3 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -312,6 +312,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;
@@ -381,6 +382,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;
@@ -442,7 +444,13 @@ 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 {
+               snprintf(cmd, sizeof(cmd), "bootefi %lx %lx", kernel, fdt);
+       }
+
        if (run_command(cmd, 0))
                return log_msg_ret("run", -EINVAL);
 
diff --git a/include/bootflow.h b/include/bootflow.h
index 44d3741eac..ea6c6ffc0c 100644
--- a/include/bootflow.h
+++ b/include/bootflow.h
@@ -46,6 +46,7 @@ enum bootflow_state_t {
  */
 enum bootflow_flags_t {
        BOOTFLOWF_USE_PRIOR_FDT = 1 << 0,
+       BOOTFLOWF_USE_BUILTIN_FDT       = 1 << 1,
 };
 
 /**
-- 
2.40.1

Reply via email to