Codelab: QEMU edu driver

Drivers provide software interfaces for communicating with hardware (or virtual) devices that are embedded in or connected to a system. In Fuchsia, drivers are user-space components running within the system's component topology, and the driver framework builds on the concepts and tools provided by the component framework. Drivers interact with each other and non-driver components using capabilities and connections established over FIDL.

In this codelab, you'll build a Fuchsia driver component that targets a virtual device built into QEMU (which underpins the Fuchsia emulator) named edu, which is an educational device for writing drivers that computes the factorial of a given integer. You'll also explore how to interact with drivers using the tools provided with the Fuchsia SDK.


What you'll learn

  • Discovering and binding to device nodes
  • Registering and loading a new device driver
  • Interacting with a running device driver

What you'll need

  • An x64-based machine running Linux or macOS

  • A configured Fuchsia SDK environment

  • Emulator product bundle for workstation_eng.qemu-x64

Before you begin

As part of the prerequisites, you created a Bazel workspace in the drivers/ directory. This is the directory that contains a WORKSPACE.bazel file and it represents the root of the workspace. Throughout the codelab, this root directory is referred to using the // prefix. For example, the path //fuchsia-codelab represents a directory named fuchsia-codelab at the root of the Bazel workspace.

The Bazel workspace is also pre-configured with development tools provided by the Fuchsia SDK in the tools/ directory. This codelab assumes you are using the SDK tools from within your Bazel workspace, so consider updating your PATH to include the SDK's tools/ directory or create a temporary alias using the following commands:

alias ffx=tools/ffx
alias bazel=tools/bazel