-
Notifications
You must be signed in to change notification settings - Fork 14
Deploy contents.xml to enable automatic image flashing in Axiom #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e1cd729
Makefile: add clean target and preserve partitions.xml
vkraleti 8c07231
gen_contents.py: Add utility to generate contents.xml
vkraleti 045e3b0
platforms/qcs6490-rb3gen2: add contents template
vkraleti 141e44b
platforms/qcs9100-ride-sx: add contents template
vkraleti 9485088
platforms/qcs8300-ride-sx: add contents template
vkraleti cc55107
Makefile: generate contents.xml for supported platforms
vkraleti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
import getopt | ||
import sys | ||
|
||
from xml.etree import ElementTree as ET | ||
|
||
|
||
def usage(): | ||
print(("\n\tUsage: %s -t <template> -p <partitions_xml_path> -o <output> \n\tVersion 0.1\n" % (sys.argv[0]))) | ||
sys.exit(1) | ||
|
||
|
||
def ParseXML(XMLFile): | ||
try: | ||
tree = ET.parse(XMLFile) | ||
root = tree.getroot() | ||
return root | ||
except FileNotFoundError: | ||
print(f"Error: File '{XMLFile}' not found") | ||
return None | ||
except ET.ParseError as e: | ||
print(f"Error: Failed parsing '{XMLFile}': {e}") | ||
return None | ||
|
||
|
||
def UpdateMetaData(TemplateRoot, PartitionRoot): | ||
ChipIdList = TemplateRoot.findall('product_info/chipid') | ||
DefaultStorageType = None | ||
for ChipId in ChipIdList: | ||
Flavor = ChipId.get('flavor') | ||
StorageType = ChipId.get('storage_type') | ||
print(f"Chipid Flavor: {Flavor} Storage Type: {StorageType}") | ||
if Flavor == "default": | ||
DefaultStorageType = ChipId.get('storage_type') | ||
|
||
PhyPartition = PartitionRoot.findall('physical_partition') | ||
PartitionsSet = set() | ||
Partitions = PartitionRoot.findall('physical_partition/partition') | ||
for partition in Partitions: | ||
label = partition.get('label') | ||
filename = partition.get('filename') | ||
if label and filename: | ||
PartitionsSet.add((label, filename)) | ||
print(f"PartitionsSet: {PartitionsSet}") | ||
|
||
builds = TemplateRoot.findall('builds_flat/build') | ||
for build in builds: | ||
Name = build.find('name') | ||
print(f"Build Name: {Name.text}") | ||
if Name.text != "common": | ||
continue | ||
DownloadFile = build.find('download_file') | ||
if DownloadFile is not None: | ||
build.remove(DownloadFile) | ||
# Partition entires | ||
for Partition in PartitionsSet: | ||
new_download_file = ET.SubElement(build, "download_file") | ||
new_download_file.set("fastboot_complete", Partition[0]) | ||
new_file_name = ET.SubElement(new_download_file, "file_name") | ||
new_file_name.text = Partition[1] | ||
new_file_path = ET.SubElement(new_download_file, "file_path") | ||
new_file_path.text = "." | ||
# GPT Main & GPT Backup entries | ||
for PhysicalPartitionNumber in range(0, len(PhyPartition)): | ||
new_download_file = ET.SubElement(build, "download_file") | ||
new_download_file.set("storage_type", DefaultStorageType) | ||
new_file_name = ET.SubElement(new_download_file, "file_name") | ||
new_file_name.text = 'gpt_main%d.xml' % (PhysicalPartitionNumber) | ||
new_file_path = ET.SubElement(new_download_file, "file_path") | ||
new_file_path.text = "." | ||
new_download_file = ET.SubElement(build, "download_file") | ||
new_download_file.set("storage_type", DefaultStorageType) | ||
new_file_name = ET.SubElement(new_download_file, "file_name") | ||
new_file_name.text = 'gpt_backup%d.xml' % (PhysicalPartitionNumber) | ||
new_file_path = ET.SubElement(new_download_file, "file_path") | ||
new_file_path.text = "." | ||
|
||
PartitionFile = build.find('partition_file') | ||
if PartitionFile is not None: | ||
build.remove(PartitionFile) | ||
# Rawprogram entries | ||
for PhysicalPartitionNumber in range(0, len(PhyPartition)): | ||
new_partition_file = ET.SubElement(build, "partition_file") | ||
new_partition_file.set("storage_type", DefaultStorageType) | ||
new_file_name = ET.SubElement(new_partition_file, "file_name") | ||
new_file_name.text = 'rawprogram%d.xml' % (PhysicalPartitionNumber) | ||
new_file_path = ET.SubElement(new_partition_file, "file_path") | ||
new_file_path.set("flavor", "default") | ||
new_file_path.text = "." | ||
|
||
PartitionPatchFile = build.find('partition_patch_file') | ||
if PartitionPatchFile is not None: | ||
build.remove(PartitionPatchFile) | ||
# Patch entries | ||
for PhysicalPartitionNumber in range(0, len(PhyPartition)): | ||
new_partition_patch_file = ET.SubElement(build, "partition_patch_file") | ||
new_partition_patch_file.set("storage_type", DefaultStorageType) | ||
new_file_name = ET.SubElement(new_partition_patch_file, "file_name") | ||
new_file_name.text = 'patch%d.xml' % (PhysicalPartitionNumber) | ||
new_file_path = ET.SubElement(new_partition_patch_file, "file_path") | ||
new_file_path.set("flavor", "default") | ||
new_file_path.text = "." | ||
|
||
############################################################################### | ||
# main | ||
############################################################################### | ||
|
||
|
||
if len(sys.argv) < 3: | ||
usage() | ||
|
||
try: | ||
if sys.argv[1] == "-h" or sys.argv[1] == "--help": | ||
usage() | ||
try: | ||
opts, rem = getopt.getopt(sys.argv[1:], "t:p:o:") | ||
for (opt, arg) in opts: | ||
if opt in ["-t"]: | ||
template = arg | ||
elif opt in ["-p"]: | ||
partition_xml = arg | ||
elif opt in ["-o"]: | ||
output_xml = arg | ||
else: | ||
usage() | ||
except Exception as argerr: | ||
print(str(argerr)) | ||
usage() | ||
|
||
print("Selected Template: " + template) | ||
xml_root = ParseXML(template) | ||
|
||
print("Selected Partition XML: " + partition_xml) | ||
partition_root = ParseXML(partition_xml) | ||
|
||
UpdateMetaData(xml_root, partition_root) | ||
|
||
OutputTree = ET.ElementTree(xml_root) | ||
ET.indent(OutputTree, space="\t", level=0) | ||
OutputTree.write(output_xml, encoding="utf-8", xml_declaration=True) | ||
except Exception as e: | ||
print(("Error: ", e)) | ||
sys.exit(1) | ||
|
||
sys.exit(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
======================================================================== | ||
contents.in | ||
|
||
General Description | ||
Contains information about component builds for this target. | ||
It will clone as contents.xml during build compilation process. | ||
|
||
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
SPDX-License-Identifier: BSD-3-Clause | ||
|
||
======================================================================== | ||
--> | ||
|
||
<contents> | ||
<product_flavors cmm_pf_var="PRODUCT_FLAVORS"> | ||
<pf> | ||
<name>default</name> | ||
<component> | ||
<name>common</name> | ||
<flavor>default</flavor> | ||
</component> | ||
<component> | ||
<name>apps</name> | ||
<flavor>default</flavor> | ||
</component> | ||
</pf> | ||
</product_flavors> | ||
<product_info> | ||
<product_name>QCM6490.LE.1.0</product_name> | ||
<chipid flavor="default" storage_type="ufs" flash_phase="1">QCM6490</chipid> | ||
<additional_chipid>SM7325,QCS6490</additional_chipid> | ||
<meta_type>SPF</meta_type> | ||
</product_info> | ||
<builds_flat> | ||
<build> | ||
<name>apps</name> | ||
<role>apps</role> | ||
<chipset>QCM6490</chipset> | ||
<windows_root_path>.\</windows_root_path> | ||
<linux_root_path>./</linux_root_path> | ||
<image_dir>apps_proc</image_dir> | ||
</build> | ||
<build> | ||
<name>common</name> | ||
<role>common</role> | ||
<chipset>QCM6490</chipset> | ||
<windows_root_path>.\</windows_root_path> | ||
<linux_root_path>./</linux_root_path> | ||
<image_dir>common</image_dir> | ||
<device_programmer> | ||
<file_name>prog_firehose_ddr.elf</file_name> | ||
<file_path>.</file_path> | ||
</device_programmer> | ||
<device_programmer firehose_type="lite"> | ||
<file_name>prog_firehose_lite.elf</file_name> | ||
<file_path>.</file_path> | ||
</device_programmer> | ||
<download_file> | ||
<fastboot_complete>{partition_name}</fastboot_complete> | ||
<file_name>{image_name}</file_name> | ||
<file_path>.</file_path> | ||
</download_file> | ||
<partition_file> | ||
<storage_type>{storage_type}</storage_type> | ||
<file_name>{partition_file_name}</file_name> | ||
<file_path flavor="default">.</file_path> | ||
</partition_file> | ||
<partition_patch_file> | ||
<storage_type>{storage_type}</storage_type> | ||
<file_name>{partition_patch_file_name}</file_name> | ||
<file_path flavor="default">.</file_path> | ||
</partition_patch_file> | ||
</build> | ||
</builds_flat> | ||
</contents> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
======================================================================== | ||
contents.xml.in | ||
|
||
General Description | ||
Contains information about component builds for this target. | ||
It will clone as contents.xml during build compilation process. | ||
|
||
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
SPDX-License-Identifier: BSD-3-Clause | ||
|
||
======================================================================== | ||
--> | ||
|
||
<contents> | ||
<product_flavors cmm_pf_var="PRODUCT_FLAVORS"> | ||
<pf> | ||
<name>default</name> | ||
<component> | ||
<name>common</name> | ||
<flavor>default</flavor> | ||
</component> | ||
<component> | ||
<name>apps</name> | ||
<flavor>default</flavor> | ||
</component> | ||
</pf> | ||
<pf> | ||
<name>sail_nor</name> | ||
<component> | ||
<name>common</name> | ||
<flavor>sail_nor</flavor> | ||
</component> | ||
</pf> | ||
</product_flavors> | ||
<product_info> | ||
<product_name>QCS8300.LE.1.0</product_name> | ||
<chipid flavor="default" storage_type="ufs" flash_phase="1">QCS8300</chipid> | ||
<chipid flavor="sail_nor" storage_type="spinor" flash_phase="2">QCS8300</chipid> | ||
<additional_chipid>QCS8275</additional_chipid> | ||
<meta_type>SPF</meta_type> | ||
</product_info> | ||
<builds_flat> | ||
<build> | ||
<name>apps</name> | ||
<role>apps</role> | ||
<chipset>QCS8300</chipset> | ||
<windows_root_path>.\</windows_root_path> | ||
<linux_root_path>./</linux_root_path> | ||
<image_dir>apps_proc</image_dir> | ||
</build> | ||
<build> | ||
<name>common</name> | ||
<role>common</role> | ||
<chipset>QCS8300</chipset> | ||
<windows_root_path>.\</windows_root_path> | ||
<linux_root_path>./</linux_root_path> | ||
<image_dir>common</image_dir> | ||
<device_programmer> | ||
<file_name>prog_firehose_ddr.elf</file_name> | ||
<file_path>.</file_path> | ||
</device_programmer> | ||
<device_programmer firehose_type="lite"> | ||
<file_name>prog_firehose_lite.elf</file_name> | ||
<file_path>.</file_path> | ||
</device_programmer> | ||
<download_file> | ||
<fastboot_complete>{partition_name}</fastboot_complete> | ||
<file_name>{image_name}</file_name> | ||
<file_path>.</file_path> | ||
</download_file> | ||
<partition_file> | ||
<storage_type>{storage_type}</storage_type> | ||
<file_name>{partition_file_name}</file_name> | ||
<file_path flavor="default">.</file_path> | ||
</partition_file> | ||
<partition_patch_file> | ||
<storage_type>{storage_type}</storage_type> | ||
<file_name>{partition_patch_file_name}</file_name> | ||
<file_path flavor="default">.</file_path> | ||
</partition_patch_file> | ||
<download_file storage_type="spinor" fastboot_complete="SAIL_HYP"> | ||
<file_name>sailfreertos.elf</file_name> | ||
<file_path flavor="sail_nor">./sail_nor</file_path> | ||
</download_file> | ||
<download_file storage_type="spinor" flavor="sail_nor"> | ||
<file_name>gpt_main0.bin</file_name> | ||
<file_path flavor="sail_nor">./sail_nor</file_path> | ||
</download_file> | ||
<download_file storage_type="spinor" flavor="sail_nor"> | ||
<file_name>gpt_backup0.bin</file_name> | ||
<file_path flavor="sail_nor">./sail_nor</file_path> | ||
</download_file> | ||
<partition_file storage_type="spinor" flavor="sail_nor"> | ||
<file_name>rawprogram0.xml</file_name> | ||
<file_path flavor="sail_nor">./sail_nor</file_path> | ||
</partition_file> | ||
<partition_patch_file storage_type="spinor" flavor="sail_nor"> | ||
<file_name>patch0.xml</file_name> | ||
<file_path flavor="sail_nor">./sail_nor</file_path> | ||
</partition_patch_file> | ||
</build> | ||
</builds_flat> | ||
</contents> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.