From 117fc30b9725f34892c1f4a174e6bdeaed68bccc Mon Sep 17 00:00:00 2001 From: gman4001 Date: Fri, 8 May 2026 06:11:29 +0000 Subject: [PATCH 1/3] devcontainer: add devcontainer.json and automations.yaml Add a devcontainer configuration for the SOF repository using the mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04 base image with Python 3.12. This provides a reproducible development environment with cmake, ninja, gcc, and gdb pre-installed. The automations.yaml defines three tasks: - installDeps: installs ninja-build, clang, llvm, device-tree-compiler, python3-pyelftools, libasound2-dev, and west on container start. - westUpdate: runs 'west init -l . && west update' to fetch Zephyr and all manifest dependencies, triggered after installDeps completes. - buildTools: manually-triggered task that runs scripts/build-tools.sh to build host-side tools (logger, ctl, probes, topologies). Signed-off-by: gman4001 Co-authored-by: Ona --- .devcontainer/devcontainer.json | 17 +++++++++++ .ona/automations.yaml | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .ona/automations.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..51d21d3c50f3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "SOF", + "image": "mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04", + "features": { + "ghcr.io/devcontainers/features/python": { + "version": "3.12" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "ms-vscode.cpptools" + ] + } + } +} diff --git a/.ona/automations.yaml b/.ona/automations.yaml new file mode 100644 index 000000000000..0f9ddc448411 --- /dev/null +++ b/.ona/automations.yaml @@ -0,0 +1,53 @@ +tasks: + installDeps: + name: Install SOF build dependencies + description: | + Install system packages required to build SOF firmware and tools: + ninja-build, clang, llvm, device-tree-compiler, python3-pyelftools, + and the west Zephyr meta-tool. + command: | + sudo apt-get update -qq + sudo apt-get install -y \ + ninja-build \ + clang \ + llvm \ + device-tree-compiler \ + python3-pyelftools \ + libasound2-dev \ + libglib2.0-dev \ + libssl-dev \ + pkg-config + pip3 install --user west + echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc + export PATH="$HOME/.local/bin:$PATH" + west --version + triggeredBy: + - postDevcontainerStart + + westUpdate: + name: Initialize west workspace + description: | + Run west init and west update to fetch Zephyr and all SOF manifest + dependencies. This is required before any firmware build. + command: | + export PATH="$HOME/.local/bin:$PATH" + # west init -l uses the local manifest (west.yml) without re-cloning sof + west init -l . + west update --narrow --fetch-opt=--filter=tree:0 + triggeredBy: + - postDevcontainerStart + dependsOn: + - installDeps + + buildTools: + name: Build SOF host tools + description: | + Build the SOF host-side tools (logger, ctl, probes, topologies) using + CMake + Ninja. Run manually after west workspace is initialized. + command: | + export PATH="$HOME/.local/bin:$PATH" + ./scripts/build-tools.sh + triggeredBy: + - manual + dependsOn: + - westUpdate From 77248cf3a6030a2fbd8ef48d18ddb5e378e56c56 Mon Sep 17 00:00:00 2001 From: gman4001 Date: Fri, 8 May 2026 06:57:24 +0000 Subject: [PATCH 2/3] devcontainer: link automations.yaml via gitpod customization Add the gitpod.automationsFile reference so Ona picks up .ona/automations.yaml automatically on environment start. Signed-off-by: gman4001 Co-authored-by: Ona --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 51d21d3c50f3..6dbad8e0caaa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,6 +7,9 @@ } }, "customizations": { + "gitpod": { + "automationsFile": "../.ona/automations.yaml" + }, "vscode": { "extensions": [ "ms-vscode.cmake-tools", From fa02cfe07aeab91ab6fd962c77ba1b2b4b765520 Mon Sep 17 00:00:00 2001 From: gman4001 Date: Fri, 8 May 2026 07:06:28 +0000 Subject: [PATCH 3/3] devcontainer: add Zephyr SDK install task to automations Add installSdk task that: - Reads SDK_VERSION from the fetched zephyr tree - Downloads and installs the matching Zephyr SDK via west sdk install - Patches SDK host tool ELF binaries to use the system dynamic linker (the SDK sysroot uses a hardcoded OE build path that doesn't exist on standard Ubuntu) - Also adds patchelf, anytree, jsonschema to installDeps Signed-off-by: gman4001 Co-authored-by: Ona --- .ona/automations.yaml | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/.ona/automations.yaml b/.ona/automations.yaml index 0f9ddc448411..01bb9aaf67d2 100644 --- a/.ona/automations.yaml +++ b/.ona/automations.yaml @@ -16,8 +16,9 @@ tasks: libasound2-dev \ libglib2.0-dev \ libssl-dev \ - pkg-config - pip3 install --user west + pkg-config \ + patchelf + pip3 install --user west anytree jsonschema echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc export PATH="$HOME/.local/bin:$PATH" west --version @@ -39,6 +40,36 @@ tasks: dependsOn: - installDeps + installSdk: + name: Install Zephyr SDK + description: | + Download and install the Zephyr SDK version matching the workspace + (reads SDK_VERSION from the fetched zephyr tree). Patches SDK host + tool binaries to use the system dynamic linker so they run on Ubuntu. + command: | + export PATH="$HOME/.local/bin:$PATH" + SDK_VERSION=$(cat /workspaces/zephyr/SDK_VERSION) + echo "Installing Zephyr SDK $SDK_VERSION" + west sdk install --version "$SDK_VERSION" -t xtensa-dc233c_zephyr-elf + # The SDK setup.sh -h (host tools) fails without the OE sysroot linker. + # Run setup without -h then patch the ELF interpreter on all host binaries. + ~/zephyr-sdk-${SDK_VERSION}/setup.sh -t xtensa-dc233c_zephyr-elf + SYSROOT=~/zephyr-sdk-${SDK_VERSION}/hosttools/sysroots/x86_64-pokysdk-linux + SYSTEM_LD=$(ls /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 2>/dev/null | head -1) + find "$SYSROOT/usr/bin" -type f -executable | while read f; do + interp=$(readelf -l "$f" 2>/dev/null | grep "program interpreter" | grep -o '/[^]]*') + if [ -n "$interp" ]; then + patchelf --set-interpreter "$SYSTEM_LD" \ + --set-rpath "$SYSROOT/lib:$SYSROOT/usr/lib" "$f" 2>/dev/null + fi + done + echo "export ZEPHYR_SDK_INSTALL_DIR=~/zephyr-sdk-${SDK_VERSION}" >> ~/.bashrc + ~/zephyr-sdk-${SDK_VERSION}/hosttools/sysroots/x86_64-pokysdk-linux/usr/bin/dtc --version + triggeredBy: + - postDevcontainerStart + dependsOn: + - westUpdate + buildTools: name: Build SOF host tools description: | @@ -50,4 +81,4 @@ tasks: triggeredBy: - manual dependsOn: - - westUpdate + - installSdk