Skip to content

Commit 183ad10

Browse files
authored
Merge pull request #10 from MrCry0/main-gen_partition-restored
Align gen_partition.py with an original script hosted on git.codelinaro.org
2 parents f475042 + 3749559 commit 183ad10

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gen_partition.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def usage():
6464
# store entries read from input file
6565
disk_entry = None
6666
partition_entries_dict = {}
67+
# store partition image map passed from command line
68+
partition_image_map = {}
6769
input_file = None
6870
output_xml = None
6971

@@ -119,6 +121,8 @@ def partition_options(argv):
119121
partition_entry["filename"] = arg
120122
elif opt in ['--sparse']:
121123
partition_entry["sparse"] = arg
124+
if partition_entry["label"] in partition_image_map.keys():
125+
partition_entry["filename"] = partition_image_map[partition_entry["label"]]
122126
return partition_entry
123127

124128
def parse_partition_entry(partition_entry):
@@ -227,6 +231,14 @@ def generate_partition_xml (disk_entry, partition_entries_dict, output_xml):
227231
input_file=arg
228232
elif opt in ["-o"]:
229233
output_xml=arg
234+
elif opt in ["-m"]:
235+
for mapping in arg.split(','):
236+
tags=mapping.split("=")
237+
if len(tags) > 1:
238+
partition_image_map[tags[0]]=tags[1]
239+
else:
240+
usage()
241+
230242
except Exception as argerr:
231243
print (str(argerr))
232244
usage()

0 commit comments

Comments
 (0)