The compilation environment is Ubuntu12.04. Phone Nexus 5, compile the Android 6.0.1 source code and burn it to the real machine.
The source is the image of Hkust: http://mirrors.ustc.edu.cn/aosp-monthly/, after the download there will be a Aosp-latest.tar file, and then create a new warehouse, unzip it into your warehouse. It will take some time to download here.
Then repo init-u Git://mirrors.ustc.edu.cn/aosp/platform/manifest-b your version, such as now we compile 6.0.1 version, directly repo Init-u git:// Mirrors.ustc.edu.cn/aosp/platform/manifest-b ANDROID-6.0.1_R1
After that, execute repo sync, update your code in sync, and it will take some time.
Note: Some people here have to install repo if they use repo for the first time. Then you can use
After the repo sync is finished, a lot of files will appear in your warehouse. For example, there is no out-of-build at the beginning of the first compilation.
Because also to brush into the real machine, so we also need to drive, you can see what you use the model, and then go to the official website to find the corresponding driver,
Drive URL https://developers.google.com/android/nexus/drivers#hammerheadmra58k
I use here is NEXUS5, so I made a, if the official website can not enter, I here have a NEXUS5 driver, Link: Https://pan.baidu.com/s/1kx4J8pf2CV3yH54tgwEXUA Password: s9n6
There are three. sh files, put them in your project's root directory, and then execute the. sh file, after execution, it will have a description, always press ENTER, it is important to note that at the end of the execution of each file, it will prompt you to enter I ACCEPT. After the input is finished, the vendor file is generated in the current directory.
When everything is ready, the next step is to start compiling the source code.
SOURCE build/envsetup.sh
To execute the lunch command, select the version of the phone you want to compile, I am here Nexus 5 Select Hammerhead. As shown
After the selection is complete, then execute the following make clobber to clear the useless compilation.
Then perform prebuilts/misc/linux-x86/ccache/ccache-m 50G to set the cache size.
This is usually determined by the core of your machine Cup: core*2, which is twice times the core of the current CPU.
View number of cores
grep ' core ID '/proc/cpuinfo | Sort-u | Wc-l
To view the number of threads
grep ' Processor '/proc/cpuinfo | Sort-u | Wc-l
For example, my current notebook is a dual core four thread, so according to the formula, the fastest compilation can be make-j8.
And then just wait for the compilation.
PS: During compilation it is possible to encounter the following failures:
Out/host/linux-x86/bin/jack-admin: line 37:setting_version: for bound variable
Make: * * [Out/host/linux-x86/framework/jack.jar] Error 1
Make: * * * Deleting file "Out/host/linux-x86/framework/jack.jar"
How to modify: Setting add setting_version=2 inside./prebuilts/sdk/tools/jack-admin
Change "Setting_version-lt 2" to "Setting_version-eq 2". and then recompile.
Compiled for about 2 hours, the compilation was successful. The resulting image file is under the out/target/product/file.
This time can be burned to the real machine. Turn the debug mode on and then connect the USB Debug.
Enter a command prompt: adb reboot bootloader.
Then the phone screen shows waiting for the bootloader interface to appear on the screen: fastboot OEM unlock
Next, a unlock bootloader selection confirmation page appears. Use the volume to select "YES," and use the Power key to determine.
All the data on your phone will be erased and LOCK state will become unlocked. Should not exceed two minutes.
After the re-boot of the screen there is an open lock, after the brush will be in the unlocked state.
Then go to the directory you just had, with an. img image file. Swipe in by FastBoot, first you see if your fastboot can identify the device, input fastboot devices
If no permissions fastboot appears, go directly to Out/host/linux-x86/bin and enter the following command:
sudo chown root:root fastboot
sudo chmod +s fastboot
And then re-see if the device can be identified, input fastboot devices
If it is identified, then enter into the image file img that file inside to execute the following command to burn.
FastBoot Flash Boot boot.img
FastBoot Flash Cache Cache.img
FastBoot Flash Recovery recovery.img
FastBoot Flash System system.img
FastBoot Flash UserData userdata.img
FastBoot reboot
The last command is to restart the command, wait about two minutes, it will appear
At this point, the source code to compile the real machine completed.
Android6.0 source Download the compiler brush into the real machine