]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
windows: correct LBA in generated EFI HDD media paths
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 19 Dec 2015 08:32:26 +0000 (11:32 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 19 Dec 2015 08:32:49 +0000 (11:32 +0300)
GRUB keeps partition offset and size in units of 512B sectors. Media paths
are defined in terms of LBA which are presumed to match HDD sector size.

This is probably cosmetic (EFI requires that partition is searched by GUID)
and still incorrect if GPT was created using different logical block size.
But current code is obviously wrong and new has better chances to be correct.

grub-core/osdep/windows/platform.c

index d217efe17040d62103372c825aee3b2521e9c18f..912269191ebf65a1e0ab50d5cd1f21b4614fd78b 100644 (file)
@@ -370,9 +370,9 @@ grub_install_register_efi (grub_device_t efidir_grub_dev,
     }
 
   hddp->partition_start = grub_partition_get_start (efidir_grub_dev->disk->partition)
-    << (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
+    >> (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
   hddp->partition_size = grub_disk_get_size (efidir_grub_dev->disk)
-    << (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
+    >> (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
 
   pathptr = hddp + 1;
   filep = pathptr;