# Working with devices

This codelab series focuses on the
[Fuchsia emulator](https://fuchsia.dev/docs/development/build/emulator) (FEMU) as the target
device, which is built and distributed with the source tree and runs on your
development machine. However, you can also build Fuchsia for supported hardware
platforms, such as an [Intel NUC](https://fuchsia.dev/docs/development/hardware/intel_nuc).

This section describes some specifics related to working with Fuchsia on
physical devices.

## Configure

Fuchsia defines support for hardware devices by the **board name** used to
configure the build. This includes any hardware-specific packages such as
drivers. Recall the `fx set` command used previously:

    fx set workbench_eng.x64

In this example, `x64` is the board name that can run on FEMU and Intel NUC.
To build the same **product** for the Khadas VIM3, you can modify the `set`
command to use the `vim3` board.

> [!NOTE]
> **Note:** To determine the Fuchsia board name for your supported hardware, see the [device documentation](https://fuchsia.dev/docs/development/hardware/README).

    fx set workbench_eng.vim3

Running `fx build` will now generate an image for the target device.

## Bootstrap

Before flashing the operating system, a supported device must have a
Fuchsia-compatible bootloader installed. This process is known as
**bootstrapping** the device. Many devices have a compatible bootloader
installed from the factory, others may require manufacturer-specific tools to
update the bootloader to a compatible version.
See the [device documentation](https://fuchsia.dev/docs/development/hardware/README) for more
details regarding your specific device.

> [!IMPORTANT]
> Most Fuchsia-compatible devices use a bootloader that supports the [Fastboot protocol](https://fuchsia.dev/docs/contribute/governance/rfcs/0081_fastboot_boot).

## Flash

The process of loading the operating system onto the device is known as
**flashing** . With a device in bootloader mode connected to your workbench,
you can use the `flash` command to flash Fuchsia onto the device.

    fx flash

For devices that have already been flashed, you can reboot them from Fuchsia
into bootloader mode if you need to flash them again using `ffx`:

    ffx target reboot --bootloader

## Discover

You can discover and interact with Fuchsia devices from a development machine
connected over USB or a local IPv6 network. Fuchsia enables automatic device
discovery using DNS Service Discovery (DNS-SD) over multicast DNS (mDNS) and
the [Overnet mesh protocol](https://cs.opensource.google/fuchsia/fuchsia/+/main:/src/connectivity/overnet/).

Host tools such as `ffx` discover advertising devices and enable host-target
interaction with both physical devices and FEMU.

    ffx target list

    NAME                      SERIAL       TYPE    STATE      ADDRS/IP                            RCS
    fuchsia-5254-0063-5e7a    <unknown>    .       Product    [fe80::c357:53e7:aedf:ed95%qemu]    Y

If a target device does not advertise discovery packets or `ffx` is unable to
detect them, you can manage those targets manually using the `add` and `remove`
commands:

    ffx target add device-ip:device-port
    ffx target remove device-ip:device-port

Once a device is tracked in the target list, `ffx` interacts with the Remove
Control Service (RCS) on the target to enable you to send additional commands.

![Diagram showing how "ffx" is a developer tool that communicates with the
Remote Control Service (RCS) on the Fuchsia Device.](https://fuchsia.dev/static/docs/get-started/images/build/ffx-rcs.png)

> [!NOTE]
> **Note:** For a complete list of the developer commands supported by `ffx`, see the [`ffx` reference](https://fuchsia.dev/reference/tools/sdk/ffx.md).

## What's Next?

Congratulations! You've successfully customized and built Fuchsia from source,
and have a better understanding for where the key system components live in the
source tree.

In the next module, you'll learn more about building Fuchsia's fundamental unit
of software:

[Fuchsia components](https://fuchsia.dev/docs/get-started/learn/components)
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/get-started/learn/build/working-with-devices.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/get-started/learn/build/working-with-devices.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/get-started/learn/build/working-with-devices.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/get-started/learn/build/working-with-devices.md "Edit the source code of this page")