override
最近给电脑换了块SSD,装了Ubuntu 18.04。之前的aosp也不想copy过来了,直接重新编译一份,顺带看下新的SSD带来的提效。
因为手机是 nexus 6p,aosp 最后支持到 8.1. 记录下编译需要的操作。
步骤
- open jdk(https://openjdk.java.net/install/)
1
|
sudo apt install openjdk-8-jdk
|
- repo(https://gerrit.googlesource.com/git-repo/)
1
|
sudo apt-get install repo
|
1
2
3
4
|
$ mkdir -p ~/.bin
$ PATH="${HOME}/.bin:${PATH}"
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
$ chmod a+rx ~/.bin/repo
|
- AOSP mirror
1
2
3
4
5
6
7
8
9
10
11
12
|
git config --global user.email "tinggengyan@gmail.com"
git config --global user.name "Tinggeng Yan"
sudo apt install python
cd aosp
## 切换指定版本分支
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-8.1.0_r52 --depth=1 --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --repo-branch=stable
repo sync --current-branch
|
- build
1
2
3
4
5
6
7
8
9
10
11
|
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache
|
1
2
3
4
5
6
|
export LC_ALL=C
source build/envsetup.sh && lunch
make -j 4
|
- flash into nexus 6p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
cd /data/aosp/out/target/product/angler
adb reboot bootloader
fastboot devices
##下面这条命令可选
##fastboot flashall -w
##-w 选项会清除设备上的 /data 分区;
##该选项在您第一次刷写特定设备时非常有用,但在其他情况下则没必要使用。
fastboot flash vendor vendor.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot flash cache cache.img
fastboot reboot
|
emulator
需要编译对应的模拟器的镜像。
1
2
3
4
5
6
7
|
source build/envsetup.sh
lunch 2 #这里填序号aosp_arm64-eng为2
make -j 4
emulator
|
如果编译完成后关闭了终端窗口,则需要用以下方式启动模拟器
1
2
3
4
5
6
|
source build/envsetup.sh
lunch 2 #这里填序号aosp_arm64-eng为2
emulator
|
other
- 可能出现的错误
1
|
error: insufficient permissions for device: udev requires plugdev group membership
|
add group
1
|
sudo usermod -aG plugdev $LOGNAME
|
ref
ref
sony developer
version branch AOSP tags