Change grub_install_register_efi interface to pass GRUB device.

This allows grub_install_register_efi to request partition info
	directly.
This commit is contained in:
Vladimir Serbinenko 2013-12-14 23:31:56 +01:00
parent 38933cee85
commit a24725cc6e
5 changed files with 27 additions and 8 deletions

View file

@ -1,3 +1,10 @@
2013-12-14 Vladimir Serbinenko <phcoder@gmail.com>
Change grub_install_register_efi interface to pass GRUB device.
This allows grub_install_register_efi to request partition info
directly.
2013-12-14 Vladimir Serbinenko <phcoder@gmail.com>
Workaround cygwin bug when using \\?\Volume{GUID} syntax.

View file

@ -31,7 +31,7 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device,
}
void
grub_install_register_efi (const char *efidir_disk, int efidir_part,
grub_install_register_efi (grub_device_t efidir_grub_dev,
const char *efifile_path,
const char *efi_distributor)
{

View file

@ -19,6 +19,7 @@
#include <config.h>
#include <grub/util/install.h>
#include <grub/emu/hostdisk.h>
#include <grub/util/misc.h>
#include <grub/misc.h>
#include <grub/i18n.h>
@ -129,10 +130,15 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
}
void
grub_install_register_efi (const char *efidir_disk, int efidir_part,
grub_install_register_efi (grub_device_t efidir_grub_dev,
const char *efifile_path,
const char *efi_distributor)
{
const char * efidir_disk;
int efidir_part;
efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk);
efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;
if (grub_util_exec_redirect_null ((const char * []){ "efibootmgr", "--version", NULL }))
{
/* TRANSLATORS: This message is shown when required executable `%s'

View file

@ -205,7 +205,7 @@ const char *
grub_install_get_default_x86_platform (void);
void
grub_install_register_efi (const char *efidir_disk, int efidir_part,
grub_install_register_efi (grub_device_t efidir_grub_dev,
const char *efifile_path,
const char *efi_distributor);

View file

@ -1559,19 +1559,25 @@ main (int argc, char *argv[])
}
if (!removable && update_nvram)
{
char * efidir_disk;
int efidir_part;
char * efifile_path;
char * part;
/* Try to make this image bootable using the EFI Boot Manager, if available. */
if (!efi_distributor || efi_distributor[0] == '\0')
grub_util_error ("%s", "EFI distributor id isn't specified.");
efidir_disk = grub_util_get_os_disk (efidir_device_names[0]);
efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;
efifile_path = xasprintf ("\\EFI\\%s\\%s",
efi_distributor,
efi_file);
grub_install_register_efi (efidir_disk, efidir_part,
part = (efidir_grub_dev->disk->partition
? grub_partition_get_name (efidir_grub_dev->disk->partition)
: 0);
grub_util_info ("Registering with EFI: distributor = `%s',"
" path = `%s', ESP at %s%s%s",
efi_distributor, efifile_path,
efidir_grub_dev->disk->name,
(part ? ",": ""), (part ? : ""));
grub_free (part);
grub_install_register_efi (efidir_grub_dev,
efifile_path, efi_distributor);
}
break;