Android has been released for some time. As a machine maker, we can't fall behind. Let's open the 12 code today.
It'S been nearly a month since I downloaded this S code. Ha ha, I'm really a sloth. Alas, in fact, there are many problems in the process,
The environment is ruined, and the system has to be reinstalled. Let's sum up today.
Compiling environment
1,Ubuntu16.04.5 system
2. Samsung 500G SSD EVO series
3. Memory 8G, cpu 4 cores, I5(8 years old, just make do with it)
4. One used Pixel 3 XL
Pit collection
1. Disk size
If you drive this set of code in the virtual machine, the disk size is at least 200G (a lesson of blood and tears). After three times of expansion, it is still not large enough
The repo folder alone has about 70G

The disk space must be large, large and large
Not a virtual machine. Please ignore this step
2. Python version requirements
When downloading the S code of aosp this time, there is a problem with repo init. The prompt requires Python version 3.6 or above

It also took a long time to solve this problem. For details, please refer to Linux python upgrade
Download the latest version of python-3.9.0 from the official website 8. Decompress. Don't worry about making install after decompressing
There's a small hole. I'll report it
ModuleNotFoundError: No module named ‘_ ctypes' this error
And ModuleNotFoundError: No module named '_ ssl 'this error

Solution, execute the following two instructions
sudo apt-get install libssl-dev openssl sudo apt-get install libffi-dev
After success, refer to Resolving modulenotfounderror in Python 3 virtual environment: no module named '_ ssl’
Modify the source code vim Modules/Setup
Cancel_ socket socketmodule.c and SLL notes below
Then perform the make install installation to reconfigure the environment variables.
3. HTTP SSL certificate problem
Execute git config -- global http Sslverify false close
cczheng@ubantu:~/google$ cd Android12/ cczheng@ubantu:~/google/Android12$ export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo' cczheng@ubantu:~/google/Android12$ repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-12.0.0_r3 Downloading Repo source from https://gerrit-googlesource.proxy.ustclug.org/git-repo fatal: unable to access 'https://gerrit-googlesource.proxy.ustclug.org/git-repo/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none repo: error: "git" failed with exit status 128 cwd: /home/cczheng/google/Android12/.repo/repo cmd: ['git', 'fetch', '--quiet', '--progress', 'origin', '+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*'] fatal: cloning the git-repo repository failed, will remove '.repo/repo' cczheng@ubantu:~/google/Android12$ git config --global http.sslverify false cczheng@ubantu:~/google/Android12$ repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-12.0.0_r3 Downloading Repo source from https://gerrit-googlesource.proxy.ustclug.org/git-repo ... A new version of repo (2.17) is available. ... You should upgrade soon: cp /home/cczheng/google/Android12/.repo/repo/repo /home/cczheng/bin/repo Downloading manifest from git://mirrors.ustc.edu.cn/aosp/platform/manifest remote: Enumerating objects: 92903, done. remote: Counting objects: 100% (92903/92903), done. remote: Compressing objects: 100% (41747/41747), done. remote: Total 92903 (delta 31091), reused 92896 (delta 31088) Your identity is: yangtao <yangtao@innovatech.net.cn> If you want to change this, please re-run 'repo init' with --config-name repo has been initialized in /home/cczheng/google/Android12
After these steps, repo init can finally succeed.

preparation
1. Set up git account
git config --global user.email "xxxxxxx@gmail.com" git config --global user.name "xxxxx"
2. Configure PATH environment variable
mkdir ~/bin echo "PATH=~/bin:\$PATH" >> ~/.bashrc source ~/.bashrc
3. Install curl library and set permissions
sudo apt-get install curl curl -sSL 'https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT' |base64 -d > ~/bin/repo chmod a+x ~/bin/repo
Download source code
1. Create working directory
mkdir Android12 cd Android12
2. Add HKUST image source
export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo'
3. Initialize the repository and specify the android version to download
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-12.0.0_r3
4. Synchronous source code
repo sync -j4

Compile source code
1. Install openjdk8
sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jdk
If there are multiple java versions in the computer, select openjdk-8 through the following command
sudo update-alternative --config java sudo update-alternative --config javac
2. Install dependent Libraries
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 sudo apt-get install libssl-dev
3. Download the corresponding closed source driver file into the source code
You can download the corresponding pixel driver file or the complete rom package at the following address
4. Start compilation
View the details of the current cpu through the lscpu command
Execute command
source build/envsetup.sh lunch 25 (aosp_crosshatch-userdebug edition) make -j8
lunch make -j cpu cores * 2 according to the above cpu types
23 hours after compilation, ha ha

Brush the machine, refer to the official package, write a brush script yourself, and compile the following files in the out directory

