summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-12 14:46:24 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-13 04:38:00 +0300
commit5f59518a7b1aef9ad3a91defa06cff82dd01cdc5 (patch)
tree10ae6cf6e06c87338628373ab9346e5922382789 /net
parentea1a9ec5f430359720d9a0621ed1acfbba6a142a (diff)
downloadu-boot-5f59518a7b1aef9ad3a91defa06cff82dd01cdc5.tar.xz
efi_loader: setting boot device
Up to now the bootefi command used the last file loaded to determine the boot partition. This has led to errors when the fdt had been loaded from another partition after the EFI binary. Before setting the boot device from a loaded file check if it is a PE-COFF image or a FIT image. For a PE-COFF image remember address and size, boot device and path. For a FIT image remember boot device and path. If the PE-COFF image is overwritten by loading another file, forget it. Do not allow to start an image via bootefi which is not the last loaded PE-COFF image. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'net')
-rw-r--r--net/tftp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 6fdb1a821a..2cfa0b1486 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -329,6 +329,12 @@ static void tftp_complete(void)
time_start * 1000, "/s");
}
puts("\ndone\n");
+ if (IS_ENABLED(CONFIG_CMD_BOOTEFI)) {
+ if (!tftp_put_active)
+ efi_set_bootdev("Net", "", tftp_filename,
+ map_sysmem(tftp_load_addr, 0),
+ net_boot_file_size);
+ }
net_set_state(NETLOOP_SUCCESS);
}
@@ -841,9 +847,6 @@ void tftp_start(enum proto_t protocol)
printf("Load address: 0x%lx\n", tftp_load_addr);
puts("Loading: *\b");
tftp_state = STATE_SEND_RRQ;
-#ifdef CONFIG_CMD_BOOTEFI
- efi_set_bootdev("Net", "", tftp_filename);
-#endif
}
time_start = get_timer(0);