1.创建工作目录:
mkdir ~/asop
cd ~/asop
2.获取repo工具:
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ./bin/repo
chmod a+x ./bin/repo
3.设置环境变量:
vi ~/.bashrc
+ export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
source ~/.bashrc
4.repo 初始化:
./bin/repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest --git-lfs --depth=1 -b android-12.0.0_r34
5.添加redroid:
git clone https://github.com/remote-android/local_manifests.git ~/asop/.repo/local_manifests -b 12.0.0
6.同步代码:
./bin/repo sync -c -j$(nproc) 线程过多请用下边的
./bin/repo sync -c -j8
7.安装redroid补丁:
mkdir redroid
cd redroid
git clone https://github.com/remote-android/redroid-patches.git
~/redroid/redroid-patches/apply-patch.sh ~/asop android-12.0.0_r34
8.编译redroid:(这里本人有android编译服务就没有用docker)
cd ~/asop
. build/envsetup.sh
lunch redroid_arm64-userdebug
m -j$(nproc)
9.chromium-webview报错和处理:
error: hooks is different in /home/furao/asop/.repo/projects/external/chromium-webview.git vs /home/furao/asop/.repo/project-objects/chromium-webview-stub.git
error.GitError: Cannot fetch --force-sync not enabled; cannot overwrite a local work tree. If you're comfortable with the possibility of losing the work tree's git metadata, use `repo sync --force-sync external/chromium-webview` to proceed.
处理方法:
./bin/repo sync --force-sync external/chromium-webview
./bin/repo sync -c -j8
10.检查chromium-webview:
find ~/asop/external/chromium-webview -type f -name "*.apk" -exec du -h {} +
11.打包
cd ~/asop/out/target/product/redroid_arm64
sudo mount system.img system -o ro
sudo mount vendor.img vendor -o ro
sudo tar --xattrs -avcf redroid12.tar.xz vendor -C system --exclude="./vendor" .
sudo umount system vendor
引用: