Lines Matching refs:partition
78 def write_partition(partition, output_file, offset): argument
81 dd_comm = ['dd', 'if=' + partition["path"], 'of=' + output_file, 'conv=notrunc,sync',
87 def unsparse_partition(partition): argument
90 print("Unsparsing %s" % (partition["path"]), end=' ')
91 partition["fd"], temp_file = mkstemp()
92 shell_command([simg2img, partition["path"], temp_file])
93 partition["path"] = temp_file
105 def add_partition(partition, output_file): argument
107 num = str(partition["num"])
108 new_comm = '--new=' + num + ':' + partition["start"] + ':' + partition["end"]
110 name_comm = '--change-name=' + num + ':' + partition["label"]
178 for partition in partitions:
180 partition["start"] = str(offset // 512)
182 if check_sparse(partition["path"]):
183 unsparse_partition(partition)
187 write_partition(partition, output_filename, offset // 1024 // 1024)
189 partition["end"] = str(offset // 512 - 1)
202 for partition in partitions:
203 add_partition(partition, output_filename)
205 if 'fd' in partition:
206 os.close(partition["fd"])
207 os.remove(partition["path"])