Build SOF with Zephyr

This guide describes how to build and run Sound Open Firmware as a Zephyr application.


The following example uses $ZEPHYR_WORKSPACE as the working directory.


The easiest way to build Zephyr is to use its recommended toolchain. Follow instructions in Install a Toolchain for details.

Check out and build

  1. Install west. Zephyr uses west as a source management and building system. Follow the Zephyr Getting Started guide for dependencies and for the west installation.


    If you need a different SOF version than the one that west automatically checks out, change to modules/audio/sof and use git to select your preferred version. You need at least version 1.6 to use it with Zephyr. Make sure you branch or tag your code in git; otherwise, a future west update may lose it. See the west user guide.

  2. Initialize a new west repository. This checks out all Zephyr sources, including SOF:

    west init
    west update
  3. Download rimage if you haven’t already done so:

    git clone --recurse-submodules

    If you need to install a rimage executable on your system, use this repository to build and optionally install one:

    mkdir rimage/build
    cd rimage/build
    cmake ..
      cd -

    You also need it for platform-specific configuration.

  4. Build and sign a firmware image:

    west build -d build-apl -b intel_adsp_cavs15 -p zephyr/samples/audio/sof/
    west sign -d build-apl -p rimage/build/rimage -t rimage -D rimage/config -- -k  nmodules/audio/sof/keys/otc_private_key.pem


After the above instructions are completed, a firmware image is located at build-apl/zephyr/zephyr.ri.

  1. Copy the firmware image (build-apl/zephyr/zephyr.ri) to the usual location on your target system. For example, if it is built natively, enter the following:

    sudo cp build-apl/zephyr/zephyr.ri /lib/firmware/intel/sof/community/sof-cnl.ri
  2. Reboot the system. Note that the location and name of your SOF firmware image may vary by system. Search your kernel logs for a line such as the following to identify which file under /lib/firmware/ your hardware is using:

    sof-audio-pci 0000:00:0e.0: request_firmware intel/sof/community/sof-apl.ri successful

  3. Verify that the new firmware is being used by running the following:

    dmesg | grep zephyr

    You should see a line such as the following:

    sof-audio-pci 0000:00:0e.0: Firmware info: used compiler GCC 9:2:0 zephyr used optimization flags -Os

For firmware log extraction, use zephyr/boards/xtensa/intel_adsp_cavs15/tools/

You might also need to build and update your system audio topology file. For details see Build SOF from scratch.