To make it easier to study QEMU’s TCG module, I tried trimming the QEMU source tree from scratch and keeping only the TCG-related modules. By pruning the source tree, you can gain a deeper understanding of QEMU’s code organization and build a solid foundation for learning it.
Base QEMU version: 8.2.0
QEMU build system
QEMU uses Meson + Ninja for builds (Make is also supported). Its scripting style is similar to Python and is highly readable, with fast compilation and build speed. In addition to Meson, you also need to pay attention to QEMU’s ./configure script and Kconfig scripts: the former is the top-level configuration file, while the latter contains the source paths for specific builds (used together with meson.build).
So the first step in the trimming effort was to understand all of ./configure’s build options. The main idea here was to keep only the user-mode pieces related to TCG, GDB remote debugging, user interaction, plugins, and other core components, and remove all code related to system mode. This can be done by modifying ./configure:
1system="no"
2linux_user="yes"
The next step is to remove the unneeded code gradually according to meson.build. The following sections describe some of the modules that were removed.