Re: [PATCH v8 6/6] ieee1275: support added for multiple nvme bootpaths

"Vladimir 'phcoder' Serbinenko" <[email protected]> Thu, 26 Feb 2026 17:50:58 +0300
Newsgroups org.gnu.grub-devel
Message-ID <CAEaD8JPL6G+96ECrUX01AD_dhmC+kStH6oYMOg-zd6Lckh61DA@mail.gmail.com>
--===============0180758151437680007==
Content-Type: multipart/alternative; boundary="000000000000226e96064bbb40af"

--000000000000226e96064bbb40af
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Regards
Vladimir 'phcoder' Serbinenko

Le lun. 23 f=C3=A9vr. 2026, 16:46, Avnish Chouhan <[email protected]> a
=C3=A9crit :

> This patch sets mupltiple NVMe boot-devices for more robust boot.
> Scenario where NVMe multipaths are available, all the available bootpaths
> (Max 5)
> will be added as the boot-device.
>
> Signed-off-by: Avnish Chouhan <[email protected]>
> ---
>  grub-core/osdep/unix/platform.c | 118
> ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  grub-core/osdep/linux/ofpath.c  |   4 ++--
>  include/grub/util/install.h     |   3 +++
>  include/grub/util/ofpath.h      |   4 ++++
>  4 file changed, 126 insertions(+), 3 deletion(-)
>
> diff --git a/grub-core/osdep/unix/platform.c
> b/grub-core/osdep/unix/platform.c
> index de71221..4632f41 100644
> --- a/grub-core/osdep/unix/platform.c
> +++ b/grub-core/osdep/unix/platform.c
> @@ -28,6 +28,10 @@
>  #include <dirent.h>
>  #include <string.h>
>  #include <errno.h>
> +#include <grub/util/ofpath.h>
> +#include <stdbool.h>
> +
> +#define BOOTDEV_BUFFER  1000
>
>  static char *
>  get_ofpathname (const char *dev)
> @@ -176,6 +180,107 @@ grub_install_register_efi (grub_device_t
> efidir_grub_dev,
>    return ret;
>  }
>
> +
> +char *
> +add_multiple_nvme_bootdevices (const char *install_device)
>
Either make it static or add proper namespacing.

