New build system, with "fake in-tree builds" support.

Missing:
 * converting configure tests
 * converting unit tests
 * converting some remaining parts of the installation
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAl8/ov8UHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroP/VQgAiW+iEL2pdNZmw+VgZjdWZwMjiut7
 6gVt8QrCfYoi0HphEJ5oW0+PGTEd+ZfHmZGY3596MvERHbnzIooBVd8dT6HP9ov3
 VC2/RodgxfqEdHLYB3HbZui8cY4W+xz+epmm6V3GO8tk04mU//sT3RZOJUw5/4QE
 N3NSrUY9gPnb1TQ6tZYOFAoJBxPfCG7W0M/hRFU5qFeiufkczey4WQrQDetniqnU
 vsJ7/I/NRJZECac+ifHMF49j/sTUJ6E8D/7cF0MJNKsaR1IesK8r2vpiSSH+woGr
 Dv6Obt9tdT8xB45lT7bXtlYCkGn0W5PlDHb8xSilUYFzfUnkOwQr7UYwRQ==
 =Whxs
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging

New build system, with "fake in-tree builds" support.

Missing:
* converting configure tests
* converting unit tests
* converting some remaining parts of the installation

# gpg: Signature made Fri 21 Aug 2020 11:33:35 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini-gitlab/tags/for-upstream: (152 commits)
  docs: convert build system documentation to rST
  meson: update build-system documentation
  meson: avoid unstable module warning with Meson 0.56.0 or newer
  meson: convert po/
  meson: convert VNC and dependent libraries to meson
  meson: move SDL and SDL-image detection to meson
  meson: convert sample plugins
  meson: replace create-config with meson configure_file
  rules.mak: drop unneeded macros
  meson: convert check-block
  meson: build texi doc
  docs: automatically track manual dependencies
  meson: sphinx-build
  remove Makefile.target
  rules.mak: remove version.o
  meson: convert systemtap files
  configure: place compatibility symlinks in target directories
  meson: link emulators without Makefile.target
  meson: plugins
  meson: cpu-emu
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-08-21 12:42:49 +01:00
commit 7fd51e68c3
764 changed files with 9203 additions and 7641 deletions

View file

@ -22,9 +22,10 @@ indent_style = tab
indent_size = 8
file_type_emacs = makefile
[*.{c,h}]
[*.{c,h,c.inc,h.inc}]
indent_style = space
indent_size = 4
file_type_emacs = c
[*.sh]
indent_style = space

8
.gitignore vendored
View file

