summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-04-03 22:40:55 +0200
committerAlexander Graf <agraf@suse.de>2018-04-04 13:14:33 +0200
commit2db1eba1c3717856ebcf01727379ad2d3f19b3cc (patch)
tree9da7ea580209fac8f8825bdf565c00a6c970b744 /cmd/bootefi.c
parentb6dd57773719bfcea6a295973c349b7842870337 (diff)
efi_loader: correctly determine the boot partition
The device path of the loaded image should be set to the partition from which the image was loaded. This requires using the same logic as the load command. Without the patch the device path pointed to the whole disk after executing load mmc 0: 0x43000000 FILE and not to the boot partition from which the file was actually loaded. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 6afece10bc..2a31a914cd 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -468,16 +468,6 @@ U_BOOT_CMD(
bootefi_help_text
);
-static int parse_partnum(const char *devnr)
-{
- const char *str = strchr(devnr, ':');
- if (str) {
- str++;
- return simple_strtoul(str, NULL, 16);
- }
- return 0;
-}
-
void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
{
char filename[32] = { 0 }; /* dp->str is u16[32] long */
@@ -485,12 +475,13 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
if (strcmp(dev, "Net")) {
struct blk_desc *desc;
+ disk_partition_t fs_partition;
int part;
- desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
- if (!desc)
+ part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
+ 1);
+ if (part < 0)
return;
- part = parse_partnum(devnr);
bootefi_device_path = efi_dp_from_part(desc, part);
} else {