Skip to content

Conversation

@lool
Copy link
Contributor

@lool lool commented Sep 10, 2025

Generate contents.xml flash files for Axiom:

  • refactor(debos/flash): Use _ptool as workdir
  • refactor(debos): Patch partitions.conf instead of .xml
  • feat(debos)!: Drop now unused disk_image_type
  • feat(debos): Generate contents.xml

@github-actions
Copy link

Test Results

 3 files  ±0   7 suites  ±0   19m 11s ⏱️ ±0s
22 tests ±0  18 ✅ ±0  0 💤 ±0  4 ❌ ±0 
88 runs  ±0  84 ✅ ±0  0 💤 ±0  4 ❌ ±0 

For more details on these failures, see this check.

Results for commit ce624fe. ± Comparison against base commit 89cba35.

@github-actions
Copy link

@lool
Copy link
Contributor Author

lool commented Sep 10, 2025

The tests actually pass, it's just that I had to give back the RB1 boot test due to foundriesio/linux-qcom#2

@basak-qcom
Copy link
Contributor

What's the rationale for making these changes, please? Perhaps that could go into the commit messages?

@lool
Copy link
Contributor Author

lool commented Sep 11, 2025

What's the rationale for making these changes, please? Perhaps that could go into the commit messages?

Ah yes, I was reluctant to put details because I wasn't sure if I could mention this publicly, but actually I think there is no harm in doing that. While today we test our images with boards in a LAVA instance, the regular device testing infra inside Qualcomm is Axiom. Axiom expects this metadata file called contents.xml that describes the flashing procedure.

This PR leverages ptool's newly gained ability to generate these files, and is making similar adjustments to the filename/pathnames as in rawprogram0.xml for regular/LAVA flashing.

I did put the name in the PR's description, and can change the commit message. I'd like to avoid retriggering a build just for that, so I'll wait until review is complete to update if that makes sense.

Copy link
Contributor

@basak-qcom basak-qcom left a comment

Choose a reason for hiding this comment

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

Assuming this works, this all seems reasonable to me. I haven't reviewed every line in detail and am relying on existing test coverage for confidence that this does what we need and doesn't regress anything.

Minor comments inline.

while read line; do
case "$line" in
"--disk "*)
disk_type="$(echo "$line" | sed -n 's/.*--type=\([^ ]*\).*/\1/p')"
Copy link
Contributor

@basak-qcom basak-qcom Sep 11, 2025

Choose a reason for hiding this comment

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

I'm struggling to review this parsing. Could I suggest using getopt(1) to parse these lines instead? It would less error-prone to find edge case bugs, and I think (but am not certain) it'd look cleaner here then, too.

It might also be worth considering if you've stretched shell a little further that it can sensibly go and switch to Python here instead. The task is nicely abstracted here already I think - something like adjust_partitions_conf.py might work well.

Provided we're testing the various result for various edge cases (I think we are?), then I think it's OK to leave it as-is if you don't think it's worth it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reading you, I first thought that getopt would be a good idea to simplify this, but trying to use it I realized that since I have to reconstruct the line in some cases (when changing filename), it gets a bit ugly and I think sed does a better job.

Here's what I could do to make parsing (by other humans :)) easier:

What do you think?

I agree it's getting a bit of a stretch in shell, but I'm also have a bias to keep the logic in a single place without jumping between files as when branching to external scripts. Perhaps we can indeed address this directly in ptool, or in debos actions?

Copy link
Contributor

Choose a reason for hiding this comment

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

it gets a bit ugly and I think sed does a better job.

Fair enough! I appreciate there are trade-offs.

Perhaps we can indeed address this directly in ptool, or in debos actions?

I haven't spent the time to understand this aspect of ptool and how we're using it in detail. It does seem odd to have to parse and transform something in the form of ptool's input, but from an example file provided upstream, and this suggests that we have a use case that upstream ptool could implement a better interface there for us. That sounds like a upstream feature request to me, and in the meantime I think what you have is fine then. Maybe it's worth leaving an upstream issue open.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added comments with sample inputs and more detailed steps

-t "$contents" \
-o contents.xml
# fix file_name and file_path; qcom-ptool doesn't generate them
# properly
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a bug against qcom-ptool for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah; however, as I can't test this myself, I'm not sure how these pathnames are interpreted; in ptool itself, there are a bunch of partitions.conf and these don't need relative pathnames, so not sure if the changes would be acceptable there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to above, perhaps we should explain our use case in a ptool upstream issue, perhaps combined with the previous case, since it seems to me that we shouldn't be having to parse and transform this file in the first place from an architectural perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was merged in ptool; I've dropped the workaround in this branch

@lool lool changed the title Generate contents.xml Generate contents.xml flash files for Axiom Sep 11, 2025
@lool
Copy link
Contributor Author

lool commented Sep 11, 2025

Let's wait a day or two to see if the qcom-ptool PR get merged or see some pushback...

This will make it easier to add contents.xml support.

Signed-off-by: Loïc Minier <[email protected]>
Infered from qcom-ptool data.

Signed-off-by: Loïc Minier <[email protected]>
@lool lool merged commit 1939dbd into qualcomm-linux:main Sep 22, 2025
12 checks passed
@github-actions
Copy link

Test jobs for commit 6ab99f0

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.

4 participants