nlacasse / fnl-start

Contains manifests and scripts to tie all the other FNL repos together. (New? Start here.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fnl-start

Contains manifests and scripts to tie all the other FNL repos together. (New? Start here.)

Syncing the source with jiri

Fuchsia uses the jiri tool to manage repositories. The $JIRI_ROOT variable determines where jiri and the Fuchsia repositories will be placed.

$JIRI_ROOT/
    devtools/    # A jiri repo
    fnl-start/   # A Fuchsia repo
    kernel/      # Another Fuchsia repo
    release/     # The other jiri repo
    ...

The list of these repos is contained in the XML manifests in $JIRI_ROOT/.manifest/v2; in particular, the default and minimal files. The jiri tool imposes the location and name of this directory (v2 means we are using the second version of the manifest syntax).

The jiri setup will check that the $JIRI_ROOT variable is set to a directory that does not exist, which it will create and populate.

Once you have set $JIRI_ROOT, you can download and invoke bootstrap. This will install jiri, and use it to install all of the repositories listed in manifest.

Once you have installed jiri, you should add $JIRI_ROOT/devtools/bin to your $PATH.

jiri update will update all repositories to the branches specified in the manifest.

Build dependencies

Building Fuchsia depends on (at least) the following aptitude packages:

  1. bc
  2. bison
  3. cgpt
  4. flex
  5. gdisk
  6. golang
  7. libssl-dev
  8. m4
  9. nasm
  10. python-mako
  11. re2c
  12. upx-ucl
  13. uuid-dev
  14. vboot-kernel-utils
  15. android-tools-fsutils

Building Fuchsia

Once the source is downloaded, build Fuchsia for the first time with these commands:

$  cd $JIRI_ROOT
$  ./build/bootstrap.bash  # You only need to do this once.
$  ./fuchsia-build fuchsia/bootimg/[target]
$  # [target] is a hardware target like 'qemu' or 'pixel2'

Only the fuchsia-build command is required to re-build Fuchsia thereafter.

The bootstrap script creates fuchsia-build, which parses Blueprint files, creates build.ninja, and runs ninja. ninja builds the final image using the rules and dependencies from build.ninja. fuchsia/bootimg/foo is the build target, and the products are placed in ./out. For more documentation on the build system, see build/README.md.

The products in the out directory depend on the target chosen. For qemu, ./out/boot.img is a UEFI system partition image you can boot with qemu-system-x86_64. For pixel2, a kernel image and a root directory structure are created (./out/bootimg/pixel2_kernel.bin and ./out/root/x86_64-fuchsia-linux-musl, respectively).

Building Fuchsia with Mojo

The repos that are checked out depend on the manifest you provide to jiri update. To build Mojo for Fuchsia, you must first checkout the with-mojo manifest. Then, mojo must be built using the Fuchsia toolchain. The fuchsia/rootimg/mojo Ninja target builds and installs mojo into the $JIRI_ROOT/out/root system root.

$  jiri update -manifest=with-mojo
$  ./fuchsia-build fuchsia/bootimg/pixel2
$  ./fuchsia-build fuchsia/rootimg/mojo

Contributing

For instructions on filing issues or contributing changes, see CONTRIBUTING.md.

Appendix: from empty directory to booting a built image

Below is a sample record of the commands used to go from an empty directory to a full build for the pixel2. These are provided as reference only; if you don't know what a command does, you should probably find out before running it.

~ ★  cd /fuchsia
/fuchsia ★  ls -l clean
No such file or directory
/fuchsia ★  export JIRI_ROOT=/fuchsia/clean
/fuchsia ★  wget https://raw.githubusercontent.com/effenel/fnl-start/master/bootstrap
/fuchsia ★  bash ./bootstrap
/fuchsia ★  export PATH=$PATH:$JIRI_ROOT/devtools/bin
/fuchsia ★  jiri update  # Alternative: `jiri update -manifest=with-mojo`
/fuchsia ★  cd $JIRI_ROOT
/fuchsia/clean ★  ./build/bootstrap.bash
/fuchsia/clean ★  ./fuchsia-build fuchsia/bootimg/pixel2
/fuchsia/clean ★  ./fuchsia-build fuchsia/rootimg/mojo  # Optional: adds mojo to the image
/fuchsia/clean ★  sudo ./rootimg/make_bootable_usb.sh /dev/sdd ./out/bootimg/pixel2_kernel.bin ./out/root/x86_64-fuchsia-linux-musl

About

Contains manifests and scripts to tie all the other FNL repos together. (New? Start here.)

License:Apache License 2.0


Languages

Language:Shell 100.0%