更新 src/compile/sharebuild-aosp14.md
Some checks failed
CI/CD Pipeline for mengning.com.cn / build (pull_request) Has been cancelled
Some checks failed
CI/CD Pipeline for mengning.com.cn / build (pull_request) Has been cancelled
This commit is contained in:
@@ -2,8 +2,19 @@
|
|||||||
|
|
||||||
## 编译环境准备
|
## 编译环境准备
|
||||||
|
|
||||||
### 安装编译依赖
|
### 安装 Sharebuild
|
||||||
|
|
||||||
|
* 参与编译的同一个局域网内的A、B、C等所有节点上安装ninja2和sharebuild:
|
||||||
|
```
|
||||||
|
wget -c https://raw.githubusercontent.com/ninja-cloudbuild/ninja2/refs/heads/main/install.sh && chmod +x install.sh && sudo ./install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
* 确保所有节点上均安装配置好了项目的编译环境,即所有节点上均能采用ninja成功单机编译项目。
|
||||||
|
|
||||||
|
### 安装AOSP项目编译环境
|
||||||
|
|
||||||
* 参与编译的同一个局域网内的A、B、C等所有节点上安装编译环境依赖:
|
* 参与编译的同一个局域网内的A、B、C等所有节点上安装编译环境依赖:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 安装核心开发工具和库
|
# 安装核心开发工具和库
|
||||||
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
|
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
|
||||||
@@ -14,31 +25,35 @@ sudo apt-get install openjdk-17-jdk
|
|||||||
# 确保Python 3环境正确安装
|
# 确保Python 3环境正确安装
|
||||||
sudo apt-get install python3 python3-pip
|
sudo apt-get install python3 python3-pip
|
||||||
```
|
```
|
||||||
### 下载 AOSP 源码
|
|
||||||
|
### 下载 AOSP 源码并执行单机编译
|
||||||
|
|
||||||
* 选择任一节点作为客户端节点,下载AOSP14源码:
|
* 选择任一节点作为客户端节点,下载AOSP14源码:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir ~/bin && curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo && chmod a+x ~/bin/repo
|
mkdir ~/bin && curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo && chmod a+x ~/bin/repo
|
||||||
export PATH=~/bin:$PATH
|
export PATH=~/bin:$PATH
|
||||||
|
|
||||||
repo init --depth=1 --partial-clone -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_r2
|
repo init --depth=1 --partial-clone -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_r2
|
||||||
repo sync -j16
|
repo sync -j16
|
||||||
```
|
|
||||||
### 配置 Sharebuild 环境
|
|
||||||
|
|
||||||
* 参与编译的同一个局域网内的A、B、C等所有节点上安装ninja2和sharebuild:
|
cd android-14.0.0_r2
|
||||||
```
|
source build/envsetup.sh # 初始化环境
|
||||||
wget -c https://raw.githubusercontent.com/ninja-cloudbuild/ninja2/refs/heads/main/install.sh && chmod +x install.sh && sudo ./install.sh
|
lunch aosp_arm-eng # 选择目标配置
|
||||||
|
make # 执行单机编译,编译成功后可以看到:
|
||||||
|
# add some output
|
||||||
```
|
```
|
||||||
|
|
||||||
* 确保所有节点上均安装配置好了项目的编译环境,即所有节点上均能采用ninja成功单机编译项目。
|
### 配置AOSP项目开启ShareBuild模式
|
||||||
|
|
||||||
* 将.sharebuild.yml 复制到 AOSP 根目录
|
* 将.sharebuild.yml 复制到 AOSP 根目录
|
||||||
```
|
```
|
||||||
cp /etc/ninja2/aosp14/.sharebuild.yml android-14.0.0_r2
|
cd android-14.0.0_r2
|
||||||
|
cp /etc/ninja2/aosp14/.sharebuild.yml ./
|
||||||
```
|
```
|
||||||
|
|
||||||
* 进入AOSP14项目根目录,替换 AOSP 内部 ninja 为 android_ninja
|
* 进入AOSP14项目根目录,替换 AOSP 内部 ninja 为 android_ninja
|
||||||
```
|
```
|
||||||
cd android-14.0.0_r2
|
|
||||||
cp /usr/bin/android_ninja prebuilts/build-tools/linux-x86/bin/ninja
|
cp /usr/bin/android_ninja prebuilts/build-tools/linux-x86/bin/ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -48,20 +63,18 @@ cp /usr/bin/android_ninja prebuilts/build-tools/linux-x86/bin/ninja
|
|||||||
sharebuid:true
|
sharebuid:true
|
||||||
```
|
```
|
||||||
|
|
||||||
* 在项目根目录下进行分布式编译。
|
* 在项目根目录下执行分布式编译
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
su # 切换到 root 关闭沙箱
|
su # 切换到 root 关闭沙箱
|
||||||
source build/envsetup.sh # 初始化环境
|
source build/envsetup.sh # 初始化环境
|
||||||
lunch aosp_arm-eng # 选择目标配置
|
lunch aosp_arm-eng # 选择目标配置
|
||||||
|
make # 执行分不知编译,编译成功后可以看到:
|
||||||
make # 执行编译任务
|
# add some output
|
||||||
|
make clean # 清除编译目标文件
|
||||||
|
|
||||||
rm -r out # 清除编译产物
|
rm -r out # 清除编译产物
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 版权声明
|
## 版权声明
|
||||||
|
|
||||||
Copyright @ Mengning Software
|
Copyright @ Mengning Software
|
||||||
|
|||||||
Reference in New Issue
Block a user