Skip to content
Snippets Groups Projects
Commit d1d60f3c authored by Adam Barth's avatar Adam Barth
Browse files

Update docs to use fx rather than env.sh

Change-Id: I3ebfd6dd26fd9b70794fe94d2f83453eddc9c56a
parent 89159a37
No related branches found
No related tags found
No related merge requests found
# Fuchsia Build Notes
# Fuchsia Build System
These are notes on using the `gen.py` script and `ninja` directly for builds,
and the `scripts/run-zircon-*` scripts to launch QEMU.
You can alternatively use the [standard build instructions](https://fuchsia.googlesource.com/docs/+/master/getting_started.md#Setup-Build-Environment)
using commands defined in `env.sh` instead.
You can alternatively use the [standard build instructions](https://fuchsia.googlesource.com/docs/+/master/getting_started.md#Setup-Build-Environment),
which use the `fx` commands instead.
### Build Zircon and the sysroot
......@@ -40,7 +40,7 @@ these alternative commands for faster builds:
```
./packages/gn/gen.py --goma
./buildtools/ninja -j1000 -C out/debug-x86-64
./buildtools/ninja -j1024 -C out/debug-x86-64
```
The gen.py script takes an optional parameter '--target\_cpu' to set the target
......@@ -78,8 +78,8 @@ the value of the `-x` parameter in Zircon's start command script, for example:
./scripts/run-zircon-arm64 -x out/debug-aarch64/user.bootfs -m 2048
```
See the [standard build instructions](https://fuchsia.googlesource.com/docs/+/master/getting_started.md#Boot-from-QEMU) for other flags you
can pass to QEMU.
See the [standard build instructions](https://fuchsia.googlesource.com/docs/+/master/getting_started.md#Boot-from-QEMU)
for other flags you can pass to QEMU.
[zircon]: https://fuchsia.googlesource.com/zircon/+/HEAD/docs/getting_started.md "Zircon"
......
......@@ -24,7 +24,7 @@ everything fits together.
- System Design: e.g. network stack, compositor, kernel, assumptions
- APIs: e.g. FIDL interfaces, library functions, syscalls
- Protocols: e.g. schemas, encodings, wire formats, configuration files
- Tools: e.g. `bootserver`, `netcp`, `env.sh`
- Tools: e.g. `bootserver`, `netcp`, `fx`
- Workflows: e.g. environment set up, test methodologies, where to find various
parts, how to get work done
......
Fuchsia
============
# Fuchsia
Pink + Purple == Fuchsia (a new Operating System)
......@@ -28,6 +27,7 @@ sudo apt-get install texinfo libglib2.0-dev autoconf libtool libsdl-dev build-es
```
### macOS
Install the Xcode Command Line Tools:
```
xcode-select --install
......@@ -56,38 +56,30 @@ port install autoconf automake libtool libpixman pkgconfig glib2
## Build Fuchsia
### Get the source
Follow all steps in this document and then return to this document:
* [Fuchsia Source](getting_source.md)
### Setup Build Environment
### Build the system
Source the
[`env.sh`](https://fuchsia.googlesource.com/scripts/+/master/env.sh)
script, which provides helpful shell functions for Fuchsia
development. The following command also changes the command prompt and
sets up for a x86-64 build.
(If you don't want to change your command prompt, omit `envprompt`.)
If you added `.jiri_root/bin` to your path as part of getting the source code,
the `fx` command should already be in your path. If not, the command is also
available as the `scripts/fx`.
```
source scripts/env.sh && envprompt && fset x86-64
fx set x86-64
fx full-build
```
Alternatively, you may use the [underlying build scripts](build_system.md).
The first command selects the build configuration you wish to build and
generates the build system itself in an output directory
(e.g., `out/debug-x86-64`).
Run `envhelp` to see other useful shell functions, and `envhelp <function>` for
specific usage information.
The second command actually executes the build, transforming the source code in
build products. If you modify the source tree, you can do an incremental build
by re-running the `fx full-build` command alone.
Optionally, you might find it useful to add a shell function `fuchsia` as a
shortcut to setup the build environment. For that, add this to your shell startup
script (e.g. `~/.bashrc`):
```
export FUCHSIA_DIR=/path/to/my/fuchsia/source
function fuchsia() {
source $FUCHSIA_DIR/scripts/env.sh && envprompt && fgo && fset x86-64 "$@"
}
```
Alternatively, you can use the [underlying build system directly](build_system.md).
#### [optional] Customize Build Environment
......@@ -106,24 +98,14 @@ by default in preference to `ccache`. To disable `goma`, specify `--no-goma`.]
Run `fset-usage` to see a list of build options. Some examples:
```
fset x86-64 # x86-64 debug build
fset arm64 # arm64 debug build
fset x86-64 --release # x86-64 release build
fset x86-64 --ccache # x86-64 debug build, force use of ccache even if goma is available
fset x86-64 --no-goma # x86-64 debug build, disable use of goma
fset x86-64 --no-ccache # x86-64 debug build, disable use of ccache
fx set x86-64 # x86-64 debug build
fx set arm64 # arm64 debug build
fx set x86-64 --release # x86-64 release build
fx set x86-64 --ccache # x86-64 debug build, force use of ccache even if goma is available
fx set x86-64 --no-goma # x86-64 debug build, disable use of goma
fx set x86-64 --no-ccache # x86-64 debug build, disable use of ccache
```
### Start the build
Once you have setup your build environment, simply run:
```
fbuild
```
This builds Zircon, the sysroot, and the default Fuchsia build.
## Boot Fuchsia
### Boot from hardware
......@@ -154,26 +136,26 @@ If you don't have the supported hardware, you can run Fuchsia under emulation
using [QEMU](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/qemu.md).
Fuchsia includes prebuilt binaries for QEMU under `buildtools/qemu`.
The `frun` command will launch Zircon within QEMU, using the locally built
The `fx run` command will launch Zircon within QEMU, using the locally built
`user.bootfs`:
```
frun
fx run
```
There are various flags for `frun` to control QEMU's configuration:
There are various flags for `fx run` to control QEMU's configuration:
* `-m` sets QEMU's memory size in MB.
* `-g` enables graphics (see below).
* `-N` enables networking (see below).
Use `frun -h` to see all available options.
Use `fx run -h` to see all available options.
#### Enabling Graphics
To enable graphics under QEMU, add the `-g` flag to `frun`:
To enable graphics under QEMU, add the `-g` flag to `fx run`:
```
frun -g
fx run -g
```
#### Enabling Network
......@@ -183,10 +165,10 @@ Note: Networking support within QEMU is only available under x86_64.
First, [configure](https://fuchsia.googlesource.com/zircon/+/master/docs/qemu.md#Enabling-Networking-under-QEMU-x86_64-only)
a virtual interface for QEMU's use.
Once this is done you can add the `-N` and `-u` flags to `frun`:
Once this is done you can add the `-N` and `-u` flags to `fx run`:
```
frun -N -u $FUCHSIA_SCRIPTS_DIR/start-dhcp-server.sh
fx run -N -u $FUCHSIA_SCRIPTS_DIR/start-dhcp-server.sh
```
The `-u` flag runs a script that sets up a local DHCP server and NAT to
......@@ -241,6 +223,7 @@ you can launch [moterm](https://fuchsia.googlesource.com/moterm/) by selecting t
box and typing "moterm"
## Contribute changes
* See [CONTRIBUTING.md](CONTRIBUTING.md).
## Additional helpful documents
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment