Skip to content

Conversation

@dcpleung
Copy link
Member

@dcpleung dcpleung commented Nov 17, 2025

After removal of SOF from manifest, if rimage is in path, the build would fail because the gen-uuid-reg.py cannot be found anymore. To fix this, use the rimage config path to find the SOF directory since the rimage config path is a directory under SOF. This would allow rimage to again sign images to run on hardware.

@dcpleung dcpleung linked an issue Nov 17, 2025 that may be closed by this pull request
1 task
@dcpleung dcpleung marked this pull request as ready for review November 17, 2025 20:43
@zephyrbot zephyrbot added the area: West West utility label Nov 17, 2025
Copy link
Contributor

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

This looks like a minor hack but still a hack: why is sof.git not in any manifest?

You can combine SOF with any moving Zephyr version of your choice using sof/west.yml + a "submanifest". Example:

thesofproject/sof@f777417

This was not theoretical, this submanifest example was used "for real" in CI for a long time.

I regularly get lost in west "import" flexibility, yet none is suitable here? Just wondering about the use case. I suspect using an "out-of-manifest" Zephyr module causes other complications beyond this one?

sof_src_dir = pathlib.Path(os.getenv("SOF_SRC_DIR"))
else:
try:
sof_proj = command.manifest.get_projects(['sof'], allow_paths=False)
Copy link
Contributor

@marc-hb marc-hb Nov 18, 2025

Choose a reason for hiding this comment

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

Since 1a780f9 this is dead code, no point keeping it.

EDIT: I mean dead code unless sof/west.yml downloads... SOF recursively :-D

EDIT2: correction: or, someone combines zephyr/west.yml with some submanifest that downloads SOF. Looks like I got lost again in west infinite possibilities...

Copy link
Contributor

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

I just remembered there is already west config rimage.path ... and also west sign --tool-path ....

Considering rimage has been merged back into sof a long time ago, maybe sof_src_dir could be automagically inferred from one of these when not found in the manifest, avoiding one extra configuration item.

If one new configuration item can really not be avoided, then west config ... is more flexible, IMHO more convenient and a new environment variable and more consistent with where rimage configuration already is.

My 2 cents.

@dcpleung dcpleung force-pushed the intel_adsp/fix_rimage_sign branch from 478a2a5 to e863ff2 Compare December 3, 2025 22:56
@dcpleung dcpleung changed the title west: sign/rimage: use env var SOF_SRC_DIR for SOF source dir west: sign/rimage: use rimage config to find SOF directory Dec 3, 2025
@dcpleung
Copy link
Member Author

dcpleung commented Dec 3, 2025

Modified to use the rimage config path to find the SOF directory.

@dcpleung dcpleung force-pushed the intel_adsp/fix_rimage_sign branch from e863ff2 to 536b2aa Compare December 3, 2025 23:05
Copy link
Contributor

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

No issue with cmake_cache.get('RIMAGE_CONFIG_PATH'), but the logic still does not feel right. For a very long time this code has been:

try:
  to find SOF project in [zephyr/]west.yml
  ...
except: # not found, so assume that the manifest is sof/west.yml      
   ...

Now, SOF has been removed from zephyr/west.yml. But instead of changing the try clause, this PR changes the except clause?!

After this PR, the code looks like:

try:
  to find something that will never be found! # changed location, unchanged code
  ...
except:
  do something that might work in both zephyr/west.yml and sof/west.yml cases?

This PR might work because your new except clause might work in both cases. But it's weird and confusing now.

BTW don't attempt to preserve the try: except: at all costs. An if/then/else might be enough now.

@marc-hb
Copy link
Contributor

marc-hb commented Dec 4, 2025

Obviously: please test this PR in both zephyr/west.yml and sof/west.yml cases.

@dcpleung dcpleung force-pushed the intel_adsp/fix_rimage_sign branch from 536b2aa to 78b1b9c Compare December 4, 2025 19:45
@dcpleung
Copy link
Member Author

dcpleung commented Dec 4, 2025

Change the discovery logic a bit to cover possible scenarios.

@dcpleung dcpleung force-pushed the intel_adsp/fix_rimage_sign branch from 78b1b9c to 7f18fac Compare December 9, 2025 21:12
@dcpleung
Copy link
Member Author

dcpleung commented Dec 9, 2025

Twister does not take west config variable so we still need a way to specific where SOF is, which is via environment variable SOF_SRC_DIR.

Copy link
Contributor

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Wow, this increases the number of ways to find the SOF git clone to four now! But we have only two different, known situations to deal with: zephyr/west.yml and sof/west.yml? Four different solutions for two situations?

This rimage area has alway been difficult to maintain because of the too many different combinations and possibilities; merely reading the (already too long) sign() method is enough to get the corresponding headache: can't touch anything because "you never know". Ideally, that sign method should support fewer variations, not more. In the meantime, each way to find the SOF git clone should at least tell in a source comment what specific situation it is supposed to deal with.

BTW do you know how having rimage in the path affects #99497 (comment) ?

Twister does not take west config variable so we still need a way to specific where SOF is, which is via environment variable SOF_SRC_DIR.

I don't get this: why does twister even need to know about west config? Both the environment variables and the west config approaches have the same advantage of "cutting through" the layer of indirections without them even knowing about it.
It's not like sof_src_dir is something dynamic that depends on the platform or test case.


# Make sure this is the actual SOF directory as
# RIMAGE_CONFIG_PATH may point to somewhere else.
versions_json_file = maybe_sof_dir / 'versions.json'
Copy link
Contributor

Choose a reason for hiding this comment

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

SonarCloud is not far off: this entire versions_json_file.exists() test is repeated 3 times. This is calling for some new test function.

Speaking of functions, the length of this PR (assuming it is justified) is now calling for some new def get_sof_dir() function too that get just return as soon as it finds something.

@dcpleung
Copy link
Member Author

The main reason for needing to find the SOF directory is simply the need to run the UUID generation script.

  1. Having the SOF pulled in via sub-manifest has been working fine before we remove SOF from the the manifest. We are still doing this in our internal CI for testing so this method needs to stay.
  2. The SOF main repo, on the other hand, is pulling Zephyr as a project. So we need to use the root manifest path to find the SOF tree.
  3. Using west config to specify RIMAGE_IMAGE_PATH is mentioned in the documentation. So we have to keep this method to avoid breaking someone's workflow.
  4. However, using west config to specify the config path does not work with twister. That config is never applied during twister builds. So we need another way to specify where to find SOF tree to enable running twister to build and test on hardware.

Whether rimage is in the path or specified via west config rimage.path, the results are the same: unable to run the UUID generation script, and thus failing the signing process.

@dcpleung dcpleung force-pushed the intel_adsp/fix_rimage_sign branch from da08589 to e8a6ede Compare December 10, 2025 21:32
After removal of SOF from manifest, if rimage is in path,
the build would fail because the gen-uuid-reg.py cannot be
found anymore. To fix this, use the rimage config path to
find the SOF directory since the rimage config path is
a directory under SOF. This would allow rimage to again
sign images to run on hardware.

Signed-off-by: Daniel Leung <[email protected]>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INTEL_ADSP: unable to sign after sof removal from manifest

4 participants