Patchwork wic: Add SD/MMC-Cards support to '--ondisk' param

login
register
mail settings
Submitter João Henrique Freitas
Date March 18, 2014, 4:05 p.m.
Message ID <1395158745-9424-2-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/68837/
State Accepted
Commit 7f880e2980bbc47198a107b4d1248a765acd00fc
Headers show

Comments

João Henrique Freitas - March 18, 2014, 4:05 p.m.
The special case when wic is set up to use SD/MMC-Cards in place
of sdX disks is not handled properly.

Append 'p' to the rootdev when disk is SD/MMC-Cards fix this situation.
---
 scripts/lib/mic/imager/direct.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tom.zanussi@linux.intel.com - March 21, 2014, 5:52 p.m.
On Tue, 2014-03-18 at 13:05 -0300, João Henrique Ferreira de Freitas
wrote:
> The special case when wic is set up to use SD/MMC-Cards in place
> of sdX disks is not handled properly.
> 
> Append 'p' to the rootdev when disk is SD/MMC-Cards fix this situation.

This is missing your Signed-off-by.  Other than that,

Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>

> ---
>  scripts/lib/mic/imager/direct.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
> index f8c300c..1f2f8fc 100644
> --- a/scripts/lib/mic/imager/direct.py
> +++ b/scripts/lib/mic/imager/direct.py
> @@ -345,10 +345,14 @@ class DirectImageCreator(BaseImageCreator):
>          parts = self._get_parts()
>          for num, p in enumerate(parts, 1):
>              if p.mountpoint == "/":
> +                part = ''
> +                if p.disk.startswith('mmcblk'):
> +                    part = 'p'
> +
>                  if self._ptable_format == 'msdos' and num > 3:
> -                    rootdev = "/dev/%s%-d" % (p.disk, num + 1)
> +                    rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1)
>                  else:
> -                    rootdev = "/dev/%s%-d" % (p.disk, num)
> +                    rootdev = "/dev/%s%s%-d" % (p.disk, part, num)
>                  root_part_uuid = p.part_type
>  
>          return (rootdev, root_part_uuid)
> -- 
> 1.8.3.2
>

Patch

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index f8c300c..1f2f8fc 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -345,10 +345,14 @@  class DirectImageCreator(BaseImageCreator):
         parts = self._get_parts()
         for num, p in enumerate(parts, 1):
             if p.mountpoint == "/":
+                part = ''
+                if p.disk.startswith('mmcblk'):
+                    part = 'p'
+
                 if self._ptable_format == 'msdos' and num > 3:
-                    rootdev = "/dev/%s%-d" % (p.disk, num + 1)
+                    rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1)
                 else:
-                    rootdev = "/dev/%s%-d" % (p.disk, num)
+                    rootdev = "/dev/%s%s%-d" % (p.disk, part, num)
                 root_part_uuid = p.part_type
 
         return (rootdev, root_part_uuid)