]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Make exposed image loader path absolute
authorAlexander Graf <agraf@suse.de>
Wed, 20 Jul 2016 23:44:46 +0000 (01:44 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 25 Jul 2016 16:00:06 +0000 (12:00 -0400)
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.

Reported-by: york sun <york.sun@nxp.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
cmd/bootefi.c

index 011f62c5b1ca76a409a96cb61581273c9c3c2b07..d66892e69ee963f893321878e961705996a0308f 100644 (file)
@@ -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);
 }