@ -1,3 +1,5 @@
/GNUmakefile
/build/
/.doctrees
/config-devices.*
/config-all-devices.*
@ -18,7 +20,7 @@
/ui/shader/texture-blit-frag.h
/ui/shader/texture-blit-vert.h
/ui/shader/texture-blit-flip-vert.h
/ui/input-keymap-*.c
/ui/input-keymap-*.c.inc
*-timestamp
/*-softmmu
/*-darwin-user
@ -78,7 +80,6 @@
*.msi
*.dll
*.so
*.mo
*.fn
*.ky
*.log
@ -146,7 +147,6 @@ docker-src.*
*~
*.ast_raw
*.depend_raw
trace.h
trace.c
trace-ust.h
trace-ust.h
@ -162,4 +162,4 @@ trace-dtrace-root.h
trace-dtrace-root.dtrace
trace-ust-all.h
trace-ust-all.c
/target/arm/decode-sve.inc.c
/target/arm/decode-sve.c.inc

View file

@ -265,9 +265,9 @@ build-tci:
- make run-tcg-tests-x86_64-softmmu
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
- for tg in $TARGETS ; do
export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
./tests/qtest/boot-serial-test || exit 1 ;
./tests/qtest/cdrom-test || exit 1 ;
done
- QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/qtest/pxe-test
- QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/qtest/pxe-test -m slow
- QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
- QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow

3
.gitmodules vendored
View file

@ -58,3 +58,6 @@
[submodule "roms/qboot"]
path = roms/qboot
url = https://github.com/bonzini/qboot
[submodule "meson"]
path = meson
url = https://github.com/mesonbuild/meson/

1013
Makefile

File diff suppressed because it is too large Load diff

View file

@ -1,215 +1,34 @@
#######################################################################
# Common libraries for tools and emulators
stub-obj-y = stubs/
util-obj-y = crypto/ util/ qobject/ qapi/
qom-obj-y = qom/
qom-obj-y = qom/libqom.fa
#######################################################################
# code used by both qemu system emulation and qemu-img
ifeq ($(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)),y)
chardev-obj-y = chardev/
authz-obj-y = authz/libauthz.fa
authz/libauthz.fa-libs = $(if $(CONFIG_AUTH_PAM),-lpam)
authz-obj-y = authz/
block-obj-y += libblock.fa
block-obj-y = block/ nbd/ scsi/
block-obj-y += block.o blockjob.o job.o
block-obj-y += qemu-io-cmds.o
block-obj-$(CONFIG_REPLICATION) += replication.o
libblock.fa-libs = $(ZSTD_LIBS)
libblock.fa-libs += $(LIBNFS_LIBS)
libblock.fa-libs += $(LIBISCSI_LIBS)
libblock.fa-libs += $(CURL_LIBS)
libblock.fa-libs += $(RBD_LIBS)
libblock.fa-libs += $(GLUSTERFS_LIBS)
libblock.fa-libs += $(VXHS_LIBS)
libblock.fa-libs += $(LIBSSH_LIBS)
libblock.fa-libs += $(BZIP2_LIBS)
libblock.fa-libs += $(LZFSE_LIBS)
libblock.fa-libs += $(if $(CONFIG_LINUX_AIO),-laio)
libblock.fa-libs += $(LIBXML2_LIBS)
block-obj-m = block/
chardev-obj-y = chardev/libchardev.fa
crypto-obj-y = crypto/
crypto-obj-y = crypto/libcrypto.fa
io-obj-y = io/
io-obj-y = io/libio.fa
endif # CONFIG_SOFTMMU or CONFIG_TOOLS
#######################################################################
# storage-daemon-obj-y is code used by qemu-storage-daemon (these objects are
# used for system emulation, too, but specified separately there)
storage-daemon-obj-y = block/ monitor/ qapi/ qom/ storage-daemon/
storage-daemon-obj-y += blockdev.o blockdev-nbd.o iothread.o job-qmp.o
storage-daemon-obj-$(CONFIG_WIN32) += os-win32.o
storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
######################################################################
# Target independent part of system emulation. The long term path is to
# suppress *all* target specific code in case of system emulation, i.e. a
# single QEMU executable should support all CPUs and machines.
ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y += bootdevice.o iothread.o
common-obj-y += dump/
common-obj-y += job-qmp.o
common-obj-y += monitor/
common-obj-y += net/
common-obj-y += qdev-monitor.o
common-obj-$(CONFIG_WIN32) += os-win32.o
common-obj-$(CONFIG_POSIX) += os-posix.o
common-obj-$(CONFIG_LINUX) += fsdev/
common-obj-y += accel/
common-obj-y += migration/
common-obj-y += audio/
common-obj-m += audio/
common-obj-y += hw/
common-obj-m += hw/
common-obj-y += replay/
common-obj-y += ui/
common-obj-m += ui/
common-obj-y += dma-helpers.o
common-obj-$(CONFIG_TPM) += tpm.o
common-obj-y += backends/
common-obj-y += chardev/
common-obj-m += chardev/
common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
qemu-seccomp.o-libs := $(SECCOMP_LIBS)
common-obj-$(CONFIG_FDT) += device_tree.o
common-obj-y += qapi/
endif # CONFIG_SOFTMMU
#######################################################################
# Target-independent parts used in system and user emulation
common-obj-y += cpus-common.o
common-obj-y += hw/
common-obj-y += qom/
common-obj-y += disas/
######################################################################
# Resource file for Windows executables
version-obj-$(CONFIG_WIN32) += $(BUILD_DIR)/version.o
######################################################################
# tracing
util-obj-y += trace/
######################################################################
# guest agent
# FIXME: a few definitions from qapi/qapi-types.o and
# qapi/qapi-visit.o are needed by libqemuutil.a. These should be
# extracted into a QAPI schema module, or perhaps a separate schema.
qga-obj-y = qga/
qga-vss-dll-obj-y = qga/
######################################################################
# contrib
elf2dmp-obj-y = contrib/elf2dmp/
ivshmem-client-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-client/
ivshmem-server-obj-$(CONFIG_IVSHMEM) = contrib/ivshmem-server/
libvhost-user-obj-y = contrib/libvhost-user/
vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
vhost-user-blk-obj-y = contrib/vhost-user-blk/
rdmacm-mux-obj-y = contrib/rdmacm-mux/
vhost-user-input-obj-y = contrib/vhost-user-input/
vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
virtiofsd-obj-y = tools/virtiofsd/
######################################################################
trace-events-subdirs =
trace-events-subdirs += accel/kvm
trace-events-subdirs += accel/tcg
trace-events-subdirs += backends
trace-events-subdirs += backends/tpm
trace-events-subdirs += crypto
trace-events-subdirs += monitor
ifeq ($(CONFIG_USER_ONLY),y)
trace-events-subdirs += linux-user
endif
ifeq ($(CONFIG_BLOCK),y)
trace-events-subdirs += authz
trace-events-subdirs += block
trace-events-subdirs += io
trace-events-subdirs += nbd
trace-events-subdirs += scsi
endif
ifeq ($(CONFIG_SOFTMMU),y)
trace-events-subdirs += audio
trace-events-subdirs += chardev
trace-events-subdirs += hw/9pfs
trace-events-subdirs += hw/acpi
trace-events-subdirs += hw/alpha
trace-events-subdirs += hw/arm
trace-events-subdirs += hw/audio
trace-events-subdirs += hw/block
trace-events-subdirs += hw/block/dataplane
trace-events-subdirs += hw/char
trace-events-subdirs += hw/dma
trace-events-subdirs += hw/hppa
trace-events-subdirs += hw/hyperv
trace-events-subdirs += hw/i2c
trace-events-subdirs += hw/i386
trace-events-subdirs += hw/i386/xen
trace-events-subdirs += hw/ide
trace-events-subdirs += hw/input
trace-events-subdirs += hw/intc
trace-events-subdirs += hw/isa
trace-events-subdirs += hw/mem
trace-events-subdirs += hw/mips
trace-events-subdirs += hw/misc
trace-events-subdirs += hw/misc/macio
trace-events-subdirs += hw/net
trace-events-subdirs += hw/nvram
trace-events-subdirs += hw/pci
trace-events-subdirs += hw/pci-host
trace-events-subdirs += hw/ppc
trace-events-subdirs += hw/rdma
trace-events-subdirs += hw/rdma/vmw
trace-events-subdirs += hw/rtc
trace-events-subdirs += hw/s390x
trace-events-subdirs += hw/scsi
trace-events-subdirs += hw/sd
trace-events-subdirs += hw/sparc
trace-events-subdirs += hw/sparc64
trace-events-subdirs += hw/ssi
trace-events-subdirs += hw/timer
trace-events-subdirs += hw/tpm
trace-events-subdirs += hw/usb
trace-events-subdirs += hw/vfio
trace-events-subdirs += hw/virtio
trace-events-subdirs += hw/watchdog
trace-events-subdirs += hw/xen
trace-events-subdirs += hw/gpio
trace-events-subdirs += hw/riscv
trace-events-subdirs += migration
trace-events-subdirs += net
trace-events-subdirs += ui
endif
trace-events-subdirs += hw/core
trace-events-subdirs += hw/display
trace-events-subdirs += qapi
trace-events-subdirs += qom
trace-events-subdirs += target/arm
trace-events-subdirs += target/hppa
trace-events-subdirs += target/i386
trace-events-subdirs += target/mips
trace-events-subdirs += target/ppc
trace-events-subdirs += target/riscv
trace-events-subdirs += target/s390x
trace-events-subdirs += target/sparc
trace-events-subdirs += util
trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
trace-obj-y = trace-root.o
trace-obj-y += $(trace-events-subdirs:%=%/trace.o)
trace-obj-$(CONFIG_TRACE_UST) += trace-ust-all.o
trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace-root.o
trace-obj-$(CONFIG_TRACE_DTRACE) += $(trace-events-subdirs:%=%/trace-dtrace.o)

View file

@ -1,287 +0,0 @@
# -*- Mode: makefile -*-
BUILD_DIR?=$(CURDIR)/..
include ../config-host.mak
include config-target.mak
include $(SRC_PATH)/rules.mak
ifdef CONFIG_SOFTMMU
include config-devices.mak
endif
$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
ifdef CONFIG_LINUX
QEMU_CFLAGS += -isystem ../linux-headers
endif
QEMU_CFLAGS += -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH) -DNEED_CPU_H
QEMU_CFLAGS+=-iquote $(SRC_PATH)/include
ifdef CONFIG_USER_ONLY
# user emulator name
QEMU_PROG=qemu-$(TARGET_NAME)
QEMU_PROG_BUILD = $(QEMU_PROG)
else
# system emulator name
QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
ifneq (,$(findstring -mwindows,$(SDL_LIBS)))
# Terminate program name with a 'w' because the linker builds a windows executable.
QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF)
$(QEMU_PROG): $(QEMU_PROGW)
$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)")
QEMU_PROG_BUILD = $(QEMU_PROGW)
else
QEMU_PROG_BUILD = $(QEMU_PROG)
endif
endif
PROGS=$(QEMU_PROG) $(QEMU_PROGW)
STPFILES=
config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak
config-devices.h: config-devices.h-timestamp
config-devices.h-timestamp: config-devices.mak
ifdef CONFIG_TRACE_SYSTEMTAP
stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp $(QEMU_PROG)-log.stp
ifdef CONFIG_USER_ONLY
TARGET_TYPE=user
else
TARGET_TYPE=system
endif
tracetool-y = $(SRC_PATH)/scripts/tracetool.py
tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace-events-all $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=stap \
--backends=$(TRACE_BACKENDS) \
--binary=$(bindir)/$(QEMU_PROG) \
--target-name=$(TARGET_NAME) \
--target-type=$(TARGET_TYPE) \
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")
$(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=stap \
--backends=$(TRACE_BACKENDS) \
--binary=$(realpath .)/$(QEMU_PROG) \
--target-name=$(TARGET_NAME) \
--target-type=$(TARGET_TYPE) \
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")
$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=simpletrace-stap \
--backends=$(TRACE_BACKENDS) \
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
$(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
$(call quiet-command,$(TRACETOOL) \
--group=all \
--format=log-stap \
--backends=$(TRACE_BACKENDS) \
--probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
$< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")
else
stap:
endif
.PHONY: stap
all: $(PROGS) stap
# Dummy command so that make thinks it has done something
@true
obj-y += trace/
#########################################################
# cpu emulator library
obj-y += exec.o exec-vary.o
obj-y += accel/
obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
obj-$(CONFIG_TCG) += fpu/softfloat.o
obj-y += target/$(TARGET_BASE_ARCH)/
obj-y += disas.o
obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
LIBS := $(libs_cpu) $(LIBS)
obj-$(CONFIG_PLUGIN) += plugins/
#########################################################
# Linux user emulator target
ifdef CONFIG_LINUX_USER
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
-I$(SRC_PATH)/linux-user/host/$(ARCH) \
-I$(SRC_PATH)/linux-user \
-Ilinux-user/$(TARGET_ABI_DIR)
obj-y += linux-user/
obj-y += gdbstub.o thunk.o
endif #CONFIG_LINUX_USER
#########################################################
# BSD user emulator target
ifdef CONFIG_BSD_USER
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
-I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
obj-y += bsd-user/
obj-y += gdbstub.o
endif #CONFIG_BSD_USER
#########################################################
# System emulator target
ifdef CONFIG_SOFTMMU
obj-y += softmmu/
obj-y += gdbstub.o
obj-y += dump/
obj-y += hw/
obj-y += monitor/
obj-y += qapi/
obj-y += migration/ram.o
LIBS := $(libs_softmmu) $(LIBS)
# Hardware support
ifeq ($(TARGET_NAME), sparc64)
obj-y += hw/sparc64/
else
obj-y += hw/$(TARGET_BASE_ARCH)/
endif
generated-files-y += hmp-commands.h hmp-commands-info.h
generated-files-y += config-devices.h
endif # CONFIG_SOFTMMU
dummy := $(call unnest-vars,,obj-y)
all-obj-y := $(obj-y)
#
# common-obj-m has some crap here, probably as side effect from
# unnest-vars recursing into target directories to fill obj-y and not
# properly handling the -m case.
#
# Clear common-obj-m as workaround. Fixes suspious dependency errors
# when building devices as modules. A bit hackish, but should be ok
# as long as we do not have any target-specific modules.
#
# The meson-based build system currently in development doesn't need
# unnest-vars and will obsolete this workaround.
#
common-obj-m :=
include $(SRC_PATH)/Makefile.objs
dummy := $(call unnest-vars,.., \
authz-obj-y \
block-obj-y \
block-obj-m \
chardev-obj-y \
crypto-obj-y \
qom-obj-y \
io-obj-y \
common-obj-y \
common-obj-m)
all-obj-y += $(common-obj-y)
all-obj-y += $(qom-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
ifdef CONFIG_SOFTMMU
$(QEMU_PROG_BUILD): config-devices.mak
endif
COMMON_LDADDS = ../libqemuutil.a
# build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) $(softmmu-main-y)
$(call LINK, $(filter-out %.mak, $^))
ifdef CONFIG_DARWIN
$(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"REZ","$(TARGET_DIR)$@")
$(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@")
endif
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"GEN","$(TARGET_DIR)$@")
hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$(TARGET_DIR)$@")
clean: clean-target
rm -f *.a *~ $(PROGS)
rm -f $(shell find . -name '*.[od]')
rm -f hmp-commands.h gdbstub-xml.c
rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp
ifdef CONFIG_TRACE_SYSTEMTAP
rm -f *.stp
endif
ifdef CONFIG_FUZZ
include $(SRC_PATH)/tests/qtest/fuzz/Makefile.include
include $(SRC_PATH)/tests/qtest/Makefile.include
fuzz: fuzz-vars
fuzz-vars: QEMU_CFLAGS := $(FUZZ_CFLAGS) $(QEMU_CFLAGS)
fuzz-vars: QEMU_LDFLAGS := $(FUZZ_LDFLAGS) $(QEMU_LDFLAGS)
fuzz-vars: $(QEMU_PROG_FUZZ)
dummy := $(call unnest-vars,, fuzz-obj-y)
$(QEMU_PROG_FUZZ): config-devices.mak $(all-obj-y) $(COMMON_LDADDS) $(fuzz-obj-y)
$(call LINK, $(filter-out %.mak, $^))
endif
install: all
ifneq ($(PROGS),)
$(call install-prog,$(PROGS),$(DESTDIR)$(bindir))
endif
ifdef CONFIG_TRACE_SYSTEMTAP
$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
$(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
$(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
endif
generated-files-y += config-target.h
Makefile: $(generated-files-y)
# Reports/Analysis
#
# The target specific coverage report only cares about target specific
# blobs and not the shared code.
#
%/coverage-report.html:
@mkdir -p $*
$(call quiet-command,\
gcovr -r $(SRC_PATH) --object-directory $(CURDIR) \
-p --html --html-details -o $@, \
"GEN", "coverage-report.html")
.PHONY: coverage-report
coverage-report: $(CURDIR)/reports/coverage/coverage-report.html

View file

@ -1,6 +0,0 @@
common-obj-$(CONFIG_SOFTMMU) += accel.o
obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o
obj-$(CONFIG_KVM) += kvm/
obj-$(CONFIG_TCG) += tcg/
obj-$(CONFIG_XEN) += xen/
obj-y += stubs/

View file

@ -1,2 +0,0 @@
obj-y += kvm-all.o
obj-$(call lnot,$(CONFIG_SEV)) += sev-stub.o

5
accel/kvm/meson.build Normal file
View file

@ -0,0 +1,5 @@
kvm_ss = ss.source_set()
kvm_ss.add(files('kvm-all.c'))
kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c'))
specific_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss)

1
accel/kvm/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-accel_kvm.h"

7
accel/meson.build Normal file
View file

@ -0,0 +1,7 @@
softmmu_ss.add(files('accel.c'))
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: files('qtest.c'))
subdir('kvm')
subdir('tcg')
subdir('xen')
subdir('stubs')

View file

@ -1,6 +0,0 @@
obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
obj-$(call lnot,$(CONFIG_HVF)) += hvf-stub.o
obj-$(call lnot,$(CONFIG_WHPX)) += whpx-stub.o
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o

6
accel/stubs/meson.build Normal file
View file

@ -0,0 +1,6 @@
specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
specific_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c'))
specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
specific_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c'))

View file

@ -1,9 +0,0 @@
obj-$(CONFIG_SOFTMMU) += tcg-all.o
obj-$(CONFIG_SOFTMMU) += cputlb.o
obj-y += tcg-runtime.o tcg-runtime-gvec.o
obj-y += cpu-exec.o cpu-exec-common.o translate-all.o
obj-y += translator.o
obj-$(CONFIG_USER_ONLY) += user-exec.o
obj-$(call lnot,$(CONFIG_SOFTMMU)) += user-exec-stub.o
obj-$(CONFIG_PLUGIN) += plugin-gen.o

View file

@ -34,7 +34,7 @@
#include "qemu/atomic.h"
#include "qemu/atomic128.h"
#include "translate-all.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/mem.h"
#ifdef CONFIG_PLUGIN
#include "qemu/plugin-memory.h"
@ -2354,7 +2354,7 @@ void cpu_stq_le_data(CPUArchState *env, target_ulong ptr, uint64_t val)
#define ATOMIC_MMU_CLEANUP
#define ATOMIC_MMU_IDX get_mmuidx(oi)
#include "atomic_common.inc.c"
#include "atomic_common.c.inc"
#define DATA_SIZE 1
#include "atomic_template.h"

15
accel/tcg/meson.build Normal file
View file

@ -0,0 +1,15 @@
tcg_ss = ss.source_set()
tcg_ss.add(files(
'cpu-exec-common.c',
'cpu-exec.c',
'tcg-runtime-gvec.c',
'tcg-runtime.c',
'translate-all.c',
'translator.c',
))
tcg_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-exec.c'))
tcg_ss.add(when: 'CONFIG_SOFTMMU', if_false: files('user-exec-stub.c'))
tcg_ss.add(when: 'CONFIG_PLUGIN', if_true: files('plugin-gen.c'))
specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files('tcg-all.c', 'cputlb.c'))

1
accel/tcg/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-accel_tcg.h"

View file

@ -26,7 +26,7 @@
#include "translate-all.h"
#include "exec/helper-proto.h"
#include "qemu/atomic128.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "trace/mem.h"
#undef EAX
@ -1189,7 +1189,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
#define ATOMIC_NAME(X) HELPER(glue(glue(atomic_ ## X, SUFFIX), END))
#define EXTRA_ARGS
#include "atomic_common.inc.c"
#include "atomic_common.c.inc"
#define DATA_SIZE 1
#include "atomic_template.h"

View file

@ -1 +0,0 @@
obj-y += xen-all.o

1
accel/xen/meson.build Normal file
View file

@ -0,0 +1 @@
specific_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c'))

View file

@ -1,35 +0,0 @@
common-obj-y = audio.o audio_legacy.o noaudio.o wavaudio.o mixeng.o
common-obj-$(CONFIG_SPICE) += spiceaudio.o
common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o
common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o
common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
common-obj-y += wavcapture.o
coreaudio.o-libs := $(COREAUDIO_LIBS)
dsoundaudio.o-libs := $(DSOUND_LIBS)
# alsa module
common-obj-$(CONFIG_AUDIO_ALSA) += alsa.mo
alsa.mo-objs = alsaaudio.o
alsa.mo-libs := $(ALSA_LIBS)
# oss module
common-obj-$(CONFIG_AUDIO_OSS) += oss.mo
oss.mo-objs = ossaudio.o
oss.mo-libs := $(OSS_LIBS)
# pulseaudio module
common-obj-$(CONFIG_AUDIO_PA) += pa.mo
pa.mo-objs = paaudio.o
pa.mo-libs := $(PULSE_LIBS)
# sdl module
common-obj-$(CONFIG_AUDIO_SDL) += sdl.mo
sdl.mo-objs = sdlaudio.o
sdl.mo-cflags := $(SDL_CFLAGS)
sdl.mo-libs := $(SDL_LIBS)
# jack module
common-obj-$(CONFIG_AUDIO_JACK) += jack.mo
jack.mo-objs = jackaudio.o
jack.mo-libs := $(JACK_LIBS)

30
audio/meson.build Normal file
View file

@ -0,0 +1,30 @@
softmmu_ss.add(files(
'audio.c',
'audio_legacy.c',
'mixeng.c',
'noaudio.c',
'wavaudio.c',
'wavcapture.c',
))
softmmu_ss.add(when: [spice, 'CONFIG_SPICE'], if_true: files('spiceaudio.c'))
softmmu_ss.add(when: [coreaudio, 'CONFIG_AUDIO_COREAUDIO'], if_true: files('coreaudio.c'))
softmmu_ss.add(when: [dsound, 'CONFIG_AUDIO_DSOUND'], if_true: files('dsoundaudio.c'))
softmmu_ss.add(when: ['CONFIG_AUDIO_WIN_INT'], if_true: files('audio_win_int.c'))
audio_modules = {}
foreach m : [
['CONFIG_AUDIO_ALSA', 'alsa', alsa, 'alsaaudio.c'],
['CONFIG_AUDIO_OSS', 'oss', oss, 'ossaudio.c'],
['CONFIG_AUDIO_PA', 'pa', pulse, 'paaudio.c'],
['CONFIG_AUDIO_SDL', 'sdl', sdl, 'sdlaudio.c'],
['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c']
]
if config_host.has_key(m[0])
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
audio_modules += {m[1] : module_ss}
endif
endforeach
modules += {'audio': audio_modules}

1
audio/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-audio.h"

View file

@ -1,7 +0,0 @@
authz-obj-y += base.o
authz-obj-y += simple.o
authz-obj-y += list.o
authz-obj-y += listfile.o
authz-obj-$(CONFIG_AUTH_PAM) += pamacct.o
pamacct.o-libs = -lpam

19
authz/meson.build Normal file
View file

@ -0,0 +1,19 @@
authz_ss = ss.source_set()
authz_ss.add(genh)
authz_ss.add(files(
'base.c',
'list.c',
'listfile.c',
'simple.c',
))
authz_ss.add(when: ['CONFIG_AUTH_PAM', pam], if_true: files('pamacct.c'))
authz_ss = authz_ss.apply(config_host, strict: false)
libauthz = static_library('authz', authz_ss.sources() + genh,
dependencies: [authz_ss.dependencies()],
name_suffix: 'fa',
build_by_default: false)
authz = declare_dependency(link_whole: libauthz,
dependencies: qom)

1
authz/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-authz.h"

View file

@ -1,23 +0,0 @@
common-obj-y += rng.o rng-egd.o rng-builtin.o
common-obj-$(CONFIG_POSIX) += rng-random.o
common-obj-$(CONFIG_TPM) += tpm/
common-obj-y += hostmem.o hostmem-ram.o
common-obj-$(CONFIG_POSIX) += hostmem-file.o
common-obj-y += cryptodev.o
common-obj-y += cryptodev-builtin.o
ifeq ($(CONFIG_VIRTIO_CRYPTO),y)
common-obj-y += cryptodev-vhost.o
common-obj-$(CONFIG_VHOST_CRYPTO) += cryptodev-vhost-user.o
endif
common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
common-obj-$(CONFIG_GIO) += dbus-vmstate.o
dbus-vmstate.o-cflags = $(GIO_CFLAGS)
dbus-vmstate.o-libs = $(GIO_LIBS)

19
backends/meson.build Normal file
View file

@ -0,0 +1,19 @@
softmmu_ss.add([files(
'cryptodev-builtin.c',
'cryptodev.c',
'hostmem-ram.c',
'hostmem.c',
'rng-builtin.c',
'rng-egd.c',
'rng.c',
), numa])
softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: files('vhost-user.c'))
softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: files('cryptodev-vhost-user.c'))
softmmu_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus-vmstate.c'), gio])
subdir('tpm')

View file

@ -1,4 +0,0 @@
common-obj-y += tpm_backend.o
common-obj-y += tpm_util.o
common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o
common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o

8
backends/tpm/meson.build Normal file
View file

@ -0,0 +1,8 @@
tpm_ss = ss.source_set()
tpm_ss.add(files('tpm_backend.c'))
tpm_ss.add(files('tpm_util.c'))
tpm_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
tpm_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
softmmu_ss.add_all(when: 'CONFIG_TPM', if_true: tpm_ss)

1
backends/tpm/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-backends_tpm.h"

1
backends/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-backends.h"

View file

@ -29,7 +29,7 @@
#include "block/nbd.h"
#include "block/qdict.h"
#include "qemu/error-report.h"
#include "module_block.h"
#include "block/module_block.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "qapi/error.h"
@ -433,9 +433,11 @@ static int bdrv_format_is_whitelisted(const char *format_name, bool read_only)
{
static const char *whitelist_rw[] = {
CONFIG_BDRV_RW_WHITELIST
NULL
};
static const char *whitelist_ro[] = {
CONFIG_BDRV_RO_WHITELIST
NULL
};
const char **p;

View file

@ -1,75 +0,0 @@
block-obj-y += raw-format.o vmdk.o vpc.o
block-obj-$(CONFIG_QCOW1) += qcow.o
block-obj-$(CONFIG_VDI) += vdi.o
block-obj-$(CONFIG_CLOOP) += cloop.o
block-obj-$(CONFIG_BOCHS) += bochs.o
block-obj-$(CONFIG_VVFAT) += vvfat.o
block-obj-$(CONFIG_DMG) += dmg.o
block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o qcow2-threads.o
block-obj-$(CONFIG_QED) += qed.o qed-l2-cache.o qed-table.o qed-cluster.o
block-obj-$(CONFIG_QED) += qed-check.o
block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o
block-obj-y += quorum.o
block-obj-y += blkdebug.o blkverify.o blkreplay.o
block-obj-$(CONFIG_PARALLELS) += parallels.o
block-obj-y += blklogwrites.o
block-obj-y += block-backend.o snapshot.o qapi.o
block-obj-$(CONFIG_WIN32) += file-win32.o win32-aio.o
block-obj-$(CONFIG_POSIX) += file-posix.o
block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
block-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o
block-obj-y += null.o mirror.o commit.o io.o create.o amend.o
block-obj-y += throttle-groups.o
block-obj-$(CONFIG_LINUX) += nvme.o
block-obj-y += nbd.o
block-obj-$(CONFIG_SHEEPDOG) += sheepdog.o
block-obj-$(CONFIG_LIBISCSI) += iscsi.o
block-obj-$(if $(CONFIG_LIBISCSI),y,n) += iscsi-opts.o
block-obj-$(CONFIG_LIBNFS) += nfs.o
block-obj-$(CONFIG_CURL) += curl.o
block-obj-$(CONFIG_RBD) += rbd.o
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
block-obj-$(CONFIG_LIBSSH) += ssh.o
block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += write-threshold.o
block-obj-y += backup.o
block-obj-$(CONFIG_REPLICATION) += replication.o
block-obj-y += throttle.o copy-on-read.o
block-obj-y += block-copy.o
block-obj-y += crypto.o
block-obj-y += aio_task.o
block-obj-y += backup-top.o
block-obj-y += filter-compress.o
common-obj-y += monitor/
block-obj-y += monitor/
block-obj-y += stream.o
common-obj-y += qapi-sysemu.o
nfs.o-libs := $(LIBNFS_LIBS)
iscsi.o-cflags := $(LIBISCSI_CFLAGS)
iscsi.o-libs := $(LIBISCSI_LIBS)
curl.o-cflags := $(CURL_CFLAGS)
curl.o-libs := $(CURL_LIBS)
rbd.o-cflags := $(RBD_CFLAGS)
rbd.o-libs := $(RBD_LIBS)
gluster.o-cflags := $(GLUSTERFS_CFLAGS)
gluster.o-libs := $(GLUSTERFS_LIBS)
ssh.o-cflags := $(LIBSSH_CFLAGS)
ssh.o-libs := $(LIBSSH_LIBS)
block-obj-dmg-bz2-$(CONFIG_BZIP2) += dmg-bz2.o
block-obj-$(if $(CONFIG_DMG),m,n) += $(block-obj-dmg-bz2-y)
dmg-bz2.o-libs := $(BZIP2_LIBS)
block-obj-$(if $(CONFIG_LZFSE),m,n) += dmg-lzfse.o
dmg-lzfse.o-libs := $(LZFSE_LIBS)
qcow.o-libs := -lz
linux-aio.o-libs := -laio
io_uring.o-cflags := $(LINUX_IO_URING_CFLAGS)
io_uring.o-libs := $(LINUX_IO_URING_LIBS)
parallels.o-cflags := $(LIBXML2_CFLAGS)
parallels.o-libs := $(LIBXML2_LIBS)

115
block/meson.build Normal file
View file

@ -0,0 +1,115 @@
block_ss.add(genh)
block_ss.add(files(
'accounting.c',
'aio_task.c',
'amend.c',
'backup.c',
'backup-top.c',
'blkdebug.c',
'blklogwrites.c',
'blkreplay.c',
'blkverify.c',
'block-backend.c',
'block-copy.c',
'commit.c',
'copy-on-read.c',
'create.c',
'crypto.c',
'dirty-bitmap.c',
'filter-compress.c',
'io.c',
'mirror.c',
'nbd.c',
'null.c',
'qapi.c',
'qcow2-bitmap.c',
'qcow2-cache.c',
'qcow2-cluster.c',
'qcow2-refcount.c',
'qcow2-snapshot.c',
'qcow2-threads.c',
'qcow2.c',
'quorum.c',
'raw-format.c',
'snapshot.c',
'throttle-groups.c',
'throttle.c',
'vhdx-endian.c',
'vhdx-log.c',
'vhdx.c',
'vmdk.c',
'vpc.c',
'write-threshold.c',
), zstd)
block_ss.add(when: [zlib, 'CONFIG_QCOW1'], if_true: files('qcow.c'))
block_ss.add(when: 'CONFIG_VDI', if_true: files('vdi.c'))
block_ss.add(when: 'CONFIG_CLOOP', if_true: files('cloop.c'))
block_ss.add(when: 'CONFIG_BOCHS', if_true: files('bochs.c'))
block_ss.add(when: 'CONFIG_VVFAT', if_true: files('vvfat.c'))
block_ss.add(when: 'CONFIG_DMG', if_true: files('dmg.c'))
block_ss.add(when: 'CONFIG_QED', if_true: files(
'qed-check.c',
'qed-cluster.c',
'qed-l2-cache.c',
'qed-table.c',
'qed.c',
))
block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallels.c'))
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
block_ss.add(when: 'CONFIG_LIBISCSI', if_true: files('iscsi-opts.c'))
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
block_ss.add(when: 'CONFIG_SHEEPDOG', if_true: files('sheepdog.c'))
block_ss.add(when: ['CONFIG_LINUX_AIO', libaio], if_true: files('linux-aio.c'))
block_ss.add(when: ['CONFIG_LINUX_IO_URING', linux_io_uring], if_true: files('io_uring.c'))
block_modules = {}
modsrc = []
foreach m : [
['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
]
if config_host.has_key(m[0])
if enable_modules
modsrc += files(m[3])
endif
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
block_modules += {m[1] : module_ss}
endif
endforeach
# those are not exactly regular block modules, so treat them apart
if 'CONFIG_DMG' in config_host
foreach m : [
['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
]
if config_host.has_key(m[0])
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
block_modules += {m[1] : module_ss}
endif
endforeach
endif
module_block_py = find_program('../scripts/modules/module_block.py')
module_block_h = custom_target('module_block.h',
output: 'module_block.h',
input: modsrc,
command: [module_block_py, '@OUTPUT0@', modsrc])
block_ss.add(module_block_h)
block_ss.add(files('stream.c'))
softmmu_ss.add(files('qapi-sysemu.c'))
subdir('monitor')
modules += {'block': block_modules}

View file

@ -1,2 +0,0 @@
common-obj-y += block-hmp-cmds.o
block-obj-y += bitmap-qmp-cmds.o

View file

@ -0,0 +1,2 @@
softmmu_ss.add(files('block-hmp-cmds.c'))
block_ss.add(files('bitmap-qmp-cmds.c'))

1
block/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-block.h"

View file

@ -1,2 +0,0 @@
obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
uaccess.o

10
bsd-user/meson.build Normal file
View file

@ -0,0 +1,10 @@
bsd_user_ss.add(files(
'bsdload.c',
'elfload.c',
'main.c',
'mmap.c',
'signal.c',
'strace.c',
'syscall.c',
'uaccess.c',
))

View file

@ -1,29 +0,0 @@
chardev-obj-y += char.o
chardev-obj-$(CONFIG_SOFTMMU) += chardev-sysemu.o
chardev-obj-$(CONFIG_WIN32) += char-console.o
chardev-obj-$(CONFIG_POSIX) += char-fd.o
chardev-obj-y += char-fe.o
chardev-obj-y += char-file.o
chardev-obj-y += char-io.o
chardev-obj-y += char-mux.o
chardev-obj-y += char-null.o
chardev-obj-$(CONFIG_POSIX) += char-parallel.o
chardev-obj-y += char-pipe.o
chardev-obj-$(CONFIG_POSIX) += char-pty.o
chardev-obj-y += char-ringbuf.o
chardev-obj-y += char-serial.o
chardev-obj-y += char-socket.o
chardev-obj-y += char-stdio.o
chardev-obj-y += char-udp.o
chardev-obj-$(CONFIG_WIN32) += char-win.o
chardev-obj-$(CONFIG_WIN32) += char-win-stdio.o
common-obj-$(CONFIG_SOFTMMU) += msmouse.o wctablet.o testdev.o
ifeq ($(CONFIG_BRLAPI),y)
common-obj-m += baum.o
baum.o-cflags := $(SDL_CFLAGS)
baum.o-libs := $(BRLAPI_LIBS)
endif
common-obj-$(CONFIG_SPICE) += spice.o

45
chardev/meson.build Normal file
View file

@ -0,0 +1,45 @@
chardev_ss = ss.source_set()
chardev_ss.add(files(
'char-fe.c',
'char-file.c',
'char-io.c',
'char-mux.c',
'char-null.c',
'char-pipe.c',
'char-ringbuf.c',
'char-serial.c',
'char-socket.c',
'char-stdio.c',
'char-udp.c',
'char.c',
))
chardev_ss.add(when: 'CONFIG_POSIX', if_true: files(
'char-fd.c',
'char-parallel.c',
'char-pty.c',
))
chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
'char-console.c',
'char-win-stdio.c',
'char-win.c',
))
chardev_ss = chardev_ss.apply(config_host, strict: false)
libchardev = static_library('chardev', chardev_ss.sources() + genh,
name_suffix: 'fa',
build_by_default: false)
chardev = declare_dependency(link_whole: libchardev)
softmmu_ss.add(files('chardev-sysemu.c', 'msmouse.c', 'wctablet.c', 'testdev.c'))
softmmu_ss.add(when: ['CONFIG_SPICE', spice], if_true: files('spice.c'))
chardev_modules = {}
if config_host.has_key('CONFIG_BRLAPI') and sdl.found()
module_ss = ss.source_set()
module_ss.add(when: [sdl, brlapi], if_true: files('baum.c'))
chardev_modules += { 'brlapi': module_ss }
endif
modules += { 'chardev': chardev_modules }

1
chardev/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-chardev.h"

1189
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1,4 +0,0 @@
elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o
download.o-cflags := $(CURL_CFLAGS)
download.o-libs := $(CURL_LIBS)

View file

@ -0,0 +1,5 @@
if 'CONFIG_CURL' in config_host
executable('elf2dmp', files('main.c', 'addrspace.c', 'download.c', 'pdb.c', 'qemu_elf.c'),
dependencies: [glib, curl],
install: true)
endif

View file

@ -42,7 +42,7 @@ order build,interface,tests,code,documentation,devel-doc,blobs
# (most common languages first
#
filetype code \.c$ # C
filetype code \.inc.c$ # C
filetype code \.c.inc$ # C
filetype code \.C$ # C++
filetype code \.cpp$ # C++
filetype code \.c\+\+$ # C++

View file

@ -1 +0,0 @@
ivshmem-client-obj-y = ivshmem-client.o main.o

View file

@ -0,0 +1,4 @@
executable('ivshmem-client', files('ivshmem-client.c', 'main.c'),
dependencies: glib,
build_by_default: targetos == 'linux',
install: false)

View file

@ -1 +0,0 @@
ivshmem-server-obj-y = ivshmem-server.o main.o

View file

@ -0,0 +1,4 @@
executable('ivshmem-server', files('ivshmem-server.c', 'main.c'),
dependencies: [qemuutil, rt],
build_by_default: targetos == 'linux',
install: false)

View file

@ -1 +0,0 @@
libvhost-user-obj-y += libvhost-user.o libvhost-user-glib.o

View file

@ -0,0 +1,3 @@
libvhost_user = static_library('vhost-user',
files('libvhost-user.c', 'libvhost-user-glib.c'),
build_by_default: false)

View file

@ -1,3 +0,0 @@
ifdef CONFIG_PVRDMA
rdmacm-mux-obj-y = main.o
endif

View file

@ -0,0 +1,9 @@
if 'CONFIG_PVRDMA' in config_host
# if not found, CONFIG_PVRDMA should not be set
# FIXME: broken on big endian architectures
libumad = cc.find_library('ibumad', required: true)
executable('rdmacm-mux', files('main.c'),
dependencies: [glib, libumad],
build_by_default: false,
install: false)
endif

View file

@ -1 +0,0 @@
vhost-user-blk-obj-y = vhost-user-blk.o

View file

@ -0,0 +1,6 @@
# FIXME: broken on 32-bit architectures
executable('vhost-user-blk', files('vhost-user-blk.c'),
link_with: libvhost_user,
dependencies: qemuutil,
build_by_default: false,
install: false)

View file

@ -1,10 +0,0 @@
vhost-user-gpu-obj-y = vhost-user-gpu.o virgl.o vugbm.o
vhost-user-gpu.o-cflags := $(PIXMAN_CFLAGS) $(GBM_CFLAGS)
vhost-user-gpu.o-libs := $(PIXMAN_LIBS)
virgl.o-cflags := $(VIRGL_CFLAGS) $(GBM_CFLAGS)
virgl.o-libs := $(VIRGL_LIBS)
vugbm.o-cflags := $(GBM_CFLAGS)
vugbm.o-libs := $(GBM_LIBS)

View file

@ -0,0 +1,13 @@
if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host
executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
link_with: libvhost_user,
dependencies: [qemuutil, pixman, gbm, virgl],
install: true,
install_dir: get_option('libexecdir'))
configure_file(input: '50-qemu-gpu.json.in',
output: '50-qemu-gpu.json',
configuration: config_host,
install_dir: config_host['qemu_datadir'] / 'vhost-user')
endif

View file

@ -1 +0,0 @@
vhost-user-input-obj-y = main.o

View file

@ -0,0 +1,5 @@
executable('vhost-user-input', files('main.c'),
link_with: libvhost_user,
dependencies: qemuutil,
build_by_default: targetos == 'linux',
install: false)

View file

@ -1 +0,0 @@
vhost-user-scsi-obj-y = vhost-user-scsi.o

View file

@ -0,0 +1,7 @@
if 'CONFIG_LIBISCSI' in config_host
executable('vhost-user-scsi', files('vhost-user-scsi.c'),
link_with: libvhost_user,
dependencies: [qemuutil, libiscsi],
build_by_default: targetos == 'linux',
install: false)
endif

View file

@ -12,7 +12,9 @@
#include "qemu/osdep.h"
#include <iscsi/iscsi.h>
#define inline __attribute__((gnu_inline)) /* required for libiscsi v1.9.0 */
#include <iscsi/scsi-lowlevel.h>
#undef inline
#include "contrib/libvhost-user/libvhost-user-glib.h"
#include "standard-headers/linux/virtio_scsi.h"

