After a painful struggle, the source code of Android 2.3.1 was finally compiled !!! Here we will introduce the process:
1.
Install the following libraries before compiling:
Sudo apt-Get install bison
Sudo apt-Get install zlib1g-dev
Sudo apt-Get install lib64z1-dev
Sudo apt-Get install flex
Sudo apt-Get install libncurses5-dev
Sudo apt-Get install libx11-dev
Sudo apt-Get install gperf
The above may not be complete. You just need to wait for the library to be missing during compilation and proceed to the next step ~~
2.
Install Java 6 JDK:
Sudo apt-Get install sun-java6-jdk
3.
Download and decompress the source code of Android 2.3.1;
This part needs to be downloaded using git, which is complicated. (I will write another blog post on how to download the source code from git. Here, I will take a place first ).
4.
Make clean(Make before Compilation
Clean will be very convenient !)
If the out folder exists, make clean will be removed.
5.Make
This is a very, very long process (I have Intel dual-core for more than two hours). Wait ~~~~
6.
If it succeeds, an out folder is generated, which contains three folders: Host, target, and temp. The host runs on the PC (such as SDK and emulator), and the target runs on the target board. Target has
System. IMG, userdata. IMG, and ramdisk. IMG files. In addition, there are some folders in this directory, some of which are the same as these three files, but they are not packaged. For a detailed explanation of these three files can refer to the following url: http://pccp.me/archives/39.html speak very detailed (this I also excerpted, You can see http://blog.csdn.net/htttw/article/details/6783604 ).
Finally:
The output of make compilation is included in the following section:
Target System FS image: Out/target/product/sdkdemo/obj/packaging/systemimage_intermediates/system. img
Install system FS image: Out/target/product/sdkdemo/system. img
Target RAM disk: Out/target/product/sdkdemo/ramdisk. img
Target userdata FS image: Out/target/product/sdkdemo/userdata. img
Installed file list: Out/target/product/sdkdemo/installed-files.txt
Next we will start our compiled Android SDK:
(We used to use slave !)
1.
CD out/host/linux-x86/bin/
2.
./Android
The system prompts that android_swt is not set. Add the following environment variables:
Export android_swt =/home/huhuao/android_project/gingerbread/out/host/linux-x86/framework/(Note: This is your own framework path!)
Again./Android, error:
Error: Error parsing the SDK.
Error:/home/huao/android_project/gingerbread/out/host/linux-x86/platforms is missing.
Error: Unable to parse SDK content.
In fact, the solution is very simple, as long as you create a platforms folder in the corresponding path;
Again./Android, error:
Error: Error parsing the SDK.
Error:/home/huao/android_project/gingerbread/out/host/linux-x86/platforms is missing.
Error: Unable to parse SDK content.
The solution is the same as above;
Finally, the android SDK was started!
(The following steps are the same as using the officially downloaded SDK)
3.
Download android
SDK target:
Select available packages in the SDK, select the corresponding Android SDK platform and API, and Click Refresh to download the SDK ~~
4.
Create an AVD (Android virtual
Disk ):
In virtual devices, click "new", fill in the name and target, and then click Create AVD to create an AVD.
5.
Start emulator at the point of start on the main interface. At the beginning, the words of Android are flashing. After a long time, you can see the android interface ~~
Done!