-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathsof-qemu-run.sh
More file actions
executable file
·61 lines (50 loc) · 1.66 KB
/
sof-qemu-run.sh
File metadata and controls
executable file
·61 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2026 Intel Corporation. All rights reserved.
# Get the directory of this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOF_WORKSPACE="$(dirname "$(dirname "$SCRIPT_DIR")")"
TARGET="native_sim"
VALGRIND_ARG=""
usage() {
cat <<EOF
Usage: $0 [OPTIONS] [TARGET]
Options:
-h, --help Show this help message and exit
--valgrind Run under valgrind
TARGET The QEMU target name (e.g., native_sim, qemu_xtensa, qemu_xtensa_mmu).
The build directory will be resolved to 'build-<TARGET>' relative
to the workspace. (default: native_sim)
EOF
exit 0
}
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
usage
;;
--valgrind)
VALGRIND_ARG="--valgrind"
;;
*)
# Allow users who pass the directory name directly out of habit to still work
if [[ "$1" == build-* ]]; then
TARGET="${1#build-}"
else
TARGET="$1"
fi
;;
esac
shift
done
BUILD_DIR="${SOF_WORKSPACE}/build-${TARGET}"
# Find and source the zephyr environment script, typically via the sof-venv wrapper
# or directly if running in a known zephyrproject layout.
# We will use the existing helper sof-venv.sh to get the right environment.
# Use the SOF workspace to locate the virtual environment
VENV_DIR="$SOF_WORKSPACE/.venv"
echo "Using SOF environment at $SOF_WORKSPACE"
# start the virtual environment
source ${VENV_DIR}/bin/activate
# Finally run the python script which will now correctly inherit 'west' from the sourced environment.
python3 "${SCRIPT_DIR}/sof-qemu-run.py" --build-dir "${BUILD_DIR}" $VALGRIND_ARG