View file

@ -1,43 +0,0 @@
crypto-obj-y = init.o
crypto-obj-y += hash.o
crypto-obj-$(CONFIG_NETTLE) += hash-nettle.o
crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += hash-gcrypt.o
crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) += hash-glib.o
crypto-obj-y += hmac.o
crypto-obj-$(CONFIG_NETTLE) += hmac-nettle.o
crypto-obj-$(CONFIG_GCRYPT_HMAC) += hmac-gcrypt.o
crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT_HMAC),n,y)) += hmac-glib.o
crypto-obj-y += aes.o
crypto-obj-y += desrfb.o
crypto-obj-y += cipher.o
crypto-obj-$(CONFIG_AF_ALG) += afalg.o
crypto-obj-$(CONFIG_AF_ALG) += cipher-afalg.o
crypto-obj-$(CONFIG_AF_ALG) += hash-afalg.o
crypto-obj-$(CONFIG_GNUTLS) += tls-cipher-suites.o
crypto-obj-y += tlscreds.o
crypto-obj-y += tlscredsanon.o
crypto-obj-y += tlscredspsk.o
crypto-obj-y += tlscredsx509.o
crypto-obj-y += tlssession.o
crypto-obj-y += secret_common.o
crypto-obj-y += secret.o
crypto-obj-$(CONFIG_SECRET_KEYRING) += secret_keyring.o
crypto-obj-y += pbkdf.o
crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o
crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += pbkdf-gcrypt.o
crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) += pbkdf-stub.o
crypto-obj-y += ivgen.o
crypto-obj-y += ivgen-essiv.o
crypto-obj-y += ivgen-plain.o
crypto-obj-y += ivgen-plain64.o
crypto-obj-y += afsplit.o
crypto-obj-$(CONFIG_QEMU_PRIVATE_XTS) += xts.o
crypto-obj-y += block.o
crypto-obj-y += block-qcow.o
crypto-obj-y += block-luks.o
util-obj-$(CONFIG_GCRYPT) += random-gcrypt.o
util-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o
util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,$(CONFIG_RNG_NONE))) += random-none.o
util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,$(if $(CONFIG_RNG_NONE),n,y))) += random-platform.o
util-obj-y += aes.o init.o

