Skip to content
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

Add documentation for building and running SOF under Zephyr #297

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

lyakh
Copy link
Contributor

@lyakh lyakh commented Oct 16, 2020

SOF can be built as a Zephyr application. This document describes the process.

:depth: 3

This guide describes the process of building and running |SOF| as a Zephyr
application.
Copy link
Member

Choose a reason for hiding this comment

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

I would add a note here that it needs v1.6 onwards and is limited to some SOF platforms atm like CAVS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lgirdwood Sure, can add, but in fact west will make sure to check out a suitable SOF version, and if you choose to override that, well, you better know what you're doing :-)

.. code-block:: bash

west build -p -d build-apl -b up_squared_adsp zephyr/samples/audio/sof/ -- -DCMAKE_C_FLAGS=-Izephyr/lib/libc/minimal/include/
west sign -d build-apl -t rimage -- -k modules/audio/sof/keys/otc_private_key.pem

Choose a reason for hiding this comment

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

I got FATAL ERROR: rimage not found; either install it or provide --tool-path here, seem west doesn't help to build the rimage, I think you may also add some documentation here to describe how rimage is built.

Copy link
Member

Choose a reason for hiding this comment

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

rimage should be checked out by west ? @lyakh are we missing some init to put rimage in zephyr $PATH.

Copy link

@aiChaoSONG aiChaoSONG Oct 20, 2020

Choose a reason for hiding this comment

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

I mean, west build -p -d build-apl -b up_squared_adsp zephyr/samples/audio/sof/ -- -DCMAKE_C_FLAGS=-Izephyr/lib/libc/minimal/include/ this line doesn't help to build rimage, I think. Or I do have zephyr PATH issue, but there should be some docs to describe rimage

Copy link
Member

Choose a reason for hiding this comment

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

@aiChaoSONG there is a tool called west that should do this for you and check out rimage and install in your zephyr $PATH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lgirdwood FWIW west isn't even fetching rimage for me, let alone building and installing it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

west doesn't support git submodules (which is quite understandable) so this guide is missing at least one git submodule --init update command.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Support for submodules has just been merged in west. To try it:

pip3 uninstall west
git clone https://github.com/zephyrproject-rtos/west && \
   (cd west && pip3 install --editable .)

Then add submodules: true in the SOF section, see incoming documentation at https://github.com/zephyrproject-rtos/zephyr/pull/31241/files"git submodules in projects"

@lgirdwood
Copy link
Member

@lyakh ping are you able to fixup today for merge ?

@lyakh
Copy link
Contributor Author

lyakh commented Oct 23, 2020

@lyakh ping are you able to fixup today for merge ?

@lgirdwood sure, could do, I wasn't updating this because the actual trees aren't in the state that we want to have them in. We want to only need to issue west init; west build; west sign So the documentation has to reflect the way you build Zephyr+SOF today but this is rather unreliable because the state changes daily, so what we document today will probably be outdated on Monday.
We could mitigate that a bit by pushing a branch to SOF's Zephyr clone and not touching it until upstreaming has completed. Shall I do that? Any preference for the branch name?

@marc-hb
Copy link
Collaborator

marc-hb commented Oct 24, 2020

So the documentation has to reflect the way you build Zephyr+SOF today but this is rather unreliable because the state changes daily, so what we document today will probably be outdated on Monday.

In other words this should for now be in a wiki.

@lyakh
Copy link
Contributor Author

lyakh commented Oct 27, 2020

@lyakh ping are you able to fixup today for merge ?

@lgirdwood updated. This is still a temporary version with workarounds for the current intermediate status. Please, have a look whether we want it in this form for now or we want to wait until it's all upstream and then basically just say: "follow zephyr guide with 'xxx-adsp-yyy' as a board, then copy the firmware under /lib/firmware/..." and that's it?

cd rimage/build
cmake ..
make
sudo make install
Copy link
Collaborator

@marc-hb marc-hb Oct 27, 2020

Choose a reason for hiding this comment

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

I never had to install rimage, this is weird.

Maybe also a short warning that Zephyr has its own, duplicate copy of rimage that is not used right now? (it hasn't sorry for the noise) thesofproject/sof#3517

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 never had to install rimage, this is weird.

@marc-hb I think SOF uses rimage directly from its build directory, whereas Zephyr calls rimage from its signing code by searching standard executable paths or using a command-line parameter

Copy link
Collaborator

@marc-hb marc-hb Oct 28, 2020

Choose a reason for hiding this comment

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

I just saw that west sign has a -p, --tool-path option. Can you try it and mention it as an alternative to sudo?

AFAIK neither Zephyr or SOF ever required root access to build anything (as they should) so this single sudo line would tear all that down. Security concerns aside, root access is a blocker for people using (powerful) shared systems - and you DO need powerful systems if you want to perform any kind of serious sanitycheck testing.

Repeatedly installing is also repetitive and error prone when testing full-of-crashes-rimage itself.


If you need a different SOF version than the one automatically checked out
by ``west``, you can change to ``modules/audio/sof`` and use ``git`` to
select your preferred version. You need at least version 1.6 to use it with
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add: "make sure you branch or tag your code in git otherwise west update may lose it. See the west user guide."

@lgirdwood
Copy link
Member

@lyakh ping - can we merge this for v1.7

@lgirdwood
Copy link
Member

@lyakh ping, can you fix any technical comments. Dont worry too much about grammar as @deb-intel can fix-up.

SOF can be built as a Zephyr application. This document describes
the process.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
@lyakh
Copy link
Contributor Author

lyakh commented Jan 20, 2021

The updated version needs thesofproject/sof#3764

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@deb-intel fyi - technical side good.

@lgirdwood
Copy link
Member

@lyakh looks like the pR is failing CI

waiting for workers...
/home/travis/build/thesofproject/sof-docs/getting_started/build-guide/build-with-zephyr.rst:4: WARNING: Title underline too short.
Build SOF with `Zephyr <https://zephyrproject.org/>`__
#####################
/home/travis/build/thesofproject/sof-docs/getting_started/build-guide/build-with-zephyr.rst:50: WARNING: Content block expected for the "note" directive; none found.

Can you fix.

@deb-intel deb-intel merged commit 95979ba into thesofproject:master Jan 25, 2021
@lyakh lyakh deleted the zephyr branch February 2, 2021 14:18
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.

5 participants