efi_loader: Pass proper device path in on boot

EFI payloads can query for the device they were booted from. Because
we have a disconnect between loading binaries and running binaries,
we passed in a dummy device path so far.

Unfortunately that breaks grub2's logic to find its configuration
file from the same device it was booted from.

This patch adds logic to have the "load" command call into our efi
code to set the device path to the one we last loaded a binary from.

With this grub2 properly detects where we got booted from and can
find its configuration file, even when searching by-partition.

Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Alexander Graf
2016-03-04 01:10:14 +01:00
committed by Tom Rini
parent dea2174d9d
commit 0f4060ebcb
4 changed files with 37 additions and 15 deletions

View File

@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
#include <fs.h>
#include <efi_loader.h>
static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -26,6 +27,7 @@ U_BOOT_CMD(
static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "");
return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
}