63
crypto/meson.build Normal file
View file

@ -0,0 +1,63 @@
crypto_ss = ss.source_set()
crypto_ss.add(genh)
crypto_ss.add(files(
'afsplit.c',
'block-luks.c',
'block-qcow.c',
'block.c',
'cipher.c',
'desrfb.c',
'hash.c',
'hmac.c',
'ivgen-essiv.c',
'ivgen-plain.c',
'ivgen-plain64.c',
'ivgen.c',
'pbkdf.c',
'secret_common.c',
'secret.c',
'tlscreds.c',
'tlscredsanon.c',
'tlscredspsk.c',
'tlscredsx509.c',
'tlssession.c',
))
if 'CONFIG_GCRYPT' in config_host
wo_nettle = files('hash-gcrypt.c', 'pbkdf-gcrypt.c')
else
wo_nettle = files('hash-glib.c', 'pbkdf-stub.c')
endif
if 'CONFIG_GCRYPT_HMAC' not in config_host
wo_nettle += files('hmac-glib.c')
endif
crypto_ss.add(when: [nettle, 'CONFIG_NETTLE'],
if_true: files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'),
if_false: wo_nettle)
crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
crypto_ss.add(when: 'CONFIG_GCRYPT_HMAC', if_true: files('hmac-gcrypt.c'))
crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c'))
crypto_ss = crypto_ss.apply(config_host, strict: false)
libcrypto = static_library('crypto', crypto_ss.sources() + genh,
dependencies: [crypto_ss.dependencies()],
name_suffix: 'fa',
build_by_default: false)
crypto = declare_dependency(link_whole: libcrypto,
dependencies: [authz, qom])
util_ss.add(files('aes.c'))
util_ss.add(files('init.c'))
if 'CONFIG_GCRYPT' in config_host
util_ss.add(files('random-gcrypt.c'))
elif 'CONFIG_GNUTLS' in config_host
util_ss.add(files('random-gnutls.c'), gnutls)
elif 'CONFIG_RNG_NONE' in config_host
util_ss.add(files('random-none.c'))
else
util_ss.add(files('random-platform.c'))
endif

1
crypto/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-crypto.h"

View file

