This document describes how to run Fuchsia under emulation using the Fuchsia Emulator (FEMU), covering differnent developer environments and setups.
For more information on FEMU, see the Fuchsia emulator overview.
Before you run FEMU, you must:
- Install Fuchsia source and create environment variables
- Configure and build Fuchsia
- Set up and configure FEMU
Run Fuchsia on FEMU
If you haven't already, set up and build Fuchsia, using
qemu board and supported product. This example uses the
fx set core.qemu-x64 --release [--with=...]
Next, run FEMU with
ssh access (with the
fx emu -N
Run FEMU without GUI support
If you don't need graphics or working under the remote workflow,
you can run FEMU in headless mode by adding
--headless argument to the
fx emu command, for example:
fx emu -N --headless
Specify GPU used by FEMU
By default, FEMU tries using the host GPU automatically if it is available, and will fall back to software rendering using SwiftShader if host GPU is unavailable.
You can also add argument
fx emu command
to enforce FEMU to use a specific graphics device.
There are multiple ways to develop Fuchsia remotely using FEMU, and all the workflow supports GPU acceleration without requiring GPU drivers and runtime on the local machine.
These instructions require remote access to the remote machine using remote desktop tools like Chrome Remote Desktop.
Follow general remote desktop instructions for logging in to your remote machine. Once logged in, follow standard Fuchsia development instructions for building Fuchsia, and use the following command to run Fuchsia in the emulator inside your remote desktop session:
The emulator will use Swiftshader instead of real GPU hardware for GPU acceleration when running inside Chrome Remote Desktop. Performance will be worse than using real GPU hardware but the benefit is that it runs on any workstation.
fx emu-remote Command
These instructions work for local machines with macOS or Linux, and require SSH access to a Linux workstation capable of building Fuchsia.
On the terminal of your local machine, type the following to build, fetch the artifacts and start the emulator with networking:
fx emu-remote REMOTE-WORKSTATION-NAME -- -N
Alternatively, start the emulator on remote workstation, and open an WebRTC connection to it using local browser.
On the terminal of your local machine, type the following to start the emulator with networking on REMOTE-WORKSTATION-NAME and have the output forwarded using WebRTC to a Chrome tab on local machine:
fx emu-remote --stream REMOTE-WORKSTATION-NAME -- -N
This by default uses software rendering and GPU acceleration is supported by using an existing X server on the remote machine with access to GPU hardware:
fx emu-remote --stream --display :0 REMOTE-WORKSTATION-NAME -- -N
Any arguments after “--” will be passed to the fx emu invocation on the remote machine.
To exit FEMU, run
dm poweroff in the FEMU terminal.
Once you are running Fuchsia on FEMU, you can: