diff mbox series

[scarthgap,1/1] wic: Fix updating fstab for nvme devices

Message ID 20260620205741.175107-2-aleksandar.nikolic22@pm.me
State New
Headers show
Series Backport "wic: Fix updating fstab for nvme devices" | expand

Commit Message

Aleksandar Nikolic June 20, 2026, 8:57 p.m. UTC
From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>

In case wks file references nvme, update_fstab() function will not add
prefix 'p' before the partition number, as the if condition only takes
mmcblk into consideration.

In case of nvme0n1 this leads that following entries are added to fstab:

    /dev/nvme0n11
    /dev/nvme0n13

instead of:

    /dev/nvme0n1p1
    /dev/nvme0n1p3

The patch fixes this as it extends the if condition and adds prefix 'p' for
both mmcblk and nvme.

Upstream-Status: Submitted [https://lists.yoctoproject.org/g/yocto-patches/topic/119439838]
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
---
 scripts/lib/wic/plugins/imager/direct.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yoann Congal June 20, 2026, 11:40 p.m. UTC | #1
On Sat Jun 20, 2026 at 10:57 PM CEST, Aleksandar Nikolic via lists.openembedded.org wrote:
> From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
>
> In case wks file references nvme, update_fstab() function will not add
> prefix 'p' before the partition number, as the if condition only takes
> mmcblk into consideration.
>
> In case of nvme0n1 this leads that following entries are added to fstab:
>
>     /dev/nvme0n11
>     /dev/nvme0n13
>
> instead of:
>
>     /dev/nvme0n1p1
>     /dev/nvme0n1p3
>
> The patch fixes this as it extends the if condition and adds prefix 'p' for
> both mmcblk and nvme.
>
> Upstream-Status: Submitted [https://lists.yoctoproject.org/g/yocto-patches/topic/119439838]

That patch seem to have been merged here : https://git.yoctoproject.org/wic/commit/?id=f20cda73b495b75ef399c331f59b0e2401a3e76a
If that is the case, can you send a v2 patch with
Upstream-Status: Backport [https://git.yoctoproject.org/wic/commit/?id=f20cda73b495b75ef399c331f59b0e2401a3e76a]

Thanks!

> Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
> ---
>  scripts/lib/wic/plugins/imager/direct.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index a1d152659b..b06e6a8f23 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -133,8 +133,8 @@ class DirectPlugin(ImagerPlugin):
>              elif part.use_label:
>                  device_name = "LABEL=%s" % part.label
>              else:
> -                # mmc device partitions are named mmcblk0p1, mmcblk0p2..
> -                prefix = 'p' if  part.disk.startswith('mmcblk') else ''
> +                # mmc and nvme device partitions start with prefix 'p'
> +                prefix = 'p' if part.disk.startswith(('mmcblk', 'nvme')) else ''
>                  device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum)
>  
>              opts = part.fsopts if part.fsopts else "defaults"
> @@ -266,7 +266,7 @@ class DirectPlugin(ImagerPlugin):
>                  elif part.label and self.ptable_format != 'msdos':
>                      return "PARTLABEL=%s" % part.label
>                  else:
> -                    suffix = 'p' if part.disk.startswith('mmcblk') else ''
> +                    suffix = 'p' if part.disk.startswith(('mmcblk', 'nvme')) else ''
>                      return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum)
>  
>      def cleanup(self):
diff mbox series

Patch

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index a1d152659b..b06e6a8f23 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -133,8 +133,8 @@  class DirectPlugin(ImagerPlugin):
             elif part.use_label:
                 device_name = "LABEL=%s" % part.label
             else:
-                # mmc device partitions are named mmcblk0p1, mmcblk0p2..
-                prefix = 'p' if  part.disk.startswith('mmcblk') else ''
+                # mmc and nvme device partitions start with prefix 'p'
+                prefix = 'p' if part.disk.startswith(('mmcblk', 'nvme')) else ''
                 device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum)
 
             opts = part.fsopts if part.fsopts else "defaults"
@@ -266,7 +266,7 @@  class DirectPlugin(ImagerPlugin):
                 elif part.label and self.ptable_format != 'msdos':
                     return "PARTLABEL=%s" % part.label
                 else:
-                    suffix = 'p' if part.disk.startswith('mmcblk') else ''
+                    suffix = 'p' if part.disk.startswith(('mmcblk', 'nvme')) else ''
                     return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum)
 
     def cleanup(self):