Add -build-info and -build-info-json CLI arguments
PATCH 1/1 Add -build-info and -build-info-json CLI arguments
Add -build-info and -build-info-json CLI arguments for human and machine readable output of build/compile-time configuration data. The source for this data is the meson generated config-host.h.
This information is mainly of interest to developers and other folk who deal with many different builds of QEMU and need a way to properly differentiate them.
Because there's always the chance someone will want to consume an interface programmatically, also add a -json option that does the same but outputs a machine-readable JSON object.
---
Notes:
Sample output:
$ ./qemu-system-aarch64 -build-info ./qemu-system-aarch64 version 9.1.50 (v9.0.0-3444-g8d988656d8) build information
configuration key key value
----------------- ---------
accept4
af_vsock
asan_iface_fiber
atomic64
attr
audio_alsa
audio_drivers pa,sndio,oss
audio_oss
audio_pa
audio_pipewire
audio_sdl
audio_sndio
avx2_opt
avx512bw_opt
bdrv_ro_whitelist
bdrv_rw_whitelist
bindir /usr/local/bin
blkzoned
brlapi
capstone
clock_adjtime
close_range
coroutine_pool
cpuid_h
curl
curses
dbus_display
debug_graph_lock
debug_mutex
debug_tcg
dup3
ebpf
epoll
epoll_create1
eventfd
fallocate
fallocate_punch_hole
fallocate_zero_range
fdatasync
fdt
fiemap
fsfreeze
fstrim
fuse
fuse_lseek
gbm
getauxval
getcpu
getrandom
gettid
gio
gnutls
gnutls_crypto
gtk
hexagon_idef_parser
host_dsosuf .so
iasl /bin/iasl
inotify
inotify1
int128
int128_type
iovec
keyutils
kvm_targets i386-softmmu,x86_64-softmmu
l2tpv3
libdw
libudev
linux
linux_io_uring
linux_magic_h
madvise
malloc_trim
memalign
memfd
opengl
open_by_handle
pixman
plugin
png
posix
posix_fallocate
posix_madvise
posix_memalign
ppoll
prctl_pr_set_timerslack
preadv
prefix /usr/local
pthread_affinity_np
pthread_setname_np_w_tid
qemu_confdir /usr/local/etc/qemu qemu_datadir /usr/local/share/qemu qemu_desktopdir /usr/local/share/applications qemu_firmwarepath /usr/local/share/qemu-firmware qemu_helperdir /usr/local/libexec qemu_icondir /usr/local/share/icons qemu_localedir /usr/local/share/locale qemu_localstatedir /var/local qemu_moddir /usr/local/lib/x86_64-linux-gnu/qemu qom_cast_debug relocatable replication rtnetlink sdl seccomp seccomp_sysrawrc secret_keyring selinux sendfile setns signalfd slirp smbd_command /usr/sbin/smbd splice statx statx_mnt_id syncfs sync_file_range sysconfdir /usr/local/etc sysmacros tasn1 tcg 1 timerfd tls_priority NORMAL tpm trace_file trace trace_log usbfs usb_libusb valgrind_h valloc vduse_blk_export vhost vhost_crypto vhost_kernel vhost_net vhost_net_user vhost_net_vdpa vhost_user vhost_user_blk_server vhost_vdpa virtfs vnc vnc_jpeg vte x11 xen_backend xen_ctrl_interface_version 41700 xkbcommon zstd blk_zone_rep_capacity btrfs_h copy_file_range drm_h fsxattr getifaddrs host_block_device ipproto_mptcp mlockall openpty pty_h strchrnul struct_stat_st_atim system_function utmpx virgl_d3d_info_ext host_x86_64 1 qemu_version 9.1.50 qemu_version_major 9 qemu_version_micro 50 qemu_version_minor 1 --- meson.build | 15 +++++++- qemu-options.hx | 14 ++++++++ scripts/build_info_gen.py | 91 +++++++++++++++++++++++++++++++++++++++++++++++ system/vl.c | 41 +++++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-)
meson.build +14 -1
@@ -3292,7 +3292,20 @@ endif # Generated sources # ##################### -genh += configure_file(output: 'config-host.h', configuration: config_host_data) +config_host_h = configure_file(output: 'config-host.h', configuration: config_host_data) +genh += config_host_h + +build_info_h = custom_target('build-info.h', + output: 'build-info.h', + command: [ + find_program('scripts/build_info_gen.py'), + '--config-headers', + config_host_h + ], + capture: true, + build_by_default: true, + build_always_stale: true) +genh += build_info_h hxtool = find_program('scripts/hxtool') shaderinclude = find_program('scripts/shaderinclude.py')
qemu-options.hx +14 -0
@@ -24,6 +24,20 @@ SRST Display version information and exit ERST +DEF("build-info", 0, QEMU_OPTION_build_info, + "-build-info display build information of executable and exit\n", QEMU_ARCH_ALL) +SRST +``-build-info`` + Display build information of executable and exit +ERST + +DEF("build-info-json", 0, QEMU_OPTION_build_info_json, + "-build-info-json dump build information of executable in JSON format and exit\n", QEMU_ARCH_ALL) +SRST +``-build-info-json`` + Dump build information of executable in JSON format and exit +ERST + DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ "-machine [type=]name[,prop[=value][,...]]\n" " selects emulated machine ('-machine help' for list)\n"
scripts/build_info_gen.py new file +91 -0
91 lines not on this page · raw message
system/vl.c +41 -0
53 lines not on this page · raw message
---
base-commit: 01dc65a3bc262ab1bec8fe89775e9bbfa627becb
change-id: 20240922-feature-build-info-cli-c9e08e34c34b
--
γαῖα πυρί μιχθήτω