This document walks through how to build and flash a Fuchsia image
on a hardware device using fx
commands.
Identify USB drive device path
Before you can build and flash Fuchsia on a target device, you first need to identify the path of your USB drive.
It is recommended to run the command below once with the USB drive disconnected, then run it again with the USB drive connected to see the difference.
fx tool
To check the correct path to your USB drive using the fx
tool,
run the following command:
fx mkzedboot
The fx
tool is platform agnostic and lists available USB drives.
Linux command
To check the correct path to your USB drive using a Linux command, run the following command:
sudo fdisk -l
Drives are usually in the form /dev/sd*
such as /dev/sdc
. Make sure
that you select the drive rather than a specific partition. Forexample,
a specific partition has a number at the end of the path such as
/dev/sdc1
.
Build and flash Fuchsia
To perform an initial build and flash of a Fuchsia image using the fx
tool, do the following:
Set your Fuchsia build configuration:
fx set core.x64
This configures the build to build the
core
product on a generic x64 board. For a list of available products and boards, seefx list-products
andfx list-boards
for lists of available products, respectively.Build a Fuchsia image:
fx build
This command builds Zircon and then the rest of Fuchsia.
Build the Zedboot media and install to a USB device target:
fx mkzedboot <usb_drive_device_path>
For information on obtaining the USB drive device path, see USB drive device path.
Attach Zedboot USB drive to your target device and reboot that device.
On your target device, run:
install-disk-image init-partition-tables
From your host, start the bootserver:
fx flash
The bootserver connects to the target device to upload the Fuchsia image and then flashes your target device.
Rebuild and reflash Fuchsia
To re-deploy Fuchsia using the fx
tool, do the following:
- Ensure that HEAD is in a good state to pull at the build dashboard.
Fetch the latest code:
jiri update
Build a Fuchsia image:
fx build
This command builds Zircon and then the rest of Fuchsia.
From your host, start a development package server:
fx serve
Boot your target device without the Zedboot USB attached.
From your host, push updated Fuchsia packages to the target device:
fx ota
In some cases, if
fx ota
does not complete successfully, consider repaving withfx flash
.
Troubleshooting
If fx build
fails, make sure that your PATH
environment variable is set
correctly.
To check the value of your PATH
variable:
echo $PATH
Make that sure that the output of your PATH
variable is a list of
directories separated by colons. Make sure that none of the directories are
separated by a dot (.
).