[oe-commits] Maciej Borzecki : wic: account for mmcblk device partition naming

git at git.openembedded.org git at git.openembedded.org
Tue Dec 23 12:02:37 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 81b394a3f9a4483b7ccdd7df55885225fc23dbd5
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=81b394a3f9a4483b7ccdd7df55885225fc23dbd5

Author: Maciej Borzecki <maciej.borzecki at open-rnd.pl>
Date:   Mon Dec 22 15:28:02 2014 +0100

wic: account for mmcblk device partition naming

MMC block device partitions are named differently than other block
devices and use the scheme: mmcblk<devnum>p<partnum>, ex: mmcblk0p1,
mmcblk0p2. The current code generates incorrect parition names missing
'p' infix for fstab entries. The patch resolves this problem.

Signed-off-by: Maciej Borzecki <maciej.borzecki at open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/lib/wic/imager/direct.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 6b2ab33..b1dc3e9 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -100,10 +100,18 @@ class DirectImageCreator(BaseImageCreator):
         for num, p in enumerate(parts, 1):
             if not p.mountpoint or p.mountpoint == "/" or p.mountpoint == "/boot":
                 continue
-            if self._ptable_format == 'msdos' and num > 3:
-                device_name = "/dev/" + p.disk + str(num + 1)
-            else:
-                device_name = "/dev/" + p.disk + str(num)
+
+            part = ''
+            # mmc device partitions are named mmcblk0p1, mmcblk0p2..
+            if p.disk.startswith('mmcblk'):
+                part = 'p'
+
+            pnum = num
+            if self._ptable_format == 'msdos' and pnum > 3:
+                # account for logical partition numbering, ex. sda5..
+                pnum += 1
+
+            device_name = "/dev/" + p.disk + part + str(pnum)
 
             opts = "defaults"
             if p.fsopts:



More information about the Openembedded-commits mailing list