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
Before you attempt to build and pave Fuchsia on a target device, you need to know the path of your USB drive.
fx
To determine the correct path to your USB drive:
fx mkzedboot
Linux
To determine the correct path to your USB drive:
sudo fdisk -l
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:
diskutil list | grep external
Drives are usually in the form /dev/disk[n]
such as /dev/disk2
.
hdiutil unmount /dev/disk[n]
If this does not fix the error, try reformatting the drive:
diskutil eraseDisk JHFSX <name_of_the_usb_stick> /dev/disk[n]
Build and deploy Fuchsia
To perform an initial build and deploy of Fuchsia with fx
, do the following:
Set your build type:
fx set core.x64
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>
Attach Zedboot USB drive to your target device and reboot that device.
On your target device, run:
lsblk
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:
install-disk-image init-partition-tables --block-device <BLOCK_DEVICE_PATH>
To start the bootserver, from your host, run:
fx pave
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:
jiri update
Build a Fuchsia image:
fx build
This command builds Zircon and then the rest of Fuchsia.
(Only for macOS users) Set up firewall rules:
fx setup-macos
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 pave
.
Troubleshooting
If
fx build
fails, make sure that yourPATH
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.
.