copy it out and add it all to the compressed file aosp12 zip
Then execute in sequence
adb reboot fastboot
fastboot -w update .\aosp12.zip
fastboot reboot
PS H:\rom12\aosp12> adb reboot fastboot PS H:\rom12\aosp12> fastboot -w update .\aosp12.zip -------------------------------------------- Bootloader Version...: b1c1-0.4-7617406 Baseband Version.....: g845-00194-210812-B-7635520 Serial Number........: 89BY05MBQ -------------------------------------------- extracting android-info.txt (0 MB) to RAM... Checking 'product' OKAY [ 0.001s] Setting current slot to 'b' OKAY [ 0.035s] extracting boot.img (64 MB) to disk... took 0.317s archive does not contain 'boot.sig' Sending 'boot_b' (65536 KB) OKAY [ 2.063s] Writing 'boot_b' OKAY [ 0.393s] extracting dtbo.img (8 MB) to disk... took 0.048s archive does not contain 'dtbo.sig' Sending 'dtbo_b' (8192 KB) OKAY [ 0.257s] Writing 'dtbo_b' OKAY [ 0.066s] archive does not contain 'dt.img' archive does not contain 'recovery.img' extracting vbmeta.img (0 MB) to disk... took 0.004s archive does not contain 'vbmeta.sig' Sending 'vbmeta_b' (8 KB) OKAY [ 0.001s] Writing 'vbmeta_b' OKAY [ 0.003s] archive does not contain 'vbmeta_system.img' archive does not contain 'vendor_boot.img' extracting super_empty.img (0 MB) to disk... took 0.004s Sending 'system_b' (4 KB) OKAY [ 0.001s] Updating super partition OKAY [ 0.006s] Resizing 'product_b' OKAY [ 0.006s] Resizing 'system_b' OKAY [ 0.006s] Resizing 'system_ext_b' OKAY [ 0.006s] Resizing 'vendor_b' OKAY [ 0.006s] archive does not contain 'boot_other.img' archive does not contain 'odm.img' extracting product.img (261 MB) to disk... took 2.240s archive does not contain 'product.sig' Resizing 'product_b' OKAY [ 0.006s] Sending sparse 'product_b' 1/2 (262140 KB) OKAY [ 8.237s] Writing 'product_b' OKAY [ 1.592s] Sending sparse 'product_b' 2/2 (6092 KB) OKAY [ 0.210s] Writing 'product_b' OKAY [ 0.086s] extracting system.img (795 MB) to disk... took 6.101s archive does not contain 'system.sig' Resizing 'system_b' OKAY [ 0.006s] Sending sparse 'system_b' 1/4 (262140 KB) OKAY [ 8.247s] Writing 'system_b' OKAY [ 1.634s] Sending sparse 'system_b' 2/4 (262140 KB) OKAY [ 8.788s] Writing 'system_b' OKAY [ 1.685s] Sending sparse 'system_b' 3/4 (262140 KB) OKAY [ 8.642s] Writing 'system_b' OKAY [ 1.632s] Sending sparse 'system_b' 4/4 (27832 KB) OKAY [ 0.935s] Writing 'system_b' OKAY [ 0.199s] extracting system_ext.img (123 MB) to disk... took 0.779s archive does not contain 'system_ext.sig' Resizing 'system_ext_b' OKAY [ 0.004s] Sending 'system_ext_b' (126872 KB) OKAY [ 3.976s] Writing 'system_ext_b' OKAY [ 0.826s] extracting system_other.img (66 MB) to disk... took 0.402s archive does not contain 'system.sig' Sending 'system_a' (68120 KB) OKAY [ 2.129s] Writing 'system_a' OKAY [ 0.410s] extracting vendor.img (461 MB) to disk... took 3.112s archive does not contain 'vendor.sig' Resizing 'vendor_b' OKAY [ 0.006s] Sending sparse 'vendor_b' 1/2 (262140 KB) OKAY [ 8.233s] Writing 'vendor_b' OKAY [ 1.651s] Sending sparse 'vendor_b' 2/2 (210424 KB) OKAY [ 7.042s] Writing 'vendor_b' OKAY [ 1.296s] archive does not contain 'vendor_dlkm.img' archive does not contain 'vendor_other.img' Erasing 'userdata' OKAY [ 5.861s] Erase successful, but not automatically formatting. File system type raw not supported. Erasing 'metadata' OKAY [ 0.111s] Erase successful, but not automatically formatting. File system type raw not supported. Rebooting OKAY [ 0.000s] Finished. Total time: 89.950s PS H:\rom12\aosp12>
After brushing the machine, restart the machine and start working.
Android system development series (1): Android 12 source code download, compilation and brushing