Skip to content

Commit 1d4e089

Browse files
committed
qemu: support alternate path of qemu binaries
Support using an alternate QEMU path for when we want to use a qemu version not available in the SDK. To use the alternate qemu version, export QEMU_BIN_PATH and point it to the bin directory which contains the qemu executables. For example: export QEMU_BIN_PATH=/usr/local/bin Signed-off-by: Anas Nashif <[email protected]>
1 parent a4cc88a commit 1d4e089

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cmake/emu/qemu.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@ if("${ARCH}" STREQUAL "x86")
33
else()
44
set_ifndef(QEMU_binary_suffix ${ARCH})
55
endif()
6+
7+
set(qemu_alternate_path $ENV{QEMU_BIN_PATH})
8+
if(qemu_alternate_path)
9+
find_program(
10+
QEMU
11+
PATHS ${qemu_alternate_path}
12+
NO_DEFAULT_PATH
13+
NAMES qemu-system-${QEMU_binary_suffix}
14+
)
15+
else()
616
find_program(
717
QEMU
818
qemu-system-${QEMU_binary_suffix}
919
)
20+
endif()
1021

1122
set(qemu_targets
1223
run

doc/application/application.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ hardware. Follow these instructions to run an application via QEMU:
378378
Each time you execute the run command, your application is rebuilt and run
379379
again.
380380

381+
382+
.. note:: The ``run`` target will use the QEMU binary available from the Zephyr
383+
SDK by default. To use an alternate version of QEMU, for example the
384+
version installed on your host or a custom version, set the
385+
environment variable ``QEMU_BIN_PATH`` to the alternate path.
386+
381387
.. _application_debugging:
382388
.. _custom_board_definition:
383389

0 commit comments

Comments
 (0)