}
 };
 
+static struct efi_device_path_file_path bootefi_device_path[] = {
+       {
+               .dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,
+               .dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,
+               .dp.length = sizeof(bootefi_image_path[0]),
+               .str = { 'b','o','o','t','e','f','i' },
+       }, {
+               .dp.type = DEVICE_PATH_TYPE_END,
+               .dp.sub_type = DEVICE_PATH_SUB_TYPE_END,
+               .dp.length = sizeof(bootefi_image_path[0]),
+       }
+};
+
 static efi_status_t bootefi_open_dp(void *handle, efi_guid_t *protocol,
                        void **protocol_interface, void *agent_handle,
                        void *controller_handle, uint32_t attributes)
 {
-       *protocol_interface = bootefi_image_path;
+       *protocol_interface = bootefi_device_path;
        return EFI_SUCCESS;
 }
 
 /* The EFI loaded_image interface for the image executed via "bootefi" */
 static struct efi_loaded_image loaded_image_info = {
-       .device_handle = bootefi_image_path,
+       .device_handle = bootefi_device_path,
        .file_path = bootefi_image_path,
 };
 
                {
                        /*
                         * When asking for the device path interface, return
-                        * bootefi_image_path
+                        * bootefi_device_path
                         */
                        .guid = &efi_guid_device_path,
                        .open = &bootefi_open_dp,
 
 /* The EFI object struct for the device the "bootefi" image was loaded from */
 static struct efi_object bootefi_device_obj = {
-       .handle = bootefi_image_path,
+       .handle = bootefi_device_path,
        .protocols = {
                {
                        /* When asking for the device path interface, return
-                        * bootefi_image_path */
+                        * bootefi_device_path */
                        .guid = &efi_guid_device_path,
                        .open = &bootefi_open_dp,
                }
        bootefi_help_text
 );
 
-void efi_set_bootdev(const char *dev, const char *devnr)
+void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 {
        __maybe_unused struct blk_desc *desc;
        char devname[16] = { 0 }; /* dp->str is u16[16] long */
        if (colon)
                *colon = '\0';
 
-       /* Patch the bootefi_image_path to the target device */
+       /* Patch bootefi_device_path to the target device */
+       memset(bootefi_device_path[0].str, 0, sizeof(bootefi_device_path[0].str));
+       ascii2unicode(bootefi_device_path[0].str, devname);
+
+       /* 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);
        ascii2unicode(bootefi_image_path[0].str, devname);
 }
 
 /* Call this to relocate the runtime section to an address space */
 void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map);
 /* Call this to set the current device name */
-void efi_set_bootdev(const char *dev, const char *devnr);
+void efi_set_bootdev(const char *dev, const char *devnr, const char *path);
 
 /* Generic EFI memory allocator, call this to get memory */
 void *efi_alloc(uint64_t len, int memory_type);
 
 /* No loader configured, stub out EFI_ENTRY */
 static inline void efi_restore_gd(void) { }
-static inline void efi_set_bootdev(const char *dev, const char *devnr) { }
+static inline void efi_set_bootdev(const char *dev, const char *devnr,
+                                  const char *path) { }
 
 #endif