Skip to content

Commit 38ef7e6

Browse files
Divya ThejaMrCry0
Divya Theja
authored andcommitted
gen_partition.py: Enhance gen_partition.py to handle command line
This backported commit adds support of option "-m" missing in the initially imported utility. Original commit: https://git.codelinaro.org/clo/le/meta-qti-bsp/-/commit/b920abedc2ec26f2e32e965b31d3338ec606ce6e Now gen_partition.py will take input file, output xml and partition-imagefile mapping that a user passes through command line. output xml will have image filenames set by user mapped to partitions rather than the entries specified in the input conf file if -m is specified. Fixes: 7586c81 ("Import gen_partition.py utility") Signed-off-by: Oleksandr Suvorov <[email protected]>
1 parent 6d51c62 commit 38ef7e6

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)