fuchsia os环境配置记录

adtxl
2024-06-22 / 0 评论 / 29 阅读 / 正在检测是否收录...

fuchsia开发者文档还是比较完善的,具体细节可以直接去看官方文档

1. 代码下载

下面这个可以直接下载到fuchsia整个源码,在同一个git仓库中,如果只是查看源码可以用这个。

git clone https://fuchsia.googlesource.com/fuchsia

否则还是根据fuchsia网站上的下载方式下载代码吧。

curl -s "https://fuchsia.googlesource.com/fuchsia/+/HEAD/scripts/bootstrap?format=TEXT" | base64 --decode | bash

代码下载完成后,将jiri和fx添加到环境变量中,方便使用。

export PATH=$PATH:/home/user/tanxl/github/fuchsia/.jiri_root/bin/
export PATH=$PATH:/home/user/tanxl/github/fuchsia/scripts/
source /home/user/tanxl/github/fuchsia/scripts/fx-env.sh

网不好的话prebuilt包可能拉不下来,可以jiri update更新,加上时间,默认应该是20分钟,可以延长到600分钟。

jiri update  -fetch-packages-timeout=600

2. 代码编译

例如,一个基础的模拟器启动流程

  $ fx set core.x64 --with //examples/hello_world
  $ fx build
  $ fx ffx emu start --headless --net tap  # headless with tun/tap-based networking
  // 也可以只用启动console,不用网络
  $ fx ffx emu start --console
  $ fx serve                               # [Start in a new window]
  $ fx test hello-world-cpp-unittests      # [Start in a new window] Run test
  $ fx ffx emu stop                        # Shut down the emulator

启动效果如下,
image.png

启动其他product示例

fx set workbench_eng.x64 --release
fx build
fx serve

// FUCHSIA_ROOT 是 Fuchsia 目录的路径。
ffx config set emu.upscript FUCHSIA_ROOT/scripts/start-unsecure-internet.sh

// 如需启动能够访问外部网络的模拟器,请运行以下命令:
ffx emu start --net tap
// 如需在无法访问外部网络的情况下启动模拟器,请运行以下命令:
 ffx emu start --net none
0

评论 (0)

取消