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{:.external} (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.
Note: For more details on the driver framework, see the Driver Concepts.
An x64-based machine running Linux or macOS
Note: While you can use an x64-based (Intel) macOS machine for this get-started flow, you might run into issues. To help us improve, please file a bug{:.external} if you discover issues on macOS.
A configured Fuchsia SDK environment{:.external}
Emulator product bundle for core.x64
As part of the prerequisites, you created a Bazel workspace in the fuchsia-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.
Note: For more details on the Bazel build system and its terminology, see Bazel core concepts{:.external}.
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