B2G OS构建指南(MDN官网):
https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/B2G_OS_build_prerequisites
推荐使用Ubuntu 14.04 LTS,故以此版本为基础来进行工具链添加、镜像导出。
sudo dpkg --add-architecture i386
sudo dpkg --add-architecture amd64
sudo apt-get install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git lib32ncurses5-dev lib32z1-dev libgconf2-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip lzop libxml2-utils openjdk-7-jdk nodejs unzip python libxt6
使用 ccache 编译工具加快构建速度(大多数代码在重复构建时不会改变)
$ ccache -M 50G
$ ccache -s
cache directory /root/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 0
files in cache 0
cache size 0 Kbytes
max cache size 50.0 Gbytes
对于 Android8.0 的源码,我们需要将 jdk 更新至 1.8.x 的版本,才能完成编译
Ubuntu 14.04 上安装 java8 步骤:
1.1 安装python-software-properties, 提供 add-apt-repository 支持
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
1.2 添加ppa并更新源
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
1.3 安装Java8(jdk.1.8.x)
$ sudo apt-get install oracle-java8-installer
此时仍然报:Unable to locate package oracle-java8-installer
继续添加 openjdk 的 ppa:
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package oracle-java8-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘oracle-java8-installer‘ has no installation candidate
不管 ‘oracle-java8-installer‘ 的安装了,直接装 openjdk-8-jdk
$ sudo apt-get install openjdk-8-jdk
1.4 切换至jdk8并验证
由于机器上存在两个版本的jdk,故要进行切换
$ update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1~14.04-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
bc 是字符终端下的一个计算器,在ubuntu14.04镜像内没有安装,补装就可以了
sudo apt install bc
经检查报错点,发现 py 下 os.environ 中没有 SHELL
奇怪的是 echo $SHELL
能看到 `/bin/bash`
先修改 /etc/bash.bashrc 如下:
....
# Added by Chanj Wang, 22/05/20
# When compiling codes, py shell will give error
# "Exception: Could not detect environment shell!"
# So we add it manually
export SHELL=/bin/bash
再导入当前终端中,source /etc/bash.bashrc
rsync 是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件。
rsync使用所谓的“rsync算法”来使本地和远程两个主机之间的文件达到同步,
这个算法只传送两个文件的不同部分,而不是每次都整份传送,因此速度相当快。
sudo apt install rsync
原文:https://www.cnblogs.com/hencins/p/12939403.html