Skip to content

For linux msm/contents xml flashing#225

Merged
andersson merged 8 commits into
linux-msm:masterfrom
quic-bjorande:for-linux-msm/contents-xml-flashing
May 14, 2026
Merged

For linux msm/contents xml flashing#225
andersson merged 8 commits into
linux-msm:masterfrom
quic-bjorande:for-linux-msm/contents-xml-flashing

Conversation

@quic-bjorande
Copy link
Copy Markdown
Contributor

While QDL has been used primarily in use cases where all binaries are collected in a single directory (a so-called "flat build"), Qualcomm builds are typically found with build artifacts scattered across image-specific paths, with a central directory in the form of the "contents.xml" file.

Among other things, this file describes where tools can find programmers, program, and patch files, it describes the mapping to the image-specific paths, etc.

Add support to the newly introduced "qdl flash" to be pointed at a contents.xml file and flash the build.

Then introduce the new "qdl create-zip" subcommand, which instead of flashing the build constructs a self-contained "flashmap zip" file, which can be distributed and passed directly to "qdl flash".

@quic-bjorande
Copy link
Copy Markdown
Contributor Author

The first 5 patches here are the cleanups and improvements to the relative path already present in #223.
Assuming to be rebasing this ontop of the result of that PR.

@quic-bjorande quic-bjorande force-pushed the for-linux-msm/contents-xml-flashing branch 3 times, most recently from d75bc49 to 8e50bbb Compare May 6, 2026 14:57
Copy link
Copy Markdown
Contributor

@igoropaniuk igoropaniuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some comments

Comment thread program.c
Comment thread program.c
Comment thread util.c
Comment thread qdl.c
Comment thread zipper.c
Comment thread contents.c Outdated
Comment thread contents.c
Comment thread contents.c Outdated
Comment thread contents.c Outdated
Comment thread contents.c Outdated
Throughout the codebase we translate between the storage_type enum and
the string representation of the same, provide a common set of helpers
in util.c, instead of duplicating this table.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
While conceptually the same, the filtering mechanism used to determine
what parts of a contents XML file to be flashed needs to be more
sophisticated than the flashmap case - in addition to the storage types,
the contents XML also have "flavors".

There's sufficient overlap between the two concepts that it makes sense
to present them through the same user interface (qdl flash), with the
same structure of the filter/selection mechanism.

Split the flashmap filter logic into the part that separates filename
and specifier, and the actual filtering. Push the filtering details into
flashmap_load().

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The patch introducing the flash support updated the README, but didn't
update the usage printout. Fix this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
There is a growing number of path concatenation cases, each built on
some memory allocation scheme and some variant of sprintf.

Introduce a pathbuf type and a few primitive operations to reset the
pathbuf, clone a pathbuf, push a path/filename to the pathbuf, get the
path, and truncate the path by dirname().

Also provide a convenient qdl_path_exist() operation to test if the
pathbuf refers to an existing file.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The typical usage of QDL so far has been for the user to manually
specify a programmer, as well as one or more program and patch XML
files, a so called "flat build". Some targets are built around multiple
storage medias (e.g. spinor + nvme), and some targets have a plethora of
sahara programmer files.

This puts a burden on the user to invoke qdl with the right combination
of storage selector, programmer(s), program and patch XML files. It also
adds an extra step to the build, in form of flattening the Qualcomm
builds.

The Qualcomm builds are described by a toplevel contents.xml file, which
describes to the various tools (e.g. the flattening tool) what
programmer, rawprogram, and patch files to use, and it provides mapping
of each referred file into the build directory structure.

The format also allow multiple "flavors" of flashable content to be
described, across multiple storage types.

Introduce support for parsing contents.xml files to allow the user to
flash non-flattened builds, across one or more storage devices and
filtered by select flavors.

The "qdl flash" operation is overloaded, to create a coherent user
experience. The filter/specifier interpretation is extended to allow
each, comma-separated, entry to describe storage types and flavors.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Introduce two initial set of test cases for the newly introduced
contents.xml handling.

One is used to validate the storage and flavor selector logic, and the
other more broadly the loading of contents.xml files.

Extract the common operation of creating a temporary directory to a new
file that is shared across tests.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Newer targets require multiple programmers to be used, and while the
current flashmap format does specify an array of programmers it does not
allow the Sahara id to be specified.

Replace the flat array with an object, keyed on the Sahara image id to
allow specifying the arbitrary number of programmers the platform might
need.

As this change has not made it into the formal specification, the
version is forked with a "-qdl" suffix.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
The single-file format of the flashmap zip lends itself very well for
distributing builds, but the tools for generating one isn't broadly
available.

Implement a new "create-zip" operation in QDL, which parses a build from
a contents.xml, generates a flashmap.json and packages all the files
into a flashmap zip file.

The internal structure is flattened and file names are adjusted to avoid
conflicts.

Sparse files are written to the file by storing the relevant chunks in
their decoded form, rather than storing the sparse file (or full
unsparsed file). From an implementation point of view this is easier, as
we don't keep the sparsed program entry around, but it has the two
benefits of us not storing DONT_CARE entries, and it avoids the need for
seeking as we flash the zip file.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
@quic-bjorande quic-bjorande force-pushed the for-linux-msm/contents-xml-flashing branch from 8c69d4d to fb3b622 Compare May 14, 2026 02:04
@andersson andersson merged commit cc6d9c3 into linux-msm:master May 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants