Skip to content

Commit 326d8e8

Browse files
sound-open-firmware: restore build, semantic fix and enable UBSAN (#12607)
Signed-off-by: Curtis Malainey <[email protected]> Co-authored-by: Vitor Guidi <[email protected]>
1 parent e137231 commit 326d8e8

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

projects/sound-open-firmware/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,20 @@ FROM gcr.io/oss-fuzz-base/base-builder
2323
# Base packages
2424
RUN apt-get -y update && apt-get -y install \
2525
gettext git libc6-dev-i386 libglib2.0-dev libncurses5-dev \
26-
libtool ninja-build python3-pip
26+
libtool ninja-build software-properties-common
27+
28+
# Installing Python3.10 and using it instead of the default Python taken from the base-builder image
29+
# as Zephyr requires >=3.10 and base has 3.8
30+
RUN add-apt-repository ppa:deadsnakes/ppa && \
31+
apt-get update && \
32+
apt-get install -y python3.10 python3.10-distutils python3.10-venv && \
33+
ln --force -s /usr/bin/python3.10 /usr/bin/python3
34+
35+
# Ensure python that was just installed gets precedence over
36+
# the one already installed in /usr/local/bin
37+
ENV PATH="/usr/bin/:${PATH}"
38+
39+
RUN python3 -m ensurepip --upgrade
2740
RUN python3 -m pip install --upgrade pip
2841
RUN pip3 install west
2942

@@ -68,6 +81,6 @@ RUN cd $SRC; touch empty.c; gcc -m32 -c empty.c; ar rs /usr/lib32/libstdc++.a em
6881
# If a user is mounting their local source directory for debugging
6982
# then we need to tell git to chill out and just take the repo. If we
7083
# don't west fails with bogus error messages.
71-
RUN git config --global --add safe.directory /src/sof_workspace/zephyr
84+
RUN git config --global --add safe.directory $SRC/sof_workspace/zephyr
7285

7386
COPY build.sh $SRC/

projects/sound-open-firmware/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ unset CXXFLAGS
3232

3333
cd $SRC/sof_workspace
3434

35-
sof/scripts/fuzz.sh -b -- -DEXTRA_CONF_FILE=stub_build_all_ipc3.conf
35+
sof/scripts/fuzz.sh -b -s $SANITIZER -a $ARCHITECTURE -- -DEXTRA_CONF_FILE=stub_build_all_ipc3.conf -DEXTRA_CFLAGS="-fno-sanitize-recover=all"
3636
cp build-fuzz/zephyr/zephyr.exe $OUT/sof-ipc3
3737

38-
sof/scripts/fuzz.sh -b -- -DEXTRA_CONF_FILE=stub_build_all_ipc4.conf
38+
sof/scripts/fuzz.sh -b -s $SANITIZER -a $ARCHITECTURE -- -DEXTRA_CONF_FILE=stub_build_all_ipc4.conf -DEXTRA_CFLAGS="-fno-sanitize-recover=all"
3939
cp build-fuzz/zephyr/zephyr.exe $OUT/sof-ipc4

projects/sound-open-firmware/fetch-sdk.sh

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,13 @@
1515
#
1616
################################################################################
1717

18-
# Zephyr doesn't provide a "latest" link, so clone the source tree
19-
# that produces the SDK (much smaller than the tarball itself, so
20-
# minimal overhead) and find the latest version tag as a proxy. Will
21-
# likely break if the script is run in the moments between tagging a
22-
# release and the tarball appearing on github, but the risk is low and
23-
# it will recover with a retry.
18+
# use the github API to fetch the latest stable SDK with assets
2419

25-
git clone --filter=tree:0 https://github.com/zephyrproject-rtos/sdk-ng
20+
RELEASES=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/zephyrproject-rtos/sdk-ng/releases)
21+
SDK=$(jq '[.[] | select(.prerelease == false) | {tag: .tag_name, assets: .assets[] | select(.name | contains("linux-x86_64_minimal.tar.xz"))}] | .[0]' <<< $RELEASES)
2622

27-
VER=$(git -C sdk-ng tag -l 'v*' | sort -rV | head -1 | sed 's/v//')
28-
URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$VER/zephyr-sdk-${VER}_linux-x86_64_minimal.tar.xz"
29-
30-
curl -L -o sdk.tar.xz "$URL"
23+
curl -L -o sdk.tar.xz $(jq -r '.assets.browser_download_url' <<< $SDK)
3124
tar xf sdk.tar.xz
3225
rm sdk.tar.xz
3326

34-
zephyr-sdk-$VER/setup.sh -h
27+
zephyr-sdk-$(jq -r ".tag" <<< $SDK | tr -d 'v')/setup.sh -h

projects/sound-open-firmware/project.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fuzzing_engines:
1515
- libfuzzer
1616
sanitizers:
1717
- address
18+
- undefined
1819
architectures:
1920
- i386
2021
main_repo: "https://github.com/thesofproject/sof"

0 commit comments

Comments
 (0)