+{
> +  char *sysfs_path, *nvme_ns, *ptr, *non_splitter_path;
> +  unsigned int nsid;
> +  char *multipath_boot, *ofpath, *ext_dir;
> +  struct dirent *ep, *splitter_ep;
> +  DIR *dp, *splitter_dp;
> +  char *cntl_id, *dirR1, *dirR2, *splitter_info_path;
> +  bool is_FC =3D false, is_splitter =3D false;
> +
> +  nvme_ns =3D grub_strstr (install_device, "nvme");
> +  nsid =3D of_path_get_nvme_nsid (nvme_ns);
> +  if (nsid =3D=3D 0)
> +    return NULL;
> +
> +  sysfs_path =3D nvme_get_syspath (nvme_ns);
> +  ofpath =3D xasprintf ("%s", get_ofpathname (nvme_ns));
>
Use (x)strdup

> +
> +  if (grub_strstr (ofpath, "fibre-channel"))
> +    {
> +      strcat (sysfs_path, "/device");
> +      is_FC =3D true;
> +    }
> +  else
> +    {
> +      strcat (sysfs_path, "/subsystem");
> +      is_FC =3D false;
> +    }
>
Where do you ensure sufficient space in sysfs_path?

> +  if (is_FC =3D=3D false)
> +    {
> +      cntl_id =3D grub_strstr (nvme_ns, "e");
>
Use strchr

> +      dirR1 =3D xasprintf ("nvme%c",cntl_id[1]);
> +
> +      splitter_info_path =3D xasprintf ("/sys/block/%s/device", nvme_ns)=
;
> +      splitter_dp =3D opendir (splitter_info_path);
> +      if (!splitter_dp)
> +        return NULL;
> +
> +      while ((splitter_ep =3D readdir (splitter_dp)) !=3D NULL)
> +        {
> +          if (grub_strstr (splitter_ep->d_name, "nvme"))
> +           {
> +             if (grub_strstr (splitter_ep->d_name, dirR1))
> +               continue;
> +
> +              ext_dir =3D grub_strchr (splitter_ep->d_name, 'e');
> +              if (grub_strchr (ext_dir, 'n') =3D=3D NULL)
> +               {
> +                  dirR2 =3D xasprintf("%s", splitter_ep->d_name);
> +                 is_splitter =3D true;
> +                 break;
> +               }
> +           }
> +        }
> +      closedir (splitter_dp);
> +    }
> +  sysfs_path =3D xrealpath (sysfs_path);
> +  dp =3D opendir (sysfs_path);
> +  if (!dp)
> +    return NULL;
> +
> +  ptr =3D multipath_boot =3D xmalloc (BOOTDEV_BUFFER);
> +  if (is_splitter =3D=3D false && is_FC =3D=3D false)
> +    {
> +      non_splitter_path =3D xasprintf ("%s/namespace@%x:1 ",
> get_ofpathname (dirR1), nsid);
> +      strncpy (ptr, non_splitter_path, strlen (non_splitter_path));
> +      ptr +=3D strlen (non_splitter_path);
>
Use stpcpy

> +      free (non_splitter_path);
> +    }
> +  else
> +    {
> +      while ((ep =3D readdir (dp)) !=3D NULL)
> +        {
> +          char *path;
> +
> +          if (grub_strstr (ep->d_name, "nvme") !=3D NULL)
> +            {
> +              if (is_FC =3D=3D false && grub_strstr (ep->d_name, dirR1) =
=3D=3D
> NULL &&
> +                  grub_strstr (ep->d_name, dirR2) =3D=3D NULL)
> +                continue;
> +              path =3D xasprintf ("%s/namespace@%x ", get_ofpathname
> (ep->d_name), nsid);
> +              if ((strlen (multipath_boot) + strlen (path)) >
> BOOTDEV_BUFFER)
> +                {
> +                  grub_util_warn (_("Maximum five entries are allowed in
> the bootlist"));
> +                  free (path);
> +                  break;
> +                }
> +              strncpy (ptr, path, strlen (path));
> +              ptr +=3D strlen (path);
>
Ditto

> +              free (path);
> +            }
> +        }
> +    }
> +  *--ptr =3D '\0';
> +  closedir (dp);
> +
> +  return multipath_boot;
> +}
> +
>  void
>  grub_install_register_ieee1275 (int is_prep, const char *install_device,
>                                 int partno, const char *relpath)
> @@ -215,8 +320,19 @@ grub_install_register_ieee1275 (int is_prep, const
> char *install_device,
>         }
>        *ptr =3D '\0';
>      }
> +  else if (grub_strstr (install_device, "nvme"))
> +    {
> +      boot_device =3D add_multiple_nvme_bootdevices (install_device);
>
What happens if I install via an UUID symlink? What happens if I install on
a file (disk image) named nvme1?

> +    }
>    else
> -    boot_device =3D get_ofpathname (install_device);
> +    {
> +      boot_device =3D get_ofpathname (install_device);
> +      if (grub_strstr (boot_device, "nvme-of"))
> +        {
> +          free (boot_device);
> +          boot_device =3D add_multiple_nvme_bootdevices (install_device)=
;
> +        }
> +    }
>
>    if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device",
>           boot_device, NULL }))
> diff --git a/grub-core/osdep/linux/ofpath.c
> b/grub-core/osdep/linux/ofpath.c
> index 7158c8c..3a778e0 100644
> --- a/grub-core/osdep/linux/ofpath.c
> +++ b/grub-core/osdep/linux/ofpath.c
> @@ -209,7 +209,7 @@ find_obppath (const char *sysfs_path_orig)
>      }
>  }
>
> -static char *
> +char *
>  xrealpath (const char *in)
>
Please add namespacing.

