summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils/partitionedfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/utils/partitionedfs.py')
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index c72bb29b02..87d2929f6c 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -61,6 +61,7 @@ class Image:
61 self.disks[disk_name] = \ 61 self.disks[disk_name] = \
62 { 'disk': None, # Disk object 62 { 'disk': None, # Disk object
63 'numpart': 0, # Number of allocate partitions 63 'numpart': 0, # Number of allocate partitions
64 'realpart': 0, # Number of partitions in the partition table
64 'partitions': [], # Indexes to self.partitions 65 'partitions': [], # Indexes to self.partitions
65 'offset': 0, # Offset of next partition (in sectors) 66 'offset': 0, # Offset of next partition (in sectors)
66 # Minimum required disk size to fit all partitions (in bytes) 67 # Minimum required disk size to fit all partitions (in bytes)
@@ -85,7 +86,7 @@ class Image:
85 self.__add_disk(part['disk_name']) 86 self.__add_disk(part['disk_name'])
86 87
87 def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None, 88 def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None,
88 label=None, fsopts = None, boot = False, align = None, 89 label=None, fsopts = None, boot = False, align = None, no_table=False,
89 part_type = None): 90 part_type = None):
90 """ Add the next partition. Prtitions have to be added in the 91 """ Add the next partition. Prtitions have to be added in the
91 first-to-last order. """ 92 first-to-last order. """
@@ -109,6 +110,7 @@ class Image:
109 'num': None, # Partition number 110 'num': None, # Partition number
110 'boot': boot, # Bootable flag 111 'boot': boot, # Bootable flag
111 'align': align, # Partition alignment 112 'align': align, # Partition alignment
113 'no_table' : no_table, # Partition does not appear in partition table
112 'part_type' : part_type } # Partition type 114 'part_type' : part_type } # Partition type
113 115
114 self.__add_partition(part) 116 self.__add_partition(part)
@@ -147,6 +149,8 @@ class Image:
147 # Get the disk where the partition is located 149 # Get the disk where the partition is located
148 d = self.disks[p['disk_name']] 150 d = self.disks[p['disk_name']]
149 d['numpart'] += 1 151 d['numpart'] += 1
152 if not p['no_table']:
153 d['realpart'] += 1
150 d['ptable_format'] = ptable_format 154 d['ptable_format'] = ptable_format
151 155
152 if d['numpart'] == 1: 156 if d['numpart'] == 1:
@@ -156,7 +160,7 @@ class Image:
156 # Skip one sector required for the partitioning scheme overhead 160 # Skip one sector required for the partitioning scheme overhead
157 d['offset'] += overhead 161 d['offset'] += overhead
158 162
159 elif d['numpart'] > 3: 163 if d['realpart'] > 3:
160 # Reserve a sector for EBR for every logical partition 164 # Reserve a sector for EBR for every logical partition
161 # before alignment is performed. 165 # before alignment is performed.
162 if ptable_format == "msdos": 166 if ptable_format == "msdos":
@@ -189,12 +193,15 @@ class Image:
189 d['offset'] += p['size'] 193 d['offset'] += p['size']
190 194
191 p['type'] = 'primary' 195 p['type'] = 'primary'
192 p['num'] = d['numpart'] 196 if not p['no_table']:
197 p['num'] = d['realpart']
198 else:
199 p['num'] = 0
193 200
194 if d['ptable_format'] == "msdos": 201 if d['ptable_format'] == "msdos":
195 if d['numpart'] > 3: 202 if d['realpart'] > 3:
196 p['type'] = 'logical' 203 p['type'] = 'logical'
197 p['num'] = d['numpart'] + 1 204 p['num'] = d['realpart'] + 1
198 205
199 d['partitions'].append(n) 206 d['partitions'].append(n)
200 msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d " 207 msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d "
@@ -256,6 +263,9 @@ class Image:
256 msger.debug("Creating partitions") 263 msger.debug("Creating partitions")
257 264
258 for p in self.partitions: 265 for p in self.partitions:
266 if p['num'] == 0:
267 continue
268
259 d = self.disks[p['disk_name']] 269 d = self.disks[p['disk_name']]
260 if d['ptable_format'] == "msdos" and p['num'] == 5: 270 if d['ptable_format'] == "msdos" and p['num'] == 5:
261 # Create an extended partition (note: extended 271 # Create an extended partition (note: extended