Skip to content

Align gen_partition.py with an original script hosted on git.codelinaro.org #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions gen_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def usage():
# store entries read from input file
disk_entry = None
partition_entries_dict = {}
# store partition image map passed from command line
partition_image_map = {}
input_file = None
output_xml = None

Expand Down Expand Up @@ -119,6 +121,8 @@ def partition_options(argv):
partition_entry["filename"] = arg
elif opt in ['--sparse']:
partition_entry["sparse"] = arg
if partition_entry["label"] in partition_image_map.keys():
partition_entry["filename"] = partition_image_map[partition_entry["label"]]
return partition_entry

def parse_partition_entry(partition_entry):
Expand Down Expand Up @@ -227,6 +231,14 @@ def generate_partition_xml (disk_entry, partition_entries_dict, output_xml):
input_file=arg
elif opt in ["-o"]:
output_xml=arg
elif opt in ["-m"]:
for mapping in arg.split(','):
tags=mapping.split("=")
if len(tags) > 1:
partition_image_map[tags[0]]=tags[1]
else:
usage()

except Exception as argerr:
print (str(argerr))
usage()
Expand Down
Loading