>  {
>    char *out;
> @@ -684,7 +684,7 @@ of_path_get_nvme_nsid (const char* devname)
>    return nsid;
>  }
>
> -static char *
> +char *
>  nvme_get_syspath (const char *nvmedev)
>
Ditto

>  {
>    char *sysfs_path;
> diff --git a/include/grub/util/install.h b/include/grub/util/install.h
> index 51f3b13..a67e225 100644
> --- a/include/grub/util/install.h
> +++ b/include/grub/util/install.h
> @@ -235,6 +235,9 @@ grub_install_register_efi (grub_device_t
> efidir_grub_dev,
>                            const char *efifile_path,
>                            const char *efi_distributor);
>
> +char *
> +add_multiple_nvme_bootdevices (const char *install_device);
> +
>  void
>  grub_install_register_ieee1275 (int is_prep, const char *install_device,
>                                 int partno, const char *relpath);
> diff --git a/include/grub/util/ofpath.h b/include/grub/util/ofpath.h
> index 5962322..78e78e7 100644
> --- a/include/grub/util/ofpath.h
> +++ b/include/grub/util/ofpath.h
> @@ -30,5 +30,9 @@ int add_filename_to_pile (char *filename, struct
> ofpath_files_list_root* root);
>  void find_file (char* filename, char* directory, struct
> ofpath_files_list_root* root, int max_depth, int depth);
>  char* of_find_fc_host (char* host_wwpn);
>  void free_ofpath_files_list (struct ofpath_files_list_root* root);
> +char* nvme_get_syspath (const char *nvmedev);
> +unsigned int of_path_get_nvme_nsid (const char* devname);
> +char* xrealpath (const char *in);
> +
>
>  #endif /* ! GRUB_OFPATH_MACHINE_UTIL_HEADER */
> --
> 2.50.1 (Apple Git-155)
>
>
> _______________________________________________
> Grub-devel mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

--000000000000226e96064bbb40af
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><di=
v><div><br></div><div><br></div><div data-smartmail=3D"gmail_signature">Reg=
ards<br>Vladimir &#39;phcoder&#39; Serbinenko<br></div><br><div class=3D"gm=
ail_quote"><div dir=3D"ltr" class=3D"gmail_attr">Le lun. 23 f=C3=A9vr. 2026=
, 16:46, Avnish Chouhan &lt;<a href=3D"mailto:[email protected]" rel=3D"=
noreferrer noreferrer noreferrer" target=3D"_blank">[email protected]</a=
>&gt; a =C3=A9crit=C2=A0:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This pat=
ch sets mupltiple NVMe boot-devices for more robust boot.<br>
Scenario where NVMe multipaths are available, all the available bootpaths (=
Max 5)<br>
will be added as the boot-device.<br>
<br>
Signed-off-by: Avnish Chouhan &lt;<a href=3D"mailto:[email protected]" r=
el=3D"noreferrer noreferrer noreferrer noreferrer" target=3D"_blank">avnish=
@linux.ibm.com</a>&gt;<br>
---<br>
=C2=A0grub-core/osdep/unix/platform.c | 118 +++++++++++++++++++++++++++++++=
+++++++++++++++++++++-<br>
=C2=A0grub-core/osdep/linux/ofpath.c=C2=A0 |=C2=A0 =C2=A04 ++--<br>
=C2=A0include/grub/util/install.h=C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A03 +++<br=
>
=C2=A0include/grub/util/ofpath.h=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A04 ++++<b=
r>
=C2=A04 file changed, 126 insertions(+), 3 deletion(-)<br>
<br>
diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platfor=
m.c<br>
index de71221..4632f41 100644<br>
--- a/grub-core/osdep/unix/platform.c<br>
+++ b/grub-core/osdep/unix/platform.c<br>
@@ -28,6 +28,10 @@<br>
=C2=A0#include &lt;dirent.h&gt;<br>
=C2=A0#include &lt;string.h&gt;<br>
=C2=A0#include &lt;errno.h&gt;<br>
+#include &lt;grub/util/ofpath.h&gt;<br>
+#include &lt;stdbool.h&gt;<br>
+<br>
+#define BOOTDEV_BUFFER=C2=A0 1000<br>
<br>
=C2=A0static char *<br>
=C2=A0get_ofpathname (const char *dev)<br>
@@ -176,6 +180,107 @@ grub_install_register_efi (grub_device_t efidir_grub_=
dev,<br>
=C2=A0 =C2=A0return ret;<br>
=C2=A0}<br>
<br>
+<br>
+char *<br>
+add_multiple_nvme_bootdevices (const char *install_device)<br></blockquote=
></div></div><div dir=3D"auto">Either make it static or add proper namespac=
ing.</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gmail=
_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex">
+{<br>
+=C2=A0 char *sysfs_path, *nvme_ns, *ptr, *non_splitter_path;<br>
+=C2=A0 unsigned int nsid;<br>
+=C2=A0 char *multipath_boot, *ofpath, *ext_dir;<br>
+=C2=A0 struct dirent *ep, *splitter_ep;<br>
+=C2=A0 DIR *dp, *splitter_dp;<br>
+=C2=A0 char *cntl_id, *dirR1, *dirR2, *splitter_info_path;<br>
+=C2=A0 bool is_FC =3D false, is_splitter =3D false;<br>
+<br>
+=C2=A0 nvme_ns =3D grub_strstr (install_device, &quot;nvme&quot;);<br>
+=C2=A0 nsid =3D of_path_get_nvme_nsid (nvme_ns);<br>
+=C2=A0 if (nsid =3D=3D 0)<br>
+=C2=A0 =C2=A0 return NULL;<br>
+<br>
+=C2=A0 sysfs_path =3D nvme_get_syspath (nvme_ns);<br>
+=C2=A0 ofpath =3D xasprintf (&quot;%s&quot;, get_ofpathname (nvme_ns));<br=
></blockquote></div></div></div></div></div><div dir=3D"auto">Use (x)strdup=
</div><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"aut=
o"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+=C2=A0 if (grub_strstr (ofpath, &quot;fibre-channel&quot;))<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 strcat (sysfs_path, &quot;/device&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 is_FC =3D true;<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 else<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 strcat (sysfs_path, &quot;/subsystem&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 is_FC =3D false;<br>
+=C2=A0 =C2=A0 }<br></blockquote></div></div></div></div></div><div dir=3D"=
auto">Where do you ensure sufficient space in sysfs_path?</div><div dir=3D"=
auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div class=3D"g=
mail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">
+=C2=A0 if (is_FC =3D=3D false)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 cntl_id =3D grub_strstr (nvme_ns, &quot;e&quot;);<br>=
</blockquote></div></div></div></div></div><div dir=3D"auto">Use strchr</di=
v><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><=
div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin=
:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+=C2=A0 =C2=A0 =C2=A0 dirR1 =3D xasprintf (&quot;nvme%c&quot;,cntl_id[1]);<=
br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 splitter_info_path =3D xasprintf (&quot;/sys/block/%s=
/device&quot;, nvme_ns);<br>
+=C2=A0 =C2=A0 =C2=A0 splitter_dp =3D opendir (splitter_info_path);<br>
+=C2=A0 =C2=A0 =C2=A0 if (!splitter_dp)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 while ((splitter_ep =3D readdir (splitter_dp)) !=3D N=
ULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (grub_strstr (splitter_ep-&gt;d_name=
, &quot;nvme&quot;))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (grub_strstr (splitter_=
ep-&gt;d_name, dirR1))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ext_dir =3D grub_strchr (=
splitter_ep-&gt;d_name, &#39;e&#39;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (grub_strchr (ext_dir,=
 &#39;n&#39;) =3D=3D NULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dirR2 =3D x=
asprintf(&quot;%s&quot;, splitter_ep-&gt;d_name);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_splitter =
=3D true;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 =C2=A0 closedir (splitter_dp);<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 sysfs_path =3D xrealpath (sysfs_path);<br>
+=C2=A0 dp =3D opendir (sysfs_path);<br>
+=C2=A0 if (!dp)<br>
+=C2=A0 =C2=A0 return NULL;<br>
+<br>
+=C2=A0 ptr =3D multipath_boot =3D xmalloc (BOOTDEV_BUFFER);<br>
+=C2=A0 if (is_splitter =3D=3D false &amp;&amp; is_FC =3D=3D false)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 non_splitter_path =3D xasprintf (&quot;%s/namespace@%=
x:1 &quot;, get_ofpathname (dirR1), nsid);<br>
+=C2=A0 =C2=A0 =C2=A0 strncpy (ptr, non_splitter_path, strlen (non_splitter=
_path));<br>
+=C2=A0 =C2=A0 =C2=A0 ptr +=3D strlen (non_splitter_path);<br></blockquote>=
</div></div></div></div></div><div dir=3D"auto">Use stpcpy</div><div dir=3D=
"auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div class=3D"=
gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">
+=C2=A0 =C2=A0 =C2=A0 free (non_splitter_path);<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 else<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 while ((ep =3D readdir (dp)) !=3D NULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *path;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (grub_strstr (ep-&gt;d_name, &quot;n=
vme&quot;) !=3D NULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (is_FC =3D=3D false &a=
mp;&amp; grub_strstr (ep-&gt;d_name, dirR1) =3D=3D NULL &amp;&amp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 grub_strstr=
 (ep-&gt;d_name, dirR2) =3D=3D NULL)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 path =3D xasprintf (&quot=
;%s/namespace@%x &quot;, get_ofpathname (ep-&gt;d_name), nsid);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((strlen (multipath_bo=
ot) + strlen (path)) &gt; BOOTDEV_BUFFER)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 grub_util_w=
arn (_(&quot;Maximum five entries are allowed in the bootlist&quot;));<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 free (path)=
;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 strncpy (ptr, path, strle=
n (path));<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ptr +=3D strlen (path);<b=
r></blockquote></div></div></div></div></div><div dir=3D"auto">Ditto</div><=
div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div=
 class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 free (path);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 *--ptr =3D &#39;\0&#39;;<br>
+=C2=A0 closedir (dp);<br>
+<br>
+=C2=A0 return multipath_boot;<br>
+}<br>
+<br>
=C2=A0void<br>
=C2=A0grub_install_register_ieee1275 (int is_prep, const char *install_devi=
ce,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int partno, const char *relpath)<br>
@@ -215,8 +320,19 @@ grub_install_register_ieee1275 (int is_prep, const cha=
r *install_device,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0*ptr =3D &#39;\0&#39;;<br>
=C2=A0 =C2=A0 =C2=A0}<br>
+=C2=A0 else if (grub_strstr (install_device, &quot;nvme&quot;))<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 boot_device =3D add_multiple_nvme_bootdevices (instal=
l_device);<br></blockquote></div></div></div></div></div><div dir=3D"auto">=
What happens if I install via an UUID symlink? What happens if I install on=
 a file (disk image) named nvme1?</div><div dir=3D"auto"><div dir=3D"auto">=
<div dir=3D"auto"><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote =
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid=
;padding-left:1ex">
+=C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0else<br>
-=C2=A0 =C2=A0 boot_device =3D get_ofpathname (install_device);<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 boot_device =3D get_ofpathname (install_device);<br>
+=C2=A0 =C2=A0 =C2=A0 if (grub_strstr (boot_device, &quot;nvme-of&quot;))<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 free (boot_device);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boot_device =3D add_multiple_nvme_bootd=
evices (install_device);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 }<br>
<br>
=C2=A0 =C2=A0if (grub_util_exec ((const char * []){ &quot;nvsetenv&quot;, &=
quot;boot-device&quot;,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boot_device, NULL }))<br>
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.=
c<br>
index 7158c8c..3a778e0 100644<br>
--- a/grub-core/osdep/linux/ofpath.c<br>
+++ b/grub-core/osdep/linux/ofpath.c<br>
@@ -209,7 +209,7 @@ find_obppath (const char *sysfs_path_orig)<br>
=C2=A0 =C2=A0 =C2=A0}<br>
=C2=A0}<br>
<br>
-static char *<br>
+char *<br>
=C2=A0xrealpath (const char *in)<br></blockquote></div></div></div></div></=
div><div dir=3D"auto">Please add namespacing.=C2=A0</div><div dir=3D"auto">=
<div dir=3D"auto"><div dir=3D"auto"><div dir=3D"auto"><div class=3D"gmail_q=
uote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex">
=C2=A0{<br>
=C2=A0 =C2=A0char *out;<br>
@@ -684,7 +684,7 @@ of_path_get_nvme_nsid (const char* devname)<br>
=C2=A0 =C2=A0return nsid;<br>
=C2=A0}<br>
<br>
-static char *<br>
+char *<br>
=C2=A0nvme_get_syspath (const char *nvmedev)<br></blockquote></div></div></=
div></div></div><div dir=3D"auto">Ditto</div><div dir=3D"auto"><div dir=3D"=
auto"><div dir=3D"auto"><div dir=3D"auto"><div class=3D"gmail_quote"><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex">
=C2=A0{<br>
=C2=A0 =C2=A0char *sysfs_path;<br>
diff --git a/include/grub/util/install.h b/include/grub/util/install.h<br>
index 51f3b13..a67e225 100644<br>
--- a/include/grub/util/install.h<br>
+++ b/include/grub/util/install.h<br>
@@ -235,6 +235,9 @@ grub_install_register_efi (grub_device_t efidir_grub_de=
v,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0const char *efifile_path,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0const char *efi_distributor);<br>
<br>
+char *<br>
+add_multiple_nvme_bootdevices (const char *install_device);<br>
+<br>
=C2=A0void<br>
=C2=A0grub_install_register_ieee1275 (int is_prep, const char *install_devi=
ce,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int partno, const char *relpath);<br=
>
diff --git a/include/grub/util/ofpath.h b/include/grub/util/ofpath.h<br>
index 5962322..78e78e7 100644<br>
--- a/include/grub/util/ofpath.h<br>
+++ b/include/grub/util/ofpath.h<br>
@@ -30,5 +30,9 @@ int add_filename_to_pile (char *filename, struct ofpath_f=
iles_list_root* root);<br>
=C2=A0void find_file (char* filename, char* directory, struct ofpath_files_=
list_root* root, int max_depth, int depth);<br>
=C2=A0char* of_find_fc_host (char* host_wwpn);<br>
=C2=A0void free_ofpath_files_list (struct ofpath_files_list_root* root);<br=
>
+char* nvme_get_syspath (const char *nvmedev);<br>
+unsigned int of_path_get_nvme_nsid (const char* devname);<br>
+char* xrealpath (const char *in);<br>
+<br>
<br>
=C2=A0#endif /* ! GRUB_OFPATH_MACHINE_UTIL_HEADER */<br>
-- <br>
2.50.1 (Apple Git-155)<br>
<br>
<br>
_______________________________________________<br>
Grub-devel mailing list<br>
<a href=3D"mailto:[email protected]" rel=3D"noreferrer noreferrer noreferr=
er noreferrer" target=3D"_blank">[email protected]</a><br>
<a href=3D"https://lists.gnu.org/mailman/listinfo/grub-devel" rel=3D"norefe=
rrer noreferrer noreferrer noreferrer noreferrer" target=3D"_blank">https:/=
/lists.gnu.org/mailman/listinfo/grub-devel</a><br>
</blockquote></div></div></div>
<br><br></div>
<br><br></div>
<br><br></div>

--000000000000226e96064bbb40af--


--===============0180758151437680007==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KR3J1Yi1kZXZl
bCBtYWlsaW5nIGxpc3QKR3J1Yi1kZXZlbEBnbnUub3JnCmh0dHBzOi8vbGlzdHMuZ251Lm9yZy9t
YWlsbWFuL2xpc3RpbmZvL2dydWItZGV2ZWwK

--===============0180758151437680007==--