@ -1,30 +0,0 @@
common-obj-$(CONFIG_ALPHA_DIS) += alpha.o
common-obj-$(CONFIG_ARM_DIS) += arm.o
common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
libvixldir = $(SRC_PATH)/disas/libvixl
# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
# some signed-unsigned equality comparisons in libvixl which later gcc
# versions do not.
arm-a64.o-cflags := -I$(libvixldir) -Wno-sign-compare
common-obj-$(CONFIG_CRIS_DIS) += cris.o
common-obj-$(CONFIG_HPPA_DIS) += hppa.o
common-obj-$(CONFIG_I386_DIS) += i386.o
common-obj-$(CONFIG_M68K_DIS) += m68k.o
common-obj-$(CONFIG_MICROBLAZE_DIS) += microblaze.o
common-obj-$(CONFIG_MIPS_DIS) += mips.o
common-obj-$(CONFIG_NANOMIPS_DIS) += nanomips.o
common-obj-$(CONFIG_NIOS2_DIS) += nios2.o
common-obj-$(CONFIG_MOXIE_DIS) += moxie.o
common-obj-$(CONFIG_PPC_DIS) += ppc.o
common-obj-$(CONFIG_RISCV_DIS) += riscv.o
common-obj-$(CONFIG_S390_DIS) += s390.o
common-obj-$(CONFIG_SH4_DIS) += sh4.o
common-obj-$(CONFIG_SPARC_DIS) += sparc.o
common-obj-$(CONFIG_LM32_DIS) += lm32.o
common-obj-$(CONFIG_XTENSA_DIS) += xtensa.o
# TODO: As long as the TCG interpreter and its generated code depend
# on the QEMU target, we cannot compile the disassembler here.
#common-obj-$(CONFIG_TCI_DIS) += tci.o

View file

@ -1,5 +0,0 @@
common-obj-$(CONFIG_ARM_A64_DIS) = vixl/utils.o \
vixl/compiler-intrinsics.o \
vixl/a64/instructions-a64.o \
vixl/a64/decoder-a64.o \
vixl/a64/disasm-a64.o

View file

@ -0,0 +1,7 @@
libvixl_ss.add(files(
'vixl/a64/decoder-a64.cc',
'vixl/a64/disasm-a64.cc',
'vixl/a64/instructions-a64.cc',
'vixl/compiler-intrinsics.cc',
'vixl/utils.cc',
))

27
disas/meson.build Normal file
View file

@ -0,0 +1,27 @@
libvixl_ss = ss.source_set()
subdir('libvixl')
common_ss.add(when: 'CONFIG_ALPHA_DIS', if_true: files('alpha.c'))
common_ss.add(when: 'CONFIG_ARM_A64_DIS', if_true: files('arm-a64.cc'))
common_ss.add_all(when: 'CONFIG_ARM_A64_DIS', if_true: libvixl_ss)
common_ss.add(when: 'CONFIG_ARM_DIS', if_true: files('arm.c'))
common_ss.add(when: 'CONFIG_CRIS_DIS', if_true: files('cris.c'))
common_ss.add(when: 'CONFIG_HPPA_DIS', if_true: files('hppa.c'))
common_ss.add(when: 'CONFIG_I386_DIS', if_true: files('i386.c'))
common_ss.add(when: 'CONFIG_LM32_DIS', if_true: files('lm32.c'))
common_ss.add(when: 'CONFIG_M68K_DIS', if_true: files('m68k.c'))
common_ss.add(when: 'CONFIG_MICROBLAZE_DIS', if_true: files('microblaze.c'))
common_ss.add(when: 'CONFIG_MIPS_DIS', if_true: files('mips.c'))
common_ss.add(when: 'CONFIG_MOXIE_DIS', if_true: files('moxie.c'))
common_ss.add(when: 'CONFIG_NANOMIPS_DIS', if_true: files('nanomips.cpp'))
common_ss.add(when: 'CONFIG_NIOS2_DIS', if_true: files('nios2.c'))
common_ss.add(when: 'CONFIG_PPC_DIS', if_true: files('ppc.c'))
common_ss.add(when: 'CONFIG_RISCV_DIS', if_true: files('riscv.c'))
common_ss.add(when: 'CONFIG_S390_DIS', if_true: files('s390.c'))
common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c'))
common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c'))
# TODO: As long as the TCG interpreter and its generated code depend
# on the QEMU target, we cannot compile the disassembler here.
#common_ss.add(when: 'CONFIG_TCI_DIS', if_true: files('tci.c'))

View file

@ -10,7 +10,7 @@
#include "qemu/osdep.h"
#include "sysemu/block-backend.h"
#include "sysemu/dma.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#include "qemu/thread.h"
#include "qemu/main-loop.h"
#include "sysemu/cpus.h"

View file

@ -67,7 +67,7 @@ needs_sphinx = '1.6'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['kerneldoc', 'qmp_lexer', 'hxtool']
extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

View file

@ -62,8 +62,8 @@ A more realistic scenario is verifying the installation of a guest OS:
$ ./qemu-img create raw.img 16G
$ ./qemu-img create -f qcow2 test.qcow2 16G
$ x86_64-softmmu/qemu-system-x86_64 -cdrom debian.iso \
-drive file=blkverify:raw.img:test.qcow2
$ ./qemu-system-x86_64 -cdrom debian.iso \
-drive file=blkverify:raw.img:test.qcow2
If the installation is aborted when blkverify detects corruption, use qemu-io
to explore the contents of the disk image at the sector in question.

500
docs/devel/build-system.rst Normal file
View file

@ -0,0 +1,500 @@
==================================
The QEMU build system architecture
==================================
This document aims to help developers understand the architecture of the
QEMU build system. As with projects using GNU autotools, the QEMU build
system has two stages, first the developer runs the "configure" script
to determine the local build environment characteristics, then they run
"make" to build the project. There is about where the similarities with
GNU autotools end, so try to forget what you know about them.
Stage 1: configure
==================
The QEMU configure script is written directly in shell, and should be
compatible with any POSIX shell, hence it uses #!/bin/sh. An important
implication of this is that it is important to avoid using bash-isms on
development platforms where bash is the primary host.
In contrast to autoconf scripts, QEMU's configure is expected to be
silent while it is checking for features. It will only display output
when an error occurs, or to show the final feature enablement summary
on completion.
Because QEMU uses the Meson build system under the hood, only VPATH
builds are supported. There are two general ways to invoke configure &
perform a build:
- VPATH, build artifacts outside of QEMU source tree entirely::
cd ../
mkdir build
cd build
../qemu/configure
make
- VPATH, build artifacts in a subdir of QEMU source tree::
mkdir build
cd build
../configure
make
For now, checks on the compilation environment are found in configure
rather than meson.build, though this is expected to change. The command
line is parsed in the configure script and, whenever needed, converted
into the appropriate options to Meson.
New checks should be added to Meson, which usually comprises the
following tasks:
- Add a Meson build option to meson_options.txt.
- Add support to the command line arg parser to handle any new
`--enable-XXX`/`--disable-XXX` flags required by the feature.
- Add information to the help output message to report on the new
feature flag.
- Add code to perform the actual feature check.
- Add code to include the feature status in `config-host.h`
- Add code to print out the feature status in the configure summary
upon completion.
Taking the probe for SDL as an example, we have the following pieces
in configure::
# Initial variable state
sdl=auto
..snip..
# Configure flag processing
--disable-gnutls) sdl=disabled
;;
--enable-gnutls) sdl=enabled
;;
..snip..
# Help output feature message
sdl SDL UI
..snip..
# Meson invocation
-Dsdl=$sdl
In meson_options.txt::
option('sdl', type : 'feature', value : 'auto')
In meson.build::
# Detect dependency
sdl = dependency('sdl2',
required: get_option('sdl'),
static: enable_static)
# Create config-host.h
config_host_data.set('CONFIG_SDL', sdl.found())
# Summary
summary_info += {'SDL support': sdl.found()}
Helper functions
----------------
The configure script provides a variety of helper functions to assist
developers in checking for system features:
`do_cc $ARGS...`
Attempt to run the system C compiler passing it $ARGS...
`do_cxx $ARGS...`
Attempt to run the system C++ compiler passing it $ARGS...
`compile_object $CFLAGS`
Attempt to compile a test program with the system C compiler using
$CFLAGS. The test program must have been previously written to a file
called $TMPC.
`compile_prog $CFLAGS $LDFLAGS`
Attempt to compile a test program with the system C compiler using
$CFLAGS and link it with the system linker using $LDFLAGS. The test
program must have been previously written to a file called $TMPC.
`has $COMMAND`
Determine if $COMMAND exists in the current environment, either as a
shell builtin, or executable binary, returning 0 on success.
`path_of $COMMAND`
Return the fully qualified path of $COMMAND, printing it to stdout,
and returning 0 on success.
`check_define $NAME`
Determine if the macro $NAME is defined by the system C compiler
`check_include $NAME`
Determine if the include $NAME file is available to the system C
compiler
`write_c_skeleton`
Write a minimal C program main() function to the temporary file
indicated by $TMPC
`feature_not_found $NAME $REMEDY`
Print a message to stderr that the feature $NAME was not available
on the system, suggesting the user try $REMEDY to address the
problem.
`error_exit $MESSAGE $MORE...`
Print $MESSAGE to stderr, followed by $MORE... and then exit from the
configure script with non-zero status
`query_pkg_config $ARGS...`
Run pkg-config passing it $ARGS. If QEMU is doing a static build,
then --static will be automatically added to $ARGS
Stage 2: Meson
==============
The Meson build system is currently used to describe the build
process for:
1) executables, which include:
- Tools - qemu-img, qemu-nbd, qga (guest agent), etc
- System emulators - qemu-system-$ARCH
- Userspace emulators - qemu-$ARCH
- Some (but not all) unit tests
2) documentation
3) ROMs, which can be either installed as binary blobs or compiled
4) other data files, such as icons or desktop files
The source code is highly modularized, split across many files to
facilitate building of all of these components with as little duplicated
compilation as possible. The Meson "sourceset" functionality is used
to list the files and their dependency on various configuration
symbols.
Various subsystems that are common to both tools and emulators have
their own sourceset, for example `block_ss` for the block device subsystem,
`chardev_ss` for the character device subsystem, etc. These sourcesets
are then turned into static libraries as follows::
libchardev = static_library('chardev', chardev_ss.sources(),
name_suffix: 'fa',
build_by_default: false)
chardev = declare_dependency(link_whole: libchardev)
The special `.fa` suffix is needed as long as unit tests are built with
the older Makefile infrastructure, and will go away later.
Files linked into emulator targets there can be split into two distinct groups
of files, those which are independent of the QEMU emulation target and
those which are dependent on the QEMU emulation target.
In the target-independent set lives various general purpose helper code,
such as error handling infrastructure, standard data structures,
platform portability wrapper functions, etc. This code can be compiled
once only and the .o files linked into all output binaries.
Target-independent code lives in the `common_ss`, `softmmu_ss` and
`user_ss` sourcesets. `common_ss` is linked into all emulators, `softmmu_ss`
only in system emulators, `user_ss` only in user-mode emulators.
In the target-dependent set lives CPU emulation, device emulation and
much glue code. This sometimes also has to be compiled multiple times,
once for each target being built.
All binaries link with a static library `libqemuutil.a`, which is then
linked to all the binaries. `libqemuutil.a` is built from several
sourcesets; most of them however host generated code, and the only two
of general interest are `util_ss` and `stub_ss`.
The separation between these two is purely for documentation purposes.
`util_ss` contains generic utility files. Even though this code is only
linked in some binaries, sometimes it requires hooks only in some of
these and depend on other functions that are not fully implemented by
all QEMU binaries. `stub_ss` links dummy stubs that will only be linked
into the binary if the real implementation is not present. In a way,
the stubs can be thought of as a portable implementation of the weak
symbols concept.
The following files concur in the definition of which files are linked
into each emulator:
`default-configs/*.mak`
The files under default-configs/ control what emulated hardware is built
into each QEMU system and userspace emulator targets. They merely contain
a list of config variable definitions like the machines that should be
included. For example, default-configs/aarch64-softmmu.mak has::
include arm-softmmu.mak
CONFIG_XLNX_ZYNQMP_ARM=y
CONFIG_XLNX_VERSAL=y
`*/Kconfig`
These files are processed together with `default-configs/*.mak` and
describe the dependencies between various features, subsystems and
device models. They are described in kconfig.rst.
These files rarely need changing unless new devices / hardware need to
be enabled for a particular system/userspace emulation target
Support scripts
---------------
Meson has a special convention for invoking Python scripts: if their
first line is `#! /usr/bin/env python3` and the file is *not* executable,
find_program() arranges to invoke the script under the same Python
interpreter that was used to invoke Meson. This is the most common
and preferred way to invoke support scripts from Meson build files,
because it automatically uses the value of configure's --python= option.
In case the script is not written in Python, use a `#! /usr/bin/env ...`
line and make the script executable.
Scripts written in Python, where it is desirable to make the script
executable (for example for test scripts that developers may want to
invoke from the command line, such as tests/qapi-schema/test-qapi.py),
should be invoked through the `python` variable in meson.build. For
example::
test('QAPI schema regression tests', python,
args: files('test-qapi.py'),
env: test_env, suite: ['qapi-schema', 'qapi-frontend'])
This is needed to obey the --python= option passed to the configure
script, which may point to something other than the first python3
binary on the path.
Stage 3: makefiles
==================
The use of GNU make is required with the QEMU build system.
The output of Meson is a build.ninja file, which is used with the Ninja
build system. QEMU uses a different approach, where Makefile rules are
synthesized from the build.ninja file. The main Makefile includes these
rules and wraps them so that e.g. submodules are built before QEMU.
The resulting build system is largely non-recursive in nature, in
contrast to common practices seen with automake.
Tests are also ran by the Makefile with the traditional `make check`
phony target. Meson test suites such as `unit` can be ran with `make
check-unit` too. It is also possible to run tests defined in meson.build
with `meson test`.
The following text is only relevant for unit tests which still have to
be converted to Meson.
All binaries should link to `libqemuutil.a`, e.g.:
qemu-img$(EXESUF): qemu-img.o ..snip.. libqemuutil.a
On Windows, all binaries have the suffix `.exe`, so all Makefile rules
which create binaries must include the $(EXESUF) variable on the binary
name. e.g.
qemu-img$(EXESUF): qemu-img.o ..snip..
This expands to `.exe` on Windows, or an empty string on other platforms.
Variable naming
---------------
The QEMU convention is to define variables to list different groups of
object files. These are named with the convention $PREFIX-obj-y. The
Meson `chardev` variable in the previous example corresponds to a
variable 'chardev-obj-y'.
Likewise, tests that are executed by `make check-unit` are grouped into
a variable check-unit-y, like this:
check-unit-y += tests/test-visitor-serialization$(EXESUF)
check-unit-y += tests/test-iov$(EXESUF)
check-unit-y += tests/test-bitmap$(EXESUF)
When a test or object file which needs to be conditionally built based
on some characteristic of the host system, the configure script will
define a variable for the conditional. For example, on Windows it will
define $(CONFIG_POSIX) with a value of 'n' and $(CONFIG_WIN32) with a
value of 'y'. It is now possible to use the config variables when
listing object files. For example,
check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
On Windows this expands to
check-unit-n += tests/vmstate.exe
Since the `check-unit` target only runs tests included in `$(check-unit-y)`,
POSIX specific tests listed in `$(util-obj-n)` are ignored on the Windows
platform builds.
CFLAGS / LDFLAGS / LIBS handling
--------------------------------
There are many different binaries being built with differing purposes,
and some of them might even be 3rd party libraries pulled in via git
submodules. As such the use of the global CFLAGS variable is generally
avoided in QEMU, since it would apply to too many build targets.
Flags that are needed by any QEMU code (i.e. everything *except* GIT
submodule projects) are put in $(QEMU_CFLAGS) variable. For linker
flags the $(LIBS) variable is sometimes used, but a couple of more
targeted variables are preferred.
In addition to these variables, it is possible to provide cflags and
libs against individual source code files, by defining variables of the
form $FILENAME-cflags and $FILENAME-libs. For example, the test
test-crypto-tlscredsx509 needs to link to the libtasn1 library,
so tests/Makefile.include defines some variables:
tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
The scope is a little different between the two variables. The libs get
used when linking any target binary that includes the curl.o object
file, while the cflags get used when compiling the curl.c file only.
Important files for the build system
====================================
Statically defined files
------------------------
The following key files are statically defined in the source tree, with
the rules needed to build QEMU. Their behaviour is influenced by a
number of dynamically created files listed later.
`Makefile`
The main entry point used when invoking make to build all the components
of QEMU. The default 'all' target will naturally result in the build of
every component. Makefile takes care of recursively building submodules
directly via a non-recursive set of rules.
`*/meson.build`
The meson.build file in the root directory is the main entry point for the
Meson build system, and it coordinates the configuration and build of all
executables. Build rules for various subdirectories are included in
other meson.build files spread throughout the QEMU source tree.
`rules.mak`
This file provides the generic helper rules for invoking build tools, in
particular the compiler and linker.
`tests/Makefile.include`
Rules for building the unit tests. This file is included directly by the
top level Makefile, so anything defined in this file will influence the
entire build system. Care needs to be taken when writing rules for tests
to ensure they only apply to the unit test execution / build.
`tests/docker/Makefile.include`
Rules for Docker tests. Like tests/Makefile, this file is included
directly by the top level Makefile, anything defined in this file will
influence the entire build system.
`tests/vm/Makefile.include`
Rules for VM-based tests. Like tests/Makefile, this file is included
directly by the top level Makefile, anything defined in this file will
influence the entire build system.
Dynamically created files
-------------------------
The following files are generated dynamically by configure in order to
control the behaviour of the statically defined makefiles. This avoids
the need for QEMU makefiles to go through any pre-processing as seen
with autotools, where Makefile.am generates Makefile.in which generates
Makefile.
Built by configure:
`config-host.mak`
When configure has determined the characteristics of the build host it
will write a long list of variables to config-host.mak file. This
provides the various install directories, compiler / linker flags and a
variety of `CONFIG_*` variables related to optionally enabled features.
This is imported by the top level Makefile and meson.build in order to
tailor the build output.
config-host.mak is also used as a dependency checking mechanism. If make
sees that the modification timestamp on configure is newer than that on
config-host.mak, then configure will be re-run.
The variables defined here are those which are applicable to all QEMU
build outputs. Variables which are potentially different for each
emulator target are defined by the next file...
`$TARGET-NAME/config-target.mak`
TARGET-NAME is the name of a system or userspace emulator, for example,
x86_64-softmmu denotes the system emulator for the x86_64 architecture.
This file contains the variables which need to vary on a per-target
basis. For example, it will indicate whether KVM or Xen are enabled for
the target and any other potential custom libraries needed for linking
the target.
Built by Meson:
`${TARGET-NAME}-config-devices.mak`
TARGET-NAME is again the name of a system or userspace emulator. The
config-devices.mak file is automatically generated by make using the
scripts/make_device_config.sh program, feeding it the
default-configs/$TARGET-NAME file as input.
`config-host.h`, `$TARGET-NAME/config-target.h`, `$TARGET-NAME/config-devices.h`
These files are used by source code to determine what features
are enabled. They are generated from the contents of the corresponding
`*.h` files using the scripts/create_config program. This extracts
relevant variables and formats them as C preprocessor macros.
`build.ninja`
The build rules.
Built by Makefile:
`Makefile.ninja`
A Makefile conversion of the build rules in build.ninja. The conversion
is straightforward and, were it necessary to debug the rules produced
by Meson, it should be enough to look at build.ninja. The conversion
is performed by scripts/ninjatool.py.
`Makefile.mtest`
The Makefile definitions that let "make check" run tests defined in
meson.build. The rules are produced from Meson's JSON description of
tests (obtained with "meson introspect --tests") through the script
scripts/mtest2make.py.
Useful make targets
-------------------
`help`
Print a help message for the most common build targets.
`print-VAR`
Print the value of the variable VAR. Useful for debugging the build
system.

