博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Fuchsia OS入门官方文档
阅读量:4569 次
发布时间:2019-06-08

本文共 6391 字,大约阅读时间需要 21 分钟。

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  , 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   doc.

 

Contents

 

Prerequisites

Prepare your build environment (once per build environment)

Debian

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

macOS

  1. Install Command Line Tools:

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

Get the Source

Follow  and then return to this document.

Build Fuchsia

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

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.

fx set x64fx 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 .

[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:

fx set x64                 # x64 debug buildfx set arm64               # arm64 debug buildfx 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:

--ccache     # force use of ccache even if goma is available--no-ccache  # disable use of ccache--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  will help you get up and running with.

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

Boot from QEMU

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

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

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:

fx run -g

Enabling Network

First,  a virtual interface for QEMU's use.

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

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:

fortune

To shutdown or reboot Fuchsia, use the dm command:

dm helpdm shutdown

Change some source

Almost everything that exists on a Fuchsia system is stored in a Fuchsia package. A typical development  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:

fx serve -v

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

fx build-push rolldice

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

run rolldice

Select a tab

Fuchsia shows multiple tabs after booting . 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  system compositor. You can launch such components, commonly found in /system/apps, like this:

launch spinning_square_view

Source code for Mozart example apps is .

When you launch something that uses Mozart, uses hardware-accelerated graphics, or if you build the  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  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.

/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:

fx run-test 
[
]

You may wish to peruse the .

Contribute changes

  • See .

Additional helpful documents

  •  hub
  • Working with Zircon - 
  • .

 

转载于:https://www.cnblogs.com/mickssr/p/10049202.html

你可能感兴趣的文章
jmeter之jdbc请求
查看>>
C语言习题三
查看>>
94. Binary Tree Inorder Traversal
查看>>
MongoDB安装及多实例启动
查看>>
[css]我要用css画幅画(三)
查看>>
eletron打包
查看>>
numpy
查看>>
django | 连接mysql数据库
查看>>
labelme2coco问题:TypeError: Object of type 'int64' is not JSON serializable
查看>>
Python字符串操作
查看>>
连接池
查看>>
使用易语言COM对象取文件版本
查看>>
3、将uboot,kernel,rootfs下载到开发板上
查看>>
2.16.10.init进程详解1
查看>>
对redis深入理解
查看>>
centos7 install idea and x-windows
查看>>
Spring Boot + Spring Cloud 构建微服务系统(九):配置中心(Spring Cloud Config)
查看>>
【转】LINQ to SQL语句(1)之Where
查看>>
《基于MVC的javascript web富应用开发》中的一些函数
查看>>
0014---简单的计算
查看>>