Improve gen_partitions script#70
Merged
lumag merged 3 commits intoqualcomm-linux:mainfrom Feb 13, 2026
Merged
Conversation
partition_entries_dict was set as a dict, but it is really just a list. the 'key' is set to an index which is never used. Let's convert to a proper list to make the code more readable. There is no functional change. Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
The disk and partitions data is first read from the partition conf file into an intermediate list, and it is parsed into actual/usable data later, inside generate_partition_xml() which is slightly convoluted. Instead, let's parse all input files in a first step before we start the actual generation of partition xml file. In this commit, move the parsing of disk_options first. Use that as an opportunity to remove the global/static disk_params, and make a copy from disk_options(). Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
The parsing of the partition entries is embedded deep into generate_multi_lun_xml() which makes the code difficult to parse/understand. Instead let's first parse the partition conf file and create a proper data structure for it. Then adjust the generate_multi_lun_xml() to use the new data struct. The config file contains the list of all partitions that are needed, on all the physical partitions (aks LUN in UFS). The data structure to store all information is a dict where the key is the phys_part, and the value is the list of all partitions on this specific physical part. The new implementation is much more flexible, in particular, we no longer hardcode the max phys_part to 5, and make no assumption on how many phys_part there (it's 1 or more). There is no functional change and the generated XML files are the same. Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
koenkooi
approved these changes
Feb 11, 2026
lumag
approved these changes
Feb 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I am always bothered with the implementation of gen_partitions.py each time I need to have a look at it.
This PR brings some (hopefully) nice readability improvements.
I've tested that all existing conf file in the tree still generate the exact same output