View file

@ -1,519 +0,0 @@
The QEMU build system architecture
==================================
This document aims to help developers understand the architecture of the
QEMU build system. As with projects using GNU autotools, the QEMU build
system has two stages, first the developer runs the "configure" script
to determine the local build environment characteristics, then they run
"make" to build the project. There is about where the similarities with
GNU autotools end, so try to forget what you know about them.
Stage 1: configure
==================
The QEMU configure script is written directly in shell, and should be
compatible with any POSIX shell, hence it uses #!/bin/sh. An important
implication of this is that it is important to avoid using bash-isms on
development platforms where bash is the primary host.
In contrast to autoconf scripts, QEMU's configure is expected to be
silent while it is checking for features. It will only display output
when an error occurs, or to show the final feature enablement summary
on completion.
Adding new checks to the configure script usually comprises the
following tasks:
- Initialize one or more variables with the default feature state.
Ideally features should auto-detect whether they are present,
so try to avoid hardcoding the initial state to either enabled
or disabled, as that forces the user to pass a --enable-XXX
/ --disable-XXX flag on every invocation of configure.
- Add support to the command line arg parser to handle any new
--enable-XXX / --disable-XXX flags required by the feature XXX.
- Add information to the help output message to report on the new
feature flag.
- Add code to perform the actual feature check. As noted above, try to
be fully dynamic in checking enablement/disablement.
- Add code to print out the feature status in the configure summary
upon completion.
- Add any new makefile variables to $config_host_mak on completion.
Taking (a simplified version of) the probe for gnutls from configure,
we have the following pieces:
# Initial variable state
gnutls=""
..snip..
# Configure flag processing
--disable-gnutls) gnutls="no"
;;
--enable-gnutls) gnutls="yes"
;;
..snip..
# Help output feature message
gnutls GNUTLS cryptography support
..snip..
# Test for gnutls
if test "$gnutls" != "no"; then
if ! $pkg_config --exists "gnutls"; then
gnutls_cflags=`$pkg_config --cflags gnutls`
gnutls_libs=`$pkg_config --libs gnutls`
libs_softmmu="$gnutls_libs $libs_softmmu"
libs_tools="$gnutls_libs $libs_tools"
QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
gnutls="yes"
elif test "$gnutls" = "yes"; then
feature_not_found "gnutls" "Install gnutls devel"
else
gnutls="no"
fi
fi
..snip..
# Completion feature summary
echo "GNUTLS support $gnutls"
..snip..
# Define make variables
if test "$gnutls" = "yes" ; then
echo "CONFIG_GNUTLS=y" >> $config_host_mak
fi
Helper functions
----------------
The configure script provides a variety of helper functions to assist
developers in checking for system features:
- do_cc $ARGS...
Attempt to run the system C compiler passing it $ARGS...
- do_cxx $ARGS...
Attempt to run the system C++ compiler passing it $ARGS...
- compile_object $CFLAGS
Attempt to compile a test program with the system C compiler using
$CFLAGS. The test program must have been previously written to a file
called $TMPC.
- compile_prog $CFLAGS $LDFLAGS
Attempt to compile a test program with the system C compiler using
$CFLAGS and link it with the system linker using $LDFLAGS. The test
program must have been previously written to a file called $TMPC.
- has $COMMAND
Determine if $COMMAND exists in the current environment, either as a
shell builtin, or executable binary, returning 0 on success.
- path_of $COMMAND
Return the fully qualified path of $COMMAND, printing it to stdout,
and returning 0 on success.
- check_define $NAME
Determine if the macro $NAME is defined by the system C compiler
- check_include $NAME
Determine if the include $NAME file is available to the system C
compiler
- write_c_skeleton
Write a minimal C program main() function to the temporary file
indicated by $TMPC
- feature_not_found $NAME $REMEDY
Print a message to stderr that the feature $NAME was not available
on the system, suggesting the user try $REMEDY to address the
problem.
- error_exit $MESSAGE $MORE...
Print $MESSAGE to stderr, followed by $MORE... and then exit from the
configure script with non-zero status
- query_pkg_config $ARGS...
Run pkg-config passing it $ARGS. If QEMU is doing a static build,
then --static will be automatically added to $ARGS
Stage 2: makefiles
==================
The use of GNU make is required with the QEMU build system.
Although the source code is spread across multiple subdirectories, the
build system should be considered largely non-recursive in nature, in
contrast to common practices seen with automake. There is some recursive
invocation of make, but this is related to the things being built,
rather than the source directory structure.
QEMU currently supports both VPATH and non-VPATH builds, so there are
three general ways to invoke configure & perform a build.
- VPATH, build artifacts outside of QEMU source tree entirely
cd ../
mkdir build
cd build
../qemu/configure
make
- VPATH, build artifacts in a subdir of QEMU source tree
mkdir build
cd build
../configure
make
- non-VPATH, build artifacts everywhere
./configure
make
The QEMU maintainers generally recommend that a VPATH build is used by
developers. Patches to QEMU are expected to ensure VPATH build still
works.
Module structure
----------------
There are a number of key outputs of the QEMU build system:
- Tools - qemu-img, qemu-nbd, qga (guest agent), etc
- System emulators - qemu-system-$ARCH
- Userspace emulators - qemu-$ARCH
- Unit tests
The source code is highly modularized, split across many files to
facilitate building of all of these components with as little duplicated
compilation as possible. There can be considered to be two distinct
groups of files, those which are independent of the QEMU emulation
target and those which are dependent on the QEMU emulation target.
In the target-independent set lives various general purpose helper code,
such as error handling infrastructure, standard data structures,
platform portability wrapper functions, etc. This code can be compiled
once only and the .o files linked into all output binaries.
In the target-dependent set lives CPU emulation, device emulation and
much glue code. This sometimes also has to be compiled multiple times,
once for each target being built.
The utility code that is used by all binaries is built into a
static archive called libqemuutil.a, which is then linked to all the
binaries. In order to provide hooks that are only needed by some of the
binaries, code in libqemuutil.a may depend on other functions that are
not fully implemented by all QEMU binaries. Dummy stubs for all these
functions are also provided by this library, and will only be linked
into the binary if the real implementation is not present. In a way,
the stubs can be thought of as a portable implementation of the weak
symbols concept.
All binaries should link to libqemuutil.a, e.g.:
qemu-img$(EXESUF): qemu-img.o ..snip.. libqemuutil.a
Windows platform portability
----------------------------
On Windows, all binaries have the suffix '.exe', so all Makefile rules
which create binaries must include the $(EXESUF) variable on the binary
name. e.g.
qemu-img$(EXESUF): qemu-img.o ..snip..
This expands to '.exe' on Windows, or '' on other platforms.
A further complication for the system emulator binaries is that
two separate binaries need to be generated.
The main binary (e.g. qemu-system-x86_64.exe) is linked against the
Windows console runtime subsystem. These are expected to be run from a
command prompt window, and so will print stderr to the console that
launched them.
The second binary generated has a 'w' on the end of its name (e.g.
qemu-system-x86_64w.exe) and is linked against the Windows graphical
runtime subsystem. These are expected to be run directly from the
desktop and will open up a dedicated console window for stderr output.
The Makefile.target will generate the binary for the graphical subsystem
first, and then use objcopy to relink it against the console subsystem
to generate the second binary.
Object variable naming
----------------------
The QEMU convention is to define variables to list different groups of
object files. These are named with the convention $PREFIX-obj-y. For
example the libqemuutil.a file will be linked with all objects listed
in a variable 'util-obj-y'. So, for example, util/Makefile.obj will
contain a set of definitions looking like
util-obj-y += bitmap.o bitops.o hbitmap.o
util-obj-y += fifo8.o
util-obj-y += acl.o
util-obj-y += error.o qemu-error.o
When there is an object file which needs to be conditionally built based
on some characteristic of the host system, the configure script will
define a variable for the conditional. For example, on Windows it will
define $(CONFIG_POSIX) with a value of 'n' and $(CONFIG_WIN32) with a
value of 'y'. It is now possible to use the config variables when
listing object files. For example,
util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o
util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o
On Windows this expands to
util-obj-y += oslib-win32.o qemu-thread-win32.o
util-obj-n += oslib-posix.o qemu-thread-posix.o
Since libqemutil.a links in $(util-obj-y), the POSIX specific files
listed against $(util-obj-n) are ignored on the Windows platform builds.
CFLAGS / LDFLAGS / LIBS handling
--------------------------------
There are many different binaries being built with differing purposes,
and some of them might even be 3rd party libraries pulled in via git
submodules. As such the use of the global CFLAGS variable is generally
avoided in QEMU, since it would apply to too many build targets.
Flags that are needed by any QEMU code (i.e. everything *except* GIT
submodule projects) are put in $(QEMU_CFLAGS) variable. For linker
flags the $(LIBS) variable is sometimes used, but a couple of more
targeted variables are preferred. $(libs_softmmu) is used for
libraries that must be linked to system emulator targets, $(LIBS_TOOLS)
is used for tools like qemu-img, qemu-nbd, etc and $(LIBS_QGA) is used
for the QEMU guest agent. There is currently no specific variable for
the userspace emulator targets as the global $(LIBS), or more targeted
variables shown below, are sufficient.
In addition to these variables, it is possible to provide cflags and
libs against individual source code files, by defining variables of the
form $FILENAME-cflags and $FILENAME-libs. For example, the curl block
driver needs to link to the libcurl library, so block/Makefile defines
some variables:
curl.o-cflags := $(CURL_CFLAGS)
curl.o-libs := $(CURL_LIBS)
The scope is a little different between the two variables. The libs get
used when linking any target binary that includes the curl.o object
file, while the cflags get used when compiling the curl.c file only.
Statically defined files
------------------------
The following key files are statically defined in the source tree, with
the rules needed to build QEMU. Their behaviour is influenced by a
number of dynamically created files listed later.
- Makefile
The main entry point used when invoking make to build all the components
of QEMU. The default 'all' target will naturally result in the build of
every component. The various tools and helper binaries are built
directly via a non-recursive set of rules.
Each system/userspace emulation target needs to have a slightly
different set of make rules / variables. Thus, make will be recursively
invoked for each of the emulation targets.
The recursive invocation will end up processing the toplevel
Makefile.target file (more on that later).
- */Makefile.objs
Since the source code is spread across multiple directories, the rules
for each file are similarly modularized. Thus each subdirectory
containing .c files will usually also contain a Makefile.objs file.
These files are not directly invoked by a recursive make, but instead
they are imported by the top level Makefile and/or Makefile.target
Each Makefile.objs usually just declares a set of variables listing the
.o files that need building from the source files in the directory. They
will also define any custom linker or compiler flags. For example in
block/Makefile.objs
block-obj-$(CONFIG_LIBISCSI) += iscsi.o
block-obj-$(CONFIG_CURL) += curl.o
..snip...
iscsi.o-cflags := $(LIBISCSI_CFLAGS)
iscsi.o-libs := $(LIBISCSI_LIBS)
curl.o-cflags := $(CURL_CFLAGS)
curl.o-libs := $(CURL_LIBS)
If there are any rules defined in the Makefile.objs file, they should
all use $(obj) as a prefix to the target, e.g.
$(obj)/generated-tcg-tracers.h: $(obj)/generated-tcg-tracers.h-timestamp
- Makefile.target
This file provides the entry point used to build each individual system
or userspace emulator target. Each enabled target has its own
subdirectory. For example if configure is run with the argument
'--target-list=x86_64-softmmu', then a sub-directory 'x86_64-softmmu'
will be created, containing a 'Makefile' which symlinks back to
Makefile.target
So when the recursive '$(MAKE) -C x86_64-softmmu' is invoked, it ends up
using Makefile.target for the build rules.
- rules.mak
This file provides the generic helper rules for invoking build tools, in
particular the compiler and linker. This also contains the magic (hairy)
'unnest-vars' function which is used to merge the variable definitions
from all Makefile.objs in the source tree down into the main Makefile
context.
- default-configs/*.mak
The files under default-configs/ control what emulated hardware is built
into each QEMU system and userspace emulator targets. They merely contain
a list of config variable definitions like the machines that should be
included. For example, default-configs/aarch64-softmmu.mak has:
include arm-softmmu.mak
CONFIG_XLNX_ZYNQMP_ARM=y
CONFIG_XLNX_VERSAL=y
These files rarely need changing unless new devices / hardware need to
be enabled for a particular system/userspace emulation target
- tests/Makefile
Rules for building the unit tests. This file is included directly by the
top level Makefile, so anything defined in this file will influence the
entire build system. Care needs to be taken when writing rules for tests
to ensure they only apply to the unit test execution / build.
- tests/docker/Makefile.include
Rules for Docker tests. Like tests/Makefile, this file is included
directly by the top level Makefile, anything defined in this file will
influence the entire build system.
- po/Makefile
Rules for building and installing the binary message catalogs from the
text .po file sources. This almost never needs changing for any reason.
Dynamically created files
-------------------------
The following files are generated dynamically by configure in order to
control the behaviour of the statically defined makefiles. This avoids
the need for QEMU makefiles to go through any pre-processing as seen
with autotools, where Makefile.am generates Makefile.in which generates
Makefile.
- config-host.mak
When configure has determined the characteristics of the build host it
will write a long list of variables to config-host.mak file. This
provides the various install directories, compiler / linker flags and a
variety of CONFIG_* variables related to optionally enabled features.
This is imported by the top level Makefile in order to tailor the build
output.
The variables defined here are those which are applicable to all QEMU
build outputs. Variables which are potentially different for each
emulator target are defined by the next file...
It is also used as a dependency checking mechanism. If make sees that
the modification timestamp on configure is newer than that on
config-host.mak, then configure will be re-run.
- config-host.h
The config-host.h file is used by source code to determine what features
are enabled. It is generated from the contents of config-host.mak using
the scripts/create_config program. This extracts all the CONFIG_* variables,
most of the HOST_* variables and a few other misc variables from
config-host.mak, formatting them as C preprocessor macros.
- $TARGET-NAME/config-target.mak
TARGET-NAME is the name of a system or userspace emulator, for example,
x86_64-softmmu denotes the system emulator for the x86_64 architecture.
This file contains the variables which need to vary on a per-target
basis. For example, it will indicate whether KVM or Xen are enabled for
the target and any other potential custom libraries needed for linking
the target.
- $TARGET-NAME/config-devices.mak
TARGET-NAME is again the name of a system or userspace emulator. The
config-devices.mak file is automatically generated by make using the
scripts/make_device_config.sh program, feeding it the
default-configs/$TARGET-NAME file as input.
- $TARGET-NAME/Makefile
This is the entrypoint used when make recurses to build a single system
or userspace emulator target. It is merely a symlink back to the
Makefile.target in the top level.
Useful make targets
===================
- help
Print a help message for the most common build targets.
- print-VAR
Print the value of the variable VAR. Useful for debugging the build
system.

View file

@ -13,6 +13,7 @@ Contents:
.. toctree::
:maxdepth: 2
build-system
kconfig
loads-stores
memory

View file

@ -164,13 +164,12 @@ instrumenting the tested code. To use it, configure QEMU with
``--enable-gcov`` option and build. Then run ``make check`` as usual.
If you want to gather coverage information on a single test the ``make
clean-coverage`` target can be used to delete any existing coverage
clean-gcda`` target can be used to delete any existing coverage
information before running a single test.
You can generate a HTML coverage report by executing ``make
coverage-report`` which will create
./reports/coverage/coverage-report.html. If you want to create it
elsewhere simply execute ``make /foo/bar/baz/coverage-report.html``.
coverage-html`` which will create
``meson-logs/coveragereport/index.html``.
Further analysis can be conducted by running the ``gcov`` command
directly on the various .gcda output files. Please read the ``gcov``
@ -820,7 +819,7 @@ the following approaches:
1) Set ``qemu_bin``, and use the given binary
2) Do not set ``qemu_bin``, and use a QEMU binary named like
"${arch}-softmmu/qemu-system-${arch}", either in the current
"qemu-system-${arch}", either in the current
working directory, or in the current source tree.
The resulting ``qemu_bin`` value will be preserved in the
@ -887,7 +886,7 @@ like the following:
.. code::
PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64
PARAMS (key=qemu_bin, path=*, default=./qemu-system-x86_64) => './qemu-system-x86_64
arch
~~~~

View file

@ -60,7 +60,7 @@ general. It is strongly preferred that all events be declared directly in
the sub-directory that uses them. The only exception is where there are some
shared trace events defined in the top level directory trace-events file.
The top level directory generates trace files with a filename prefix of
"trace-root" instead of just "trace". This is to avoid ambiguity between
"trace/trace-root" instead of just "trace". This is to avoid ambiguity between
a trace.h in the current directory, vs the top level directory.
=== Using trace events ===

View file

@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>QEMU @@VERSION@@ Documentation</title>
<title>QEMU @VERSION@ Documentation</title>
</head>
<body>
<h1>QEMU @@VERSION@@ Documentation</h1>
<h1>QEMU @VERSION@ Documentation</h1>
<ul>
<li><a href="system/index.html">System Emulation User's Guide</a></li>
<li><a href="user/index.html">User Mode Emulation User's Guide</a></li>

View file

@ -129,7 +129,7 @@ To show some example invocations of command-line, we will use the
following invocation of QEMU, with a QMP server running over UNIX
socket::
$ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \
$ ./qemu-system-x86_64 -display none -no-user-config \
-M q35 -nodefaults -m 512 \
-blockdev node-name=node-A,driver=qcow2,file.driver=file,file.node-name=file,file.filename=./a.qcow2 \
-device virtio-blk,drive=node-A,id=virtio0 \
@ -694,7 +694,7 @@ instance, with the following invocation. (As noted earlier, for
simplicity's sake, the destination QEMU is started on the same host, but
it could be located elsewhere)::
$ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \
$ ./qemu-system-x86_64 -display none -no-user-config \
-M q35 -nodefaults -m 512 \
-blockdev node-name=node-TargetDisk,driver=qcow2,file.driver=file,file.node-name=file,file.filename=./target-disk.qcow2 \
-device virtio-blk,drive=node-TargetDisk,id=virtio0 \

View file

@ -65,7 +65,7 @@ along with this manual. If not, see http://www.gnu.org/licenses/.
@c for texi2pod:
@c man begin DESCRIPTION
@include qemu-ga-qapi.texi
@include qga/qga-qapi-doc.texi
@c man end

View file

@ -65,7 +65,7 @@ along with this manual. If not, see http://www.gnu.org/licenses/.
@c for texi2pod:
@c man begin DESCRIPTION
@include qemu-qmp-qapi.texi
@include qapi/qapi-doc.texi
@c man end

73
docs/meson.build Normal file
View file

@ -0,0 +1,73 @@
SPHINX_ARGS = [config_host['SPHINX_BUILD'],
'-Dversion=' + meson.project_version(),
'-Drelease=' + config_host['PKGVERSION']]
if get_option('werror')
SPHINX_ARGS += [ '-W' ]
endif
if build_docs
configure_file(output: 'index.html',
input: files('index.html.in'),
configuration: {'VERSION': meson.project_version()},
install_dir: config_host['qemu_docdir'])
manuals = [ 'devel', 'interop', 'tools', 'specs', 'system', 'user' ]
man_pages = {
'interop' : {
'qemu-ga.8': (have_tools ? 'man8' : ''),
},
'tools': {
'qemu-img.1': (have_tools ? 'man1' : ''),
'qemu-nbd.8': (have_tools ? 'man8' : ''),
'qemu-trace-stap.1': (config_host.has_key('CONFIG_TRACE_SYSTEMTAP') ? 'man1' : ''),
'virtfs-proxy-helper.1': (have_virtfs_proxy_helper ? 'man1' : ''),
'virtiofsd.1': (have_virtiofsd ? 'man1' : ''),
},
'system': {
'qemu.1': 'man1',
'qemu-block-drivers.7': 'man7',
'qemu-cpu-models.7': 'man7'
},
}
sphinxdocs = []
sphinxmans = []
foreach manual : manuals
private_dir = meson.current_build_dir() / (manual + '.p')
output_dir = meson.current_build_dir() / manual
input_dir = meson.current_source_dir() / manual
this_manual = custom_target(manual + ' manual',
build_by_default: build_docs,
output: [manual + '.stamp'],
input: [files('conf.py'), files(manual / 'conf.py')],
depfile: manual + '.d',
command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
'-Ddepfile_stamp=@OUTPUT0@',
'-b', 'html', '-d', private_dir,
input_dir, output_dir])
sphinxdocs += this_manual
if build_docs and manual != 'devel'
install_subdir(output_dir, install_dir: config_host['qemu_docdir'])
endif
these_man_pages = []
install_dirs = []
foreach page, section : man_pages.get(manual, {})
these_man_pages += page
install_dirs += section == '' ? false : get_option('mandir') / section
endforeach
if these_man_pages.length() > 0
sphinxmans += custom_target(manual + ' man pages',
build_by_default: build_docs,
output: these_man_pages,
input: this_manual,
install: build_docs,
install_dir: install_dirs,
command: [SPHINX_ARGS, '-b', 'man', '-d', private_dir,
input_dir, meson.current_build_dir()])
endif
endforeach
alias_target('sphinxdocs', sphinxdocs)
alias_target('man', sphinxmans)
endif

51
docs/sphinx/depfile.py Normal file
View file

@ -0,0 +1,51 @@
# coding=utf-8
#
# QEMU depfile generation extension
#
# Copyright (c) 2020 Red Hat, Inc.
#
# This work is licensed under the terms of the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
"""depfile is a Sphinx extension that writes a dependency file for
an external build system"""
import os
import sphinx
__version__ = '1.0'
def get_infiles(env):
for x in env.found_docs:
yield env.doc2path(x)
yield from ((os.path.join(env.srcdir, dep)
for dep in env.dependencies[x]))
def write_depfile(app, env):
if not env.config.depfile:
return
# Using a directory as the output file does not work great because
# its timestamp does not necessarily change when the contents change.
# So create a timestamp file.
if env.config.depfile_stamp:
with open(env.config.depfile_stamp, 'w') as f:
pass
with open(env.config.depfile, 'w') as f:
print((env.config.depfile_stamp or app.outdir) + ": \\", file=f)
print(*get_infiles(env), file=f)
for x in get_infiles(env):
print(x + ":", file=f)
def setup(app):
app.add_config_value('depfile', None, 'env')
app.add_config_value('depfile_stamp', None, 'env')
app.connect('env-updated', write_depfile)
return dict(
version = __version__,
parallel_read_safe = True,
parallel_write_safe = True
)

View file

@ -1,3 +0,0 @@
obj-y += dump.o
common-obj-y += dump-hmp-cmds.o
obj-$(TARGET_X86_64) += win_dump.o

4
dump/meson.build Normal file
View file

@ -0,0 +1,4 @@
softmmu_ss.add(files('dump-hmp-cmds.c'))
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo])
specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: files('win_dump.c'))

6
exec.c
View file

@ -50,7 +50,7 @@
#include "sysemu/hw_accel.h"
#include "exec/address-spaces.h"
#include "sysemu/xen-mapcache.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
#include <linux/falloc.h>
@ -3659,7 +3659,7 @@ void cpu_physical_memory_unmap(void *buffer, hwaddr len,
#define TRANSLATE(...) address_space_translate(as, __VA_ARGS__)
#define RCU_READ_LOCK(...) rcu_read_lock()
#define RCU_READ_UNLOCK(...) rcu_read_unlock()
#include "memory_ldst.inc.c"
#include "memory_ldst.c.inc"
int64_t address_space_cache_init(MemoryRegionCache *cache,
AddressSpace *as,
@ -3795,7 +3795,7 @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr,
#define TRANSLATE(...) address_space_translate_cached(cache, __VA_ARGS__)
#define RCU_READ_LOCK() ((void)0)
#define RCU_READ_UNLOCK() ((void)0)
#include "memory_ldst.inc.c"
#include "memory_ldst.c.inc"
/* virtual memory access for debug (includes writing to ROM) */
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,

