]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: add GPT support
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Mon, 9 Feb 2015 23:46:44 +0000 (00:46 +0100)
committerOtavio Salvador <otavio@ossystems.com.br>
Wed, 18 Mar 2015 04:10:57 +0000 (01:10 -0300)
Add GPT partition table support.

Change-Id: I30f29ebe275c7abfc524af28950d705723e0f834
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
scripts/lib/wic/utils/partitionedfs.py

index 87d2929f6c8a81bcba41f9211776c623f87fb466..162f8e1b9c6af34a71d1de9b71a190b9b8f10f64 100644 (file)
@@ -29,6 +29,9 @@ from wic.utils.oe.misc import *
 # Overhead of the MBR partitioning scheme (just one sector)
 MBR_OVERHEAD = 1
 
+# Overhead of the GPT partitioning scheme
+GPT_OVERHEAD = 34
+
 # Size of a sector in bytes
 SECTOR_SIZE = 512
 
@@ -122,7 +125,7 @@ class Image:
 
         msger.debug("Assigning %s partitions to disks" % ptable_format)
 
-        if ptable_format not in ('msdos'):
+        if ptable_format not in ('msdos', 'gpt'):
             raise ImageError("Unknown partition table format '%s', supported " \
                              "formats are: 'msdos'" % ptable_format)
 
@@ -156,6 +159,8 @@ class Image:
             if d['numpart'] == 1:
                 if ptable_format == "msdos":
                     overhead = MBR_OVERHEAD
+                elif ptable_format == "gpt":
+                    overhead = GPT_OVERHEAD
 
                 # Skip one sector required for the partitioning scheme overhead
                 d['offset'] += overhead
@@ -214,6 +219,8 @@ class Image:
         # minumim disk sizes.
         for disk_name, d in self.disks.items():
             d['min_size'] = d['offset']
+            if d['ptable_format'] == "gpt":
+                d['min_size'] += GPT_OVERHEAD
 
             d['min_size'] *= self.sector_size