This document captures the common-case workflow for building and deploying
Fuchsia onto a device using fx development commands. Most such commands
have options for less common situations; see fx help <command> for details.
The initial build and deploy workflow using fx is as follows:
fx set <arch>Configures the build for : one of [x64, arm64].fx full-buildBuilds Zircon, then the rest of Fuchsia.fx mkzedboot <usb_drive_device_path>Builds the Zedboot media and installs to the USB drive target. See below for notes on obtaining the USB drive device path.fx paveStarts the bootserver.- Attach Zedboot USB to device and reboot. Zedboot will connect to the host, download the pave image, and pave the device.
Instructions for determining the correct path to your USB drive are as follows, depending on the host OS. In either case, you can run the command once with the USB drive disconnected, then run again with it connected, to see the difference.
- Linux users:
sudo fdisk -lDrives are usually of the form /dev/sd[x], e.g. '/dev/sdc'. Select the drive rather than a specific partition.
- Mac users:
diskutil list | grep externalDrives are usually of the form /dev/disk[n], e.g. '/dev/disk2'.- If you see 'ERROR: Can't open /dev/disk[n]: Resource busy'
then you will have to unmount the usb drive.
For this run
hdiutil unmount /dev/disk[n]. If this does not fix the error, try reformating the drive:diskutil eraseDisk JHFSX <name_of_the_usb_stick> /dev/disk[n].
The workflow for re-building and re-deploying using fx is slightly different:
- Check the build waterfall dashboard. Helps ensure that HEAD is in a good state to pull.
jiri updateFetches the latest code.fx full-buildBuilds Zircon, then the rest of Fuchsia.fx setup-macosSets up firewall rules (Mac users ONLY)fx serveStarts a development package server on the host.- Boot the device without Zedboot USB attached. Boots the device into its last-paved state.
fx otaPushes updated packages to the device.
NOTE: If desired, the device can be re-paved using Zedboot USB as per steps 4-5 in the previous section. This is slower, but may be necessary in some cases where the system handles the OTA less than gracefully.
- Having '.' in your PATH may cause
fx full-buildto fail. The script will change the working directory such that it may create conflicts between the commands it uses (e.g.touch) and the binaries in the working directory.