aboutsummaryrefslogtreecommitdiffstats
path: root/docs/fuchsia/README.md
diff options
context:
space:
mode:
authorMarco Vanotti <mvanotti@google.com>2019-07-10 17:54:20 -0700
committerDmitry Vyukov <dvyukov@google.com>2019-07-23 08:44:20 +0200
commit1b0aeaa4e84be4449a73b24a0a57c04c02589a81 (patch)
tree9016ed53c68769afe113862bda402b5da0d0fa6c /docs/fuchsia/README.md
parent5aec592bda6468d616f6fa6a6c1fa2d9e6c6895a (diff)
Makefile: build fuchsia go binaries using the sdk
This commit removes a dependency on fuchsia's tools/devshell/contrib/go, which was removed recently[0]. Now to build go binaries for fuchsia we are not relying on the fuchsia.git repo at all. The code just needs a copy of the fuchsia //third_party/go repository, the fuchsia sdk and a copy of clang. Users should download the sdk and clang beforehand (see documentation for links), and then run (with the correct environment variables): ``` $ make TARGETOS=fuchsia TARGETARCH=amd64 \ SOURCEDIR=$HOME/fuchsia \ FX_SDK_PATH=${HOME}/sdk/fuchsia-sdk \ CLANG_PATH=${HOME}/sdk/clang \ fuchsia_go ``` After that, they will be able to build the syzkaller go binaries by doing: ``` $ make TARGETOS=fuchsia TARGETARCH=amd64 \ SOURCEDIR=$HOME/fuchsia \ FX_SDK_PATH=${HOME}/sdk/fuchsia-sdk \ CLANG_PATH=${HOME}/sdk/clang ``` This commits adds two scripts to tools/fuchsia, one for building go in fuchsia (just calls the ./make.all script in fuchsia's go repo), and one that replaces the devshell/contrib/go script. Given that go is unsupported in fuchsia, this change might break at any point. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/291631
Diffstat (limited to 'docs/fuchsia/README.md')
-rw-r--r--docs/fuchsia/README.md73
1 files changed, 56 insertions, 17 deletions
diff --git a/docs/fuchsia/README.md b/docs/fuchsia/README.md
index 93a212c0e..ec1a08335 100644
--- a/docs/fuchsia/README.md
+++ b/docs/fuchsia/README.md
@@ -2,36 +2,52 @@
For information about checking out and building Fuchsia see
[Getting Started](https://fuchsia.googlesource.com/fuchsia/+/master/docs/getting_started.md)
-and [Soure Code](https://fuchsia.googlesource.com/fuchsia/+/master/docs/development/source_code/README.md).
+and [Source Code](https://fuchsia.googlesource.com/fuchsia/+/master/docs/development/source_code/README.md).
-You need to build fuchsia for both amd64 and arm64:
+## Prerequisites
-```shell
-$ fx --dir "out/x64" set core.x64
-$ fx clean-build
-```
+To run syzkaller with a fuchsia target, you will need:
-And
+* A fuchsia checkout.
+* The [fuchsia
+ sdk](https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core/linux-amd64/+/).
+* [clang with fuchsia
+ support](https://chrome-infra-packages.appspot.com/p/fuchsia/clang/linux-amd64/+/).
-```shell
-$ fx --dir "out/arm64" set core.arm64
-$ fx clean-build
-```
+The rest of the document will use the following environment variables:
-Syscall descriptions live in the `sys/fuchsia` folder. To update a syscall, you need to modify the `.txt` file that contains it, make sure your new definition matches the one in zircon's [syscalls.abigen](https://fuchsia.googlesource.com/fuchsia/+/master/zircon/system/public/zircon/syscalls.abigen) file. **If the syscall was used in `executor/common_fuchsia.h`, you need to update the usages there as well**. FIDL definitions do not need manual updating because they are extracted automatically with the commands below.
+* `SOURCEDIR` path of your fuchsia checkout.
+* `FX_SDK_PATH` path where you extracted the fuchsia sdk.
+* `CLANG_PATH` path where you extracted clang.
-Once you updated the syscalls definitions, everything can be regenerated by running:
+### Build Go toolchain for fuchsia
+
+Syzkaller needs to cross-compile it's Go binaries to run in fuchsia, so first
+you need to compile a Go toolchain that can compile binaries for fuchsia.
+
+Once you downloaded and extracted the fuchsia sdk and clang, run:
```
-make extract TARGETOS=fuchsia SOURCEDIR=/path/to/fuchsia/checkout
-make generate
+$ make TARGETOS=fuchsia TARGETARCH=amd64 \
+ SOURCEDIR=path/to/fuchsia/checkout \
+ FX_SDK_PATH=path/to/fuchsia/sdk \
+ CLANG_PATH=path/to/clang \
+ fuchsia_go
```
-To build binaries:
+## Building binaries for fuchsia
+
+To build all the binaries required for running syzkaller in fuchsia, run:
+
```
-make TARGETOS=fuchsia TARGETARCH=amd64 SOURCEDIR=/path/to/fuchsia/checkout
+$ make TARGETOS=fuchsia TARGETARCH=amd64 \
+ SOURCEDIR=path/to/fuchsia/checkout \
+ FX_SDK_PATH=path/to/fuchsia/sdk \
+ CLANG_PATH=path/to/clang
```
+## Running syz-manager
+
Run `syz-manager` with a config along the lines of:
```
{
@@ -57,6 +73,29 @@ Run `syz-manager` with a config along the lines of:
}
```
+## Update syscall and fidl definitions
+
+Syscall descriptions live in the `sys/fuchsia` folder. To update a syscall, you need to modify the `.txt` file that contains it, make sure your new definition matches the one in zircon's [syscalls.abigen](https://fuchsia.googlesource.com/fuchsia/+/master/zircon/system/public/zircon/syscalls.abigen) file. **If the syscall was used in `executor/common_fuchsia.h`, you need to update the usages there as well**. FIDL definitions do not need manual updating because they are extracted automatically when you run make extract, but they require a fuchsia built for each architecture.
+
+To build fuchsia run:
+```shell
+$ fx --dir "out/x64" set core.x64
+$ fx clean-build
+```
+
+And
+
+```shell
+$ fx --dir "out/arm64" set core.arm64
+$ fx clean-build
+```
+
+Once you updated the syscalls definitions, everything can be regenerated by running:
+
+```
+make extract TARGETOS=fuchsia SOURCEDIR=/path/to/fuchsia/checkout
+make generate
+```
## How to generate syscall description for FIDL