]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: account for mmcblk device partition naming
authorMaciej Borzecki <maciej.borzecki@open-rnd.pl>
Mon, 22 Dec 2014 14:28:02 +0000 (15:28 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 24 Dec 2014 17:48:58 +0000 (17:48 +0000)
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@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/imager/direct.py

index 6b2ab3368e9b13596bc9fdbf425b5b777986d7cf..b1dc3e96f456d8c75c0ed3a06d0999465694419e 100644 (file)
@@ -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: