Fuchsia

Pink + Purple == Fuchsia (a new Operating System)

Welcome to Fuchsia! This document has everything you need to get started with Fuchsia.

NOTE: The Fuchsia source includes Zircon, the core platform that underpins Fuchsia. The Fuchsia build process will build Zircon as a side-effect; to work on Zircon only, read and follow Zircon's Getting Started doc.

Prerequisites

Prepare your build environment (once per build environment)

Debian

  1. sudo apt-get install build-essential curl git python unzip

macOS

  1. Install Command Line Tools:

    1. xcode-select --install
  2. In addition to Command Line Tools, you also need to install a recent version of Xcode.

Get the Source

Follow the instructions to get the Fuchsia source and then return to this document.

Build Fuchsia

Note: A quick overview of the basic build-and-pave workflow can be found here.

Build

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 scripts/fx.

  1. fx set x64
  2. fx full-build

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-x64).

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.

Alternatively, you can use the underlying build system directly.

[optional] Customize Build Environment

By default you will get a x64 debug build. You can skip this section unless you want something else.

Run fset-usage to see a list of build options. Some examples:

  1. fx set x64 # x64 debug build
  2. fx set arm64 # arm64 debug build
  3. fx set x64 --release # x64 release build

[optional] Accelerate builds with ccache and goma

ccache accelerates builds by caching artifacts from previous builds. ccache is enabled automatically if the CCACHE_DIR environment variable is set and refers to a directory that exists.

[Googlers only: goma accelerates builds by distributing compilation across many machines. If you have goma installed in ~/goma, it is used by default. It is also used by default in preference to ccache.]

To override the default behaviors, pass flags to fx set:

  1. --ccache # force use of ccache even if goma is available
  2. --no-ccache # disable use of ccache
  3. --no-goma # disable use of goma

Boot Fuchsia

Installing and booting from hardware

To get Fuchsia running on hardware requires using the paver, which these instructions will help you get up and running with.

Note: A quick overview of the basic build-and-pave workflow can be found here.

Boot from QEMU

If you don't have the supported hardware, you can run Fuchsia under emulation using QEMU. Fuchsia includes prebuilt binaries for QEMU under buildtools/qemu.

The fx run command will launch Zircon within QEMU, using the locally built disk image:

  1. fx run

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 fx run -h to see all available options.

QEMU tips

  • ctrl+a x will exit QEMU in text mode.
  • ctrl+a ? or ctrl+a h prints all supported commands.

Enabling Graphics

Note: Graphics under QEMU are extremely limited due to a lack of Vulkan support. Only the Zircon UI renders.

To enable graphics under QEMU, add the -g flag to fx run:

  1. fx run -g

Enabling Network

First, configure a virtual interface for QEMU's use.

Once this is done you can add the -N and -u flags to fx run:

  1. 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 configure the IPv4 interface and routing.

Explore Fuchsia

When Fuchsia has booted and displays the “$” shell prompt, you can run programs!

For example, to receive deep wisdom, run:

  1. fortune

To shutdown or reboot Fuchsia, use the dm command:

  1. dm help
  2. dm shutdown

Change some source

Almost everything that exists on a Fuchsia system is stored in a Fuchsia package. A typical development workflow involves re-building and pushing Fuchsia packages to a development device or QEMU virtual device.

Make a change to the rolldice binary in garnet/bin/rolldice/src/main.rs.

In a separate shell, start the development update server, if it isn't already running:

  1. fx serve -v

Re-build and push the rolldice package to a running Fuchsia device with:

  1. fx build-push rolldice

From a shell prompt on the Fuchsia device, run the updated package with:

  1. run rolldice

Select a tab

Fuchsia shows multiple tabs after booting with graphics enabled. The currently selected tab is highlighted in yellow at the top of the screen. You can switch to the next tab using Alt-Tab on the keyboard.

  • Tab zero is the console and displays the boot and component log.
  • Tabs 1, 2 and 3 contain shells.
  • Tabs 4 and higher contain components you've launched.

Note: to select tabs, you may need to enter “console mode”. See the next section for details.

Launch a graphical component

QEMU does not support Vulkan and therefore cannot run our graphics stack.

Most graphical components in Fuchsia use the Mozart system compositor. You can launch such components, commonly found in /system/apps, like this:

  1. launch spinning_square_view

Source code for Mozart example apps is here.

When you launch something that uses Mozart, uses hardware-accelerated graphics, or if you build the default package (which will boot into the Fuchsia System UI), Fuchsia will enter “graphics mode”, which will not display any of the text shells. In order to use the text shell, you will need to enter “console mode” by pressing Alt-Escape. In console mode, Alt-Tab will have the behavior described in the previous section, and pressing Alt-Escape again will take you back to the graphical shell.

If you would like to use a text shell inside a terminal emulator from within the graphical shell you can launch the term by selecting the “Ask Anything” box and typing moterm.

Running tests

Compiled test binaries are installed in /pkgfs/packages/. You can run a test by invoking it in the terminal. E.g.

  1. /pkgfs/packages/ledger_tests/0/test/ledger_unittests

