Skip to content

Commit 29a0ca8

Browse files
Allow users to build QEMU with system-mode emulation
I'm trying to clean up some of my test scripts, and one issue is that I've got two QEMU builds: one for user-mode emulation and one for system-mode emulation. This adds an autoconf flag that allows me to avoid the duplication. Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent ace389d commit 29a0ca8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ WITH_TUNE ?= @WITH_TUNE@
3636
WITH_ISA_SPEC ?= @WITH_ISA_SPEC@
3737
SYSROOT := $(INSTALL_DIR)/sysroot
3838
ENABLE_LIBSANITIZER ?= @enable_libsanitizer@
39+
QEMU_TARGETS ?= @qemu_targets@
3940

4041
SHELL := /bin/sh
4142
AWK := @GAWK@
@@ -848,7 +849,7 @@ stamps/build-qemu: $(QEMU_SRCDIR) $(QEMU_SRC_GIT)
848849
mkdir $(notdir $@)
849850
cd $(notdir $@) && $</configure \
850851
--prefix=$(INSTALL_DIR) \
851-
--target-list=riscv64-linux-user,riscv32-linux-user \
852+
--target-list=$(QEMU_TARGETS) \
852853
--interp-prefix=$(INSTALL_DIR)/sysroot \
853854
--python=python3
854855
$(MAKE) -C $(notdir $@)

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,15 @@ AS_IF([test "x$enable_libsanitizer" != xno],
257257
[AC_SUBST(enable_libsanitizer, --enable-libsanitizer)],
258258
[AC_SUBST(enable_libsanitizer, --disable-libsanitizer)])
259259

260+
AC_ARG_ENABLE(qemu_system,
261+
[AS_HELP_STRING([--enable-qemu-system],
262+
[Build qemu with system-mode emulation])],
263+
[],
264+
[enable_qemu_system=no]
265+
)
266+
267+
AS_IF([test "x$enable_qemu_system" != xno],
268+
[AC_SUBST(qemu_targets, [riscv64-linux-user,riscv32-linux-user,riscv64-softmmu,riscv32-softmmu])],
269+
[AC_SUBST(qemu_targets, [riscv64-linux-user,riscv32-linux-user])])
270+
260271
AC_OUTPUT

0 commit comments

Comments
 (0)