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

login
register
mail settings
Submitter João Henrique Freitas
Date March 22, 2014, 10:41 p.m.
Message ID <1395528096-4664-1-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/69025/
State New
Headers show

Comments

João Henrique Freitas - March 22, 2014, 10:41 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.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 changes since previous version:

  * add Signed-off-by

 scripts/lib/mic/imager/direct.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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)