View file

@ -621,7 +621,7 @@ static inline float64 float64_pack_raw(FloatParts p)
| are propagated from function inputs to output. These details are target-
| specific.
*----------------------------------------------------------------------------*/
#include "softfloat-specialize.inc.c"
#include "softfloat-specialize.c.inc"
/* Canonicalize EXP and FRAC, setting CLS. */
static FloatParts sf_canonicalize(FloatParts part, const FloatFmt *parm,

View file

@ -1,12 +0,0 @@
# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
# only pull in the actual 9p backend if we also enabled virtio or xen.
ifeq ($(CONFIG_FSDEV_9P),y)
common-obj-y = qemu-fsdev.o 9p-marshal.o 9p-iov-marshal.o
else
common-obj-y = qemu-fsdev-dummy.o
endif
common-obj-y += qemu-fsdev-opts.o qemu-fsdev-throttle.o
# Toplevel always builds this; targets without virtio will put it in
# common-obj-y
common-obj-$(CONFIG_ALL) += qemu-fsdev-dummy.o

18
fsdev/meson.build Normal file
View file

@ -0,0 +1,18 @@
fsdev_ss = ss.source_set()
fsdev_ss.add(files('qemu-fsdev-opts.c', 'qemu-fsdev-throttle.c'))
fsdev_ss.add(when: 'CONFIG_ALL', if_true: files('qemu-fsdev-dummy.c'))
fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
'9p-iov-marshal.c',
'9p-marshal.c',
'qemu-fsdev.c',
), if_false: files('qemu-fsdev-dummy.c'))
softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)
have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
if have_virtfs_proxy_helper
executable('virtfs-proxy-helper',
files('virtfs-proxy-helper.c', '9p-marshal.c', '9p-iov-marshal.c'),
dependencies: [qemuutil, libattr, libcap_ng],
install: true,
install_dir: get_option('libexecdir'))
endif