If you want to leave Fuchsia running and recompile and re-run a test, run Fuchsia with networking enabled in one terminal, then in another terminal, run:

  1. fx run-test <test name> [<test args>]

You may wish to peruse the testing FAQ.

Contribute changes

Additional helpful documents

Fuchsia OS入门官方文档的更多相关文章

  1. [零]java8 函数式编程入门官方文档中文版 java.util.stream 中文版 流处理的相关概念

    前言 本文为java.util.stream 包文档的译文 极其个别部分可能为了更好理解,陈述略有改动,与原文几乎一致 原文可参考在线API文档 https://docs.oracle.com/jav ...

  2. os.path官方文档(附翻译)

    This module implements some useful functions on pathnames. To read or write files see open(), and fo ...

  3. 《SpringCloudDubbo开发日记》(一)Nacos连官方文档都没写好

    背景 现在的微服务框架一般分dubbo和springcloud两套服务治理体系,dubbo是基于zookeeper为注册中心,springcloud是基于eureka作为注册中心. 但是现在eurek ...

  4. 【翻译】Django Channels 官方文档 -- Tutorial

    Django Channels 官方文档 https://channels.readthedocs.io/en/latest/index.html 前言: 最近课程设计需要用到 WebSocket,而 ...

  5. hbase官方文档(转)

    FROM:http://www.just4e.com/hbase.html Apache HBase™ 参考指南  HBase 官方文档中文版 Copyright © 2012 Apache Soft ...

  6. HBase 官方文档

    HBase 官方文档 Copyright © 2010 Apache Software Foundation, 盛大游戏-数据仓库团队-颜开(译) Revision History Revision ...

  7. HBase官方文档

    HBase官方文档 目录 序 1. 入门 1.1. 介绍 1.2. 快速开始 2. Apache HBase (TM)配置 2.1. 基础条件 2.2. HBase 运行模式: 独立和分布式 2.3. ...

  8. HBase 官方文档0.90.4

    HBase 官方文档0.90.4 Copyright © 2010 Apache Software Foundation, 盛大游戏-数据仓库团队-颜开(译) Revision History Rev ...

  9. python中文官方文档记录

    随笔记录 python3.10中文官方文档百度网盘链接:https://pan.baidu.com/s/18XBjPzQTrZa5MLeFkT2whw?pwd=1013 提取码:1013 1.pyth ...

随机推荐

  1. mysql数据库备份脚本一例

    例子,mysql数据库备份脚本.vim mysql.sh #!/bin/bash DAY=`date +%Y-%m-%d` //日期以年月日显示并赋予DAY变量 SIZE=`du -sh /var/l ...

  2. 【Linux】【Shell】【text】文本处理工具

    文本查看及处理工具:wc, cut, sort, uniq, diff, patch wc:word count wc [OPTION]... [FILE]... -l: lines -w:words ...

  3. linux 磁盘满了,vim 编辑文件时无法保存

    早上来发现 redis 不能用,报 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to ...

  4. 如何简单的理解LSTM——其实没有那么复杂(转载)

    转载地址:https://www.jianshu.com/p/4b4701beba92 1.循环神经网络 人类针对每个问题的思考,一般不会是完全的从头开始思考.正如当你阅读这篇译文的时候,你会根据已经 ...

  5. 加密解密、食谱、新冠序列,各种有趣的开源项目Github上都有

    Github上是我们程序员学习开源代码.提升编程技巧的好地方.好学校,但是除了学习,小伙伴们有没有发现过Github上一些特别有意思的项目呢? 今天TJ君就来和大家分享几个自认为特别有趣的开源项目: ...

  6. [BUUCTF]PWN——CmmC_Simplerop

    cmcc_simplerop 附件 步骤 例行检查,32位,开启了nx保护 本地试运行一下程序,查看一下大概的情况 32位ida载入,习惯性的检索程序里的字符串,看了个寂寞,从main函数开始看程序 ...

  7. odoo views中html的奇怪问题

    在我创建了字段类型为 fields.Html 以后,确出现了两种不同的情况 下图中,content是此类型的,可以正常显示不需要加widget(小部件)="html" <fo ...

  8. 【RTOS】FreeRTOS中的任务堆栈溢出检测机制

    目录 前言 任务堆栈 堆栈溢出 任务堆栈溢出检测机制 API 两种堆栈溢出检测方式 堆栈溢出钩子函数 内核何时检测任务堆栈溢出 任务堆栈溢出检测存在的局限性 前言 注意:本笔记发布时可能忘记补充查看d ...

  9. 谷歌protobuf(protocol-buffers)各种开发语言数据类型转换说明

    官方文档:https://developers.google.cn/protocol-buffers/docs/proto proto2 proto3

  10. 【九度OJ】题目1179:阶乘 解题报告

    [九度OJ]题目1179:阶乘 解题报告 标签(空格分隔): 九度OJ http://ac.jobdu.com/problem.php?pid=1179 题目描述: 输入n, 求y1=1!+3!+-m ...