Control: tag -1 pending

On Tue, Apr 29, 2014 at 05:43:44PM +0100, Dimitri John Ledkov wrote:
> Whilst legacy grub-mkdevicemap is still in use, I have noticed that it
> doesn't have support for NVMe devices. I've added the device pattern,
> for grub-mkdevicemap to probe NVMe devices following other similar
> devices. I've tested it using qemu-system, booted with UEFI edk2
> firmware and an NVMe device, here are sample instructions:
> 
>   cd `mktemp -d`
>   cp /usr/share/ovmf/OVMF.fd .
>   qemu-system-x86_64 -pflash OVMF.fd -m 1024 -drive 
> file=nvme.img,if=none,id=D22 -device nvme,drive=D22,serial=1234 --enable-kvm 
> -ctrl-grab -cdrom trusty-desktop-amd64.iso
> 
> With the attached patch grub-mkdevicemap produces result for the nvme
> drive. Patch was created on top of locally generated
> `patched-experimental` branch.

Thanks, this looks good.  I added this further patch so that other tools
can deal with partitions on NVMe devices properly:

diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 6788e39..f97f3a6 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -896,6 +896,20 @@ grub_util_part_to_disk (const char *os_dev, struct stat 
*st,
          *pp = '\0';
          return path;
        }
+
+      /* If this is an NVMe device.  */
+      if (strncmp ("nvme", p, sizeof ("nvme") - 1) == 0)
+       {
+         /* /dev/nvme[0-9]+n[0-9]+(p[0-9]+)? */
+         p = strchr (p, 'p');
+         if (p)
+           {
+             *is_part = 1;
+             *p = '\0';
+           }
+
+         return path;
+       }
     }
 
   return path;

-- 
Colin Watson                                       [cjwat...@debian.org]


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to