View file

@ -30,7 +30,7 @@
#include "qemu/ctype.h"
#include "qemu/cutils.h"
#include "qemu/module.h"
#include "trace-root.h"
#include "trace/trace-root.h"
#ifdef CONFIG_USER_ONLY
#include "qemu.h"
#else

View file

@ -2,8 +2,12 @@ config FSDEV_9P
bool
depends on VIRTFS
config 9PFS
bool
config VIRTIO_9P
bool
default y
depends on VIRTFS && VIRTIO
select FSDEV_9P
select 9PFS

View file

@ -1,9 +0,0 @@
common-obj-y = 9p.o 9p-util.o
common-obj-y += 9p-local.o 9p-xattr.o
common-obj-y += 9p-xattr-user.o 9p-posix-acl.o
common-obj-y += coth.o cofs.o codir.o cofile.o
common-obj-y += coxattr.o 9p-synth.o
common-obj-y += 9p-proxy.o
common-obj-$(CONFIG_XEN) += xen-9p-backend.o
obj-$(CONFIG_VIRTIO_9P) += virtio-9p-device.o

20
hw/9pfs/meson.build Normal file
View file

@ -0,0 +1,20 @@
fs_ss = ss.source_set()
fs_ss.add(files(
'9p-local.c',
'9p-posix-acl.c',
'9p-proxy.c',
'9p-synth.c',
'9p-util.c',
'9p-xattr-user.c',
'9p-xattr.c',
'9p.c',
'codir.c',
'cofile.c',
'cofs.c',
'coth.c',
'coxattr.c',
))
fs_ss.add(when: 'CONFIG_XEN', if_true: files('xen-9p-backend.c'))
softmmu_ss.add_all(when: 'CONFIG_9PFS', if_true: fs_ss)
specific_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-9p-device.c'))

1
hw/9pfs/trace.h Normal file
View file

@ -0,0 +1 @@
#include "trace/trace-hw_9pfs.h"

View file

@ -1,48 +0,0 @@
devices-dirs-y = core/
ifeq ($(CONFIG_SOFTMMU), y)
devices-dirs-$(call lor,$(CONFIG_VIRTIO_9P),$(call land,$(CONFIG_VIRTFS),$(CONFIG_XEN))) += 9pfs/
devices-dirs-y += acpi/
devices-dirs-y += adc/
devices-dirs-y += audio/
devices-dirs-y += block/
devices-dirs-y += char/
devices-dirs-y += cpu/
devices-dirs-y += display/
devices-dirs-y += dma/
devices-dirs-y += gpio/
devices-dirs-$(CONFIG_HYPERV) += hyperv/
devices-dirs-$(CONFIG_I2C) += i2c/
devices-dirs-y += ide/
devices-dirs-y += input/
devices-dirs-y += intc/
devices-dirs-$(CONFIG_IPACK) += ipack/
devices-dirs-$(CONFIG_IPMI) += ipmi/
devices-dirs-y += isa/
devices-dirs-y += misc/
devices-dirs-y += net/
devices-dirs-y += rdma/
devices-dirs-y += nvram/
devices-dirs-y += pci/
devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/
devices-dirs-y += pcmcia/
devices-dirs-y += rtc/
devices-dirs-$(CONFIG_SCSI) += scsi/
devices-dirs-y += sd/
devices-dirs-y += ssi/
devices-dirs-y += timer/
devices-dirs-$(CONFIG_TPM) += tpm/
devices-dirs-y += usb/
devices-dirs-$(CONFIG_VFIO) += vfio/
devices-dirs-y += virtio/
devices-dirs-y += watchdog/
devices-dirs-$(CONFIG_XEN) += xen/
devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
devices-dirs-$(CONFIG_NUBUS) += nubus/
devices-dirs-y += semihosting/
devices-dirs-y += smbios/
endif
common-obj-y += $(devices-dirs-y)
common-obj-m += display/
common-obj-m += usb/
obj-y += $(devices-dirs-y)

Some files were not shown because too many files have changed in this diff Show more