Skip to contentSkip to conversation

efi_loader: Make exposed image loader path absolute

PATCH In review Alexander Graf 2 participants 2 messages Jul 20, 2016 – Jul 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: Make exposed image loader path absolute

When loading an efi image, we pass it the location it was loaded from.

On file system backends, there are no relative paths, so we should always pass in absolute ones. For network paths, we may be relative.

This fixes distro booting with grub2 for me when it fetches the grub2 config file from the loader partition.

---
 cmd/bootefi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
cmd/bootefi.c +6 -1
index 011f62c..d66892e 100644
@@ -290,6 +290,11 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 
 	/* Patch bootefi_image_path to the target file path */
 	memset(bootefi_image_path[0].str, 0, sizeof(bootefi_image_path[0].str));
-	snprintf(devname, sizeof(devname), "%s", path);
+	if (strcmp(dev, "Net")) {
+		/* Add leading / to fs paths, because they're absolute */
+		snprintf(devname, sizeof(devname), "/%s", path);
+	} else {
+		snprintf(devname, sizeof(devname), "%s", path);
+	}
 	ascii2unicode(bootefi_image_path[0].str, devname);
 }
Signature · 1 line
1.8.5.6
#1 lore raw
Quoted 10 lines · Alexander Graf

When loading an efi image, we pass it the location it was loaded from.

On file system backends, there are no relative paths, so we should always pass in absolute ones. For network paths, we may be relative.

This fixes distro booting with grub2 for me when it fetches the grub2 config file from the loader partition.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160725/a08d0e40/attachment.sig>