fuchsia编译

由于fuchsia代码主要在googlesource网站上,需要VPN才能方法。以下使用付费的express,开发环境为Ubuntu 16.04.3,如下:
 

$ cat /etc/issue
Ubuntu 16.04.3 LTS \n \l

首先安装并配置express:

$ sudo dpkg -i express_2.1.0-1_amd64.deb
$ express activate
Enter activation code:   //输入激活码
Activating...
Activated.
Help improve ExpressVPN: Share crash reports, speed tests, and whether VPN connection attempts succeed. These reports never contain personally identifiable information. (Y/n) n
$ 
$ express list
Recommended Locations:

ALIAS   COUNTRY                 LOCATION
-----   ---------------         ------------------------------
smart   Smart Location          USA - Los Angeles - 5
hk4     Hong Kong (HK)          Hong Kong - 4

$ express connect " Hong Kong"
Selecting a location in Hong Kong for you...
Connecting to Hong Kong - 4...  100.0%                               
Connected to Hong Kong - 4

 

VPN连接好之后,以下命令下载fuchsia工程代码,curl的-s选项开启静默模式,减少打印信息:

$ curl -s "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
~/work/fuchsia/.jiri_root/bin ~/work
cipd bootstrapped to path:"/home/kai/work/fuchsia/.jiri_root/bin/cipd"
~/work
Please add /home/kai/work/fuchsia/.jiri_root/bin to your PATH

Updating all projects
WARN: Some packages are skipped by cipd due to lack of access, you might want to run "cipd auth-login" and try again
ERROR: context deadline exceeded

期间遇到以上的错误,按照提示执行cipd auth-login命令,打开浏览器访问网址:https://www.googleapis.com/auth/userinfo.email,登录gmail账号,获取到激活码,如下配置:

$ fuchsia/buildtools/cipd auth-login
Getting a refresh token with following OAuth scopes:
  * https://www.googleapis.com/auth/userinfo.email

Visit the following URL to get the authorization code and copy-paste it below.

https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=446450136466-2hr92jrq8e6i4tnsa56b52vacp7t3936.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email

Authorization code: 4/ZQGDaew4WF2dfasdfsdfsdfasdfasdgsfgsdfasdqPctRLcdLG9vgh0Q

Logged in as [email protected].
OAuth token details:
  Client ID: 448675635347546-2hr92jrq8e6i4tnsa56b52vacp7t3936.apps.googleusercontent.com
  Scopes:
    https://www.googleapis.com/auth/userinfo.email
    openid

 

再次运行curl命令:

$ curl -s  "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
~/work/fuchsia/.jiri_root/bin ~/work
cipd bootstrapped to path:"/home/kai/work/fuchsia/.jiri_root/bin/cipd"
~/work
Please add /home/kai/work/fuchsia/.jiri_root/bin to your PATH

Updating all projects
Done creating a Platform Source Tree at "/home/kai/work/fuchsia".
Recommended: export PATH="/home/kai/work/fuchsia/.jiri_root/bin:$PATH"

 

代码下载完成之后,按照提示配置PATH环境变量:

$ export PATH="/home/kai/work/fuchsia/.jiri_root/bin:$PATH"

 

如下所示,将cipd、fx和jiri三个程序添加到了执行路径PATH中。

$ ls fuchsia/.jiri_root/bin/ -l
total 27248
-rwxr-xr-x 1 kai kai 15317191 6月  10 10:43 cipd
lrwxrwxrwx 1 kai kai       16 6月  10 13:43 fx -> ../../scripts/fx
-rwxr-xr-x 1 kai kai 12579551 6月  10 13:39 jiri

 

设置编译目标,其中最后的参数格式为:PRODUCT.BOARD。可使用命令fx list-products和fx list-boards分别参考可用的product和board参数。

fuchsia$ fx set core.x64                              

Generating compile_commands took 363ms
Done. Made 26117 targets from 2168 files in 37189ms
fuchsia$ 

 

最后,运行fuchsia的编译命令:

fuchsia$ fx build

 

END

 

你可能感兴趣的:(fuchsia)