1、环境准备:
Install the platform-tools
If you haven’t previously installed adb
and fastboot
, you can download them from Google. Extract it running:
unzip platform-tools-latest-linux.zip -d ~
Tip: The file may not be named identically to what stands in this command, so adjust accordingly.
Now you have to add adb
and fastboot
to your PATH. Open ~/.profile
and add the following:
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
Then, run source ~/.profile
to update your environment.
Preparing your system to build
check
Tip: This guide assumes that you have Ubuntu 18 (or higher) installed.
Installing git:
sudo apt install git
Running configuration script:
cd ~/
git clone https://github.com/akhilnarang/scripts
cd scripts
./setup/android_build_env.sh
Create the directories
You’ll need to set up some directories in your build environment.
To create them:
mkdir -p ~/bin
mkdir -p ~/android/pe
The ~/bin
directory will contain the git-repo tool (commonly named “repo”) and the ~/android/pe
directory will contain the source code of PixelExperience.
Install the repo
command
Enter the following to download the repo
binary and make it executable (runnable):
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Put the ~/bin
directory in your path of execution
In recent versions of Ubuntu, ~/bin
should already be in your PATH. You can check this by opening ~/.profile
with a text editor and verifying the following code exists (add it if it is missing):
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Then, run source ~/.profile
to update your environment.
Configure git
Given that repo
requires you to identify yourself to sync Android, run the following commands to configure your git
identity:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Initialize the PixelExperience source repository
The following branches can be used to build for the OnePlus 5T:
- twelve (discontinued)
- twelve-plus (discontinued)
- eleven (discontinued)
- eleven-plus (discontinued)
Enter the following to initialize the repository:
info_outline
Note: Make sure the branch you enter here is the one you wish to build!
cd ~/android/pe
repo init -u https://github.com/PixelExperience/manifest -b branch_name
Download the source code
To start the download of the source code to your computer, type the following:
repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
2、同步代码
(2)设备树代码同步:
1)Device:
git clone [email protected]:wxwxwz/android_device_smartisan_osborn.git -b lineage-17.1 device/smartisan/osborn
2) Kernel:
git clone https://github.com/wxwxwz/android_kernel_smartisan_sdm660.git -b lineage-17.1 kernel/smartisan/sdm660
3、Vendor
git clone [email protected]:wxwxwz/android_vendor_smartisan_osborn.git -b lineage-17.1 device/smartisan/osborn
自定义源码配置
1、修改NTP
目录:frameworks/base/core/res/res/values/config.xml
NTP服务器示例:time.apple.com(苹果)
2、修改captive portal
目录:packages/modules/NetworkStack/res/values/config.xml
Captive地址示例:https://connectivitycheck.platform.hicloud.com/generate_204(华为)
问题记录
//如果修改了某些配置,只需要进行一下步骤便可只编译修改的部分
source build/envsetup.sh
make installclean (关键)
brunch(选择需要编译的分支)
//如果遇到inja failed with: exit status 1,则有可能是交换内存关闭,启动即可(或直接重启系统)
//如果修改了某些配置,只需要进行一下步骤便可只编译修改的部分
source build/envsetup.sh
make installclean (关键)
brunch(选择需要编译的分支)
//如果遇到inja failed with: exit status 1,则有可能是交换内存关闭,启动即可(或直接重启系统)
Bug记录:
1、无法启动音频服务导致卡第二屏:
(1)替换frameworks/av/相关文件:使用patch文件(git am **.patch)
(2)替换hardware/interfaces相关文件,同上。
(3)重新编译