| commit | 64c344e4a28bbe2e04c9f6c58966bbadc962645b | [log] [tgz] |
|---|---|---|
| author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | Wed Mar 19 14:34:12 2025 -0700 |
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Wed Mar 19 14:34:12 2025 -0700 |
| tree | d01c029cfb15dfb3869b170e930dddb1422246d0 | |
| parent | fd7c33f637740bb340c51ddfbd50d3a1ed8ba177 [diff] | |
| parent | 116bd128e58a74fb9e06d06db0a51026a76d70bb [diff] |
Merge "fix extra / in include" into emu-dev
This repository contains a modified version of QEMU, tailored for Android emulation, along with instructions for building it using the [Android Open Source Project (AOSP) toolchain].
//hardware/generic/goldfish/... as plugins loaded during QEMU driver initialization.This repository enables you to build QEMU using the AOSP compiler toolchain.
The Android emulator is a series of plugins that can be loaded into QEMU. Run the Android emulator by providing the correct parameters to QEMU.
While stock QEMU is built using meson, the Android emulator is built using bazel. Bazel build files are generated using an automated script that must be run on every platform of interest. After that, a merge script can be run to generate the final bazel build files. You should never manually edit any of the BUILD.bazel files.
To add generic drivers for the wider QEMU community, make the modifications to the meson build scripts and ensure they compile on all platforms of interest. Please try to upstream these drivers, if possible, to make them available to the wider community and reduce maintenance costs.
Once your modifications are successful, you need to generate the bazel build files. See the google/scripts/fetch_bazel/README.md document for details on how to create the bazel build files from the meson build files.
To get started you will need to configure the toolchain this can be done by running the following:
amc command to configure the toolchain.For Mac/Linux:
python -m venv .venv source .venv/bin/activate pip install google/toolchain amc setup build amc compile build
For Windows:
python -m venv .venv call .venv\Scripts\activate.bat pip install google/toolchain amc setup build amc compile build
Once this is finished you should be able to run the qemu binaries in the build directory.
Only QEMU specific changes should be made here.
When making changes that are not specific to Google's implementation, consider upstreaming them to the official QEMU repository.
If you are within Google
This repository received regulary updates from the remotes/aosp/mirror-qemu-internal-staging-xxx (where xxxx is the current active branch). To minimize conflicts during merging updates, we adhere to the following principles:
#ifdef CONFIG_ANDROID ... #endif blocks to isolate code specific to Android, making merges easier and enabling builds of vanilla QEMU by disabling the CONFIG_ANDROID feature. For example:#ifdef CONFIG_ANDROID // My changes int x = 0; x = x + 1; #endif
All Android-specific code resides in the google subdirectory. This includes goldfish drivers, Android-specific CPU boards, scripts, compatibility layers, and toolchain configurators. You should only add drivers that cannot be loaded as plugins (such as motherboards) in this directory.
By following these guidelines, wec can ensure clean and consistent contributions to the codebase, facilitating efficient integration and future maintenance.
The android emulator consists of a series of plugins that can be loaded into “stock” qemu. The android emulator itself is built using bazel. You can create a release by running
bazel build //hardware/generic/goldfish/emulator:release
This will produce a zip file for your current architecture. You can unzip this file and launch the emulator. For example on darwin it will produce the following:
bazel build //hardware/generic/goldfish/emulator:release INFO: Analyzed target //hardware/generic/goldfish/emulator:release (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //hardware/generic/goldfish/emulator:release up-to-date: bazel-bin/hardware/generic/goldfish/emulator/sdk-repo-darwin_aarch64-emulator-developer.zip INFO: Elapsed time: 0.258s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action
You can run the qemu binaries directly, but you will have
You can also run the emulator directly from within bazel:
bazel run //hardware/generic/goldfish/emulator/launcher:goldfish -- @V
This will launch the goldfish emulator with avd V and creates a vnc connection on port 5901. You can now attach your favorite debugger to debug any issues.
All the code related to emulator can be found in //hardware/generic/goldfish. See the //hardware/generic/goldfish/README.MD for more information on how to debug and build the emulator.