Build and pave quickstart
This document shows you how to build and deploy Fuchsia on a target device with
fx development commands. Most of these commands have additional commands, see
fx help <command> for details.
Determine USB drive device path {#usb-drive-device-path}
Before you attempt to build and pave Fuchsia on a target device, you need to know the path of your USB drive.
Note: For either operating system, you can run the command once with the USB drive disconnected, then run again with the USB drive connected, to see the difference.
fx
To determine the correct path to your USB drive:
Note: The fx tool is platform agnostic and lists available USB drives.
Linux
To determine the correct path to your USB drive:
Drives are usually in the form /dev/sd[x] such as /dev/sdc.
Make sure that you select the drive rather than a specific partition. For
example, a specific partition has a number at the end of the path such as
/dev/sdc1.
macOS
To determine the correct path to your USB drive:
Drives are usually in the form /dev/disk[n] such as /dev/disk2.
Note: If you see ERROR: Can't open /dev/disk[n]: Resource busy then you will
have to unmount the USB drive. To do this, run:
If this does not fix the error, try reformatting the drive:
Build and deploy Fuchsia
To perform an initial build and deploy of Fuchsia with fx, do the following:
-
Set your build type:
Note: Configures the build to build the
coreproduct on a generic x64 board. For a list of available products and boards, seefx list-productsandfx list-boardsfor lists of available products, respectively. -
Build a Fuchsia image:
This command builds Zircon and then the rest of Fuchsia.
-
Build the Zedboot media and install to a USB device target:
Note: 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:
-
Take note of the HDD or SSD's device path from the output of
lsblk. An example path looks like/dev/sys/platform/pci/00:17.0/ahci/sata0/block. -
On your target device, run:
-
To start the bootserver, from your host, run:
Note: The bootserver connects to the target device to upload the Fuchsia image and then paves your target device.
Rebuild and redeploy Fuchsia
To rebuild and redeploy with fx:
- Ensure that HEAD is in a good state to pull at the build dashboard.
-
Fetch the latest code:
-
Build a Fuchsia image:
This command builds Zircon and then the rest of Fuchsia.
-
(Only for macOS users) Set up firewall rules:
-
From your host, start a development package server:
-
Boot your target device without the Zedboot USB attached.
-
From your host, push updated Fuchsia packages to the target device:
In some cases, if
fx otadoes not complete successfully, consider repaving withfx pave.
Troubleshooting
-
If
fx buildfails, make sure that yourPATHenvironment variable is set correctly.Note: The
fxscript changes the working directory in a way that may create conflicts between the commands it uses (such astouch) and the binaries in the working directory.To check the value of your
PATHvariable:Make that sure that the output of your
PATHvariable is a list of directories separated by colons. Make sure that none of the directories are separated by..