First, preliminary preparation
Test phone preparation:
Test equipment: OnePlus 3/3T
Equipment code: Oneplus3
Android version: 10.0
PC environment configuration:
Development environment :Windows10 64bit+VMware+ Ubuntu
Vm version :VMware Workstation 15 Player
Ubuntu System distribution:
Version Ubuntu18.04
Memory At least 12G RAM
The hard disk space is at least 200GB
Configure ADB and FastBoot
1. Download the platform-Tools package
Download address: platform-tools download address
2. Decompress the package to a specified directory
Run the following command:
Mkdir -p /home/qiang/android unzip platform-tools_r30.0.5-linux.zip -d /home/qiang/androidCopy the code
As shown below:
3. Configure adb and fastboot commands
Open the ~/.bashrc file with the Vim editor, add the following text and save
#add Android Sdk platform tools to path
#add START
export ADB_PATH=/home/qiang/Android/platform-tools
export PATH=$PATH:$ADB_PATH
#add END
Copy the code
Run the source ~/. Bashrc command to update environment variables, and open the terminal to check whether adb and fastboot take effect. As shown below:
Download and compile LineageOs
1. Install dependencies
Run the following commands to install the necessary libraries and tools
sudo apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick Lib32ncurses5 -dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-devCopy the code
Run the following command to install openJDK-8-JDK
sudo apt-get install openjdk-8-jdk
Copy the code
2. Create necessary directories
Run the following command to create the source directory:
mkdir -p /home/qiang/lineageAndroid10
Copy the code
Run the following command to create the git-repo tool save directory
mkdir -p /home/qiang/bin
Copy the code
3. Install the repo command
Because the use of Google’s REPO source need to hang agent, so we use the domestic Tsinghua repO source, without hanging agent can quickly download the Android source code. Run the following command to download the repO:
The curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo - o/home/qiang/bin/repo chmod + x/home/qiang/bin/repoCopy the code
To add the repo command to the environment variable, use the vim tool to open the ~/. Bashrc file as follows:
Vim ~ / bashrcCopy the code
Add the following to the file:
Export REPO_PATH=/home/qiang/bin/repo export PATH=$PATH:$REPO_PATH export REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'Copy the code
Update environment variables with the following command:
The source ~ / bashrcCopy the code
4. Download source code
Version 17.1 in lineageOs corresponds to Android 10. Initialize the repository by executing the following command:
CD/home/qiang/lineageAndroid10 repo init -u https://github.com/LineageOS/android.git - b lineage - 17.1Copy the code
After initialization, run the following command to download the source code:
Repo sync - j4Copy the code
5. Use the undead script to download the source code
(1). Since the source code downloaded by executing repo sync command on the terminal is easily terminated and quit unexpectedly, you can use the following immortal script to download it. Save the following script content as download.sh:
#! / bin/bash echo "= = = = = = = = = = start repo sync = = =" repo init -u https://github.com/LineageOS/android.git - b Lineage 17.1 repo sync-j4-d --force-sync --no-clone-bundle while [$?!=0]; Do echo "= = = resync = = =" repo sync - j4 - d - force - sync - no - clone - bundle doneCopy the code
(2) to download. The sh file is copied to/home/qiang/lineageAndroid10, and perform the download. Sh script commands reference:
Cp/home/qiang/download. Sh/home/qiang lineageAndroid10 / download. Sh CD/home/qiang/lineageAndroid10 chmod 777 /home/qiang/lineageAndroid10/download.sh ./download.shCopy the code
After the above work, you can go to drink tea, sun and wait for the source code synchronization.