Android system porting and Platform development (i)Category: Android transplant 2012-09-05 14:16 16173 people read review (a) collection report Androidgitgooglejdkubuntu
Directory (?) [+]
+-------------------------------------------------+
+ This series is serialized, will be updated on a regular basis +
+-------------------------------------------------+
First, the Android4.0 system download and compile
Download and compile the Android system, Google's official website has given detailed instructions, please refer to the official Android website:
Http://source.android.com/source/index.html
The content is mainly divided into:
1. Preparing the Android download and compilation environment
2. Download the source code
3. Compiling source code and kernel source code
Let's explain the steps and precautions in turn.
1. Preparing the Android download and compilation environment
Android Source compiled Google only gives the Unix-like system, exactly the Ubuntu and MacOS on the detailed process, we only describe the compilation process on Ubuntu.
1.1 Hardware environment:
L fast enough PC, if conditional, preferably use physical pc
Memory minimum 1G, HDD minimum 30GB
Note: Virtual machine software such as VMware or VirtualBox can also be used, but the compilation speed is too slow, as for memory, if it is less than 1G, errors may occur when compiling the system.
1.2 Software Environment
We use Ubuntu12.04 as a compiled host system (officially not recommended for the Ubuntu12.04 version), because the Android system code is mostly written in the Java language, it is necessary to install the JDK, however, different versions of the JDK version has different requirements:
L in Gingerbread (2.3.x) and later versions, use JDK6.0, and compile with 64-bit system
L In previous versions of Gingerbread (2.3.x), using JDK5.0, and can be compiled on 32-bit systems
Note: Of course, we compile the 32-bit system by modifying some of the configuration files, but we cannot guarantee that the compiled system will not have any problems in the future.
JDK6.0 recommends downloading directly from the Sun Company's website:
http://java.sun.com/javase/downloads/
To install a package that is dependent on compilation:
[Plain]View Plaincopy
- $ sudo apt-get install Git-core GnuPG Flex Bison gperf build-essential \
- Zip curl Libc6-dev libncurses5-dev:i386 x11proto-core-dev \
- libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
- Libgl1-mesa-dev g++-multilib mingw32 tofrodos \
- Python-markdown libxml2-utils Xsltproc zlib1g-dev:i386
Execute the following command:
[Plain]View Plaincopy
- $ sudo ln-s/usr/lib/i386-linux-gnu/mesa/libgl.so.1/usr/lib/i386-linux-gnu/libgl.so
2. Download Android4.0 and Goldfish source 2.1 download and initialize the Repo tool
Execute the following command in turn:
[Plain]View Plaincopy
- $ mkdir ~/bin
- $ Path=~/bin: $PATH
Download the repo tool by using the Curl command:
[Plain]View Plaincopy
- $ Curl Https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Add the Execute permission to the Repo tool:
[Plain]View Plaincopy
- $ chmod a+x ~/bin/repo
To create our source directory:
[Plain]View Plaincopy
- $ mkdir working_directory
- $ CD Working_directory
Initialize the repo tool and prepare to access the Google Source repository:
[Plain]View Plaincopy
- $ repo init-u https://android.googlesource.com/platform/manifest-b ANDROID-4.0.1_R1
Sometimes using the above command can not connect to the Android server, we can use the following command to connect:
[Plain]View Plaincopy
- $ repo init-u https://android.googlesource.com/a/platform/manifest-b ANDROID-4.0.1_R1
This time, to ensure that your Ubuntu Internet access and normal connection to the Android server, after the initialization of the repo tool, will let you enter the Gmail mailbox and user name verification.
2.2 Download Android source code
Start downloading the Android source code by executing the following command:
[Plain]View Plaincopy
- $repo Sync
If your PC is strong enough, you can add –jn,n to the command to indicate that multiple threads are downloading at the same time, which can increase the download speed.
Then is the long wait, the source of Android4.0.1 is about 6GB, usually one or two nights of time.
Sometimes, the network may be broken, we can use the following script to download, when the connection error, will be automatically downloaded.
[Plain]View Plaincopy
- #!/bin/bash
- Path=~/bin: $PATH
- Repo Init-u https://android.googlesource.com/a/platform/manifest-b ANDROID-4.0.1_R1
- Repo Sync
- While [$?! = 0]; Do
- echo "**error:sync failed, Re-sync again"
- Sleep 5
- Repo Sync
- Done
2.3 Other source of source download
The download step described earlier is Google releasing an official version of the Android code, which is usually only the simulator and some of the Google has a partnership with the source of equipment, If you want to compile a target device Android4.0.1 system, we must customize it, but there are some well-known equipment manufacturers or third-party vendors, but also open source for their own devices, Android systems, such as: Samsung, Qualcomm, etc., more professional, the URL is as follows:
www.linaro.org
Linaro website is mainly arm chip's newest Android solution, such as: Based on the Samsung Orion chip Origen Development Board, based on TI's OMAP system chip PandaBoard Board, based on Nova A9500 ARM dual-core cortex A9 of the Snowball Development Board and so on.
If you download the source code from the above website, follow the instructions of the above website.
2.4 Download simulator Goldfish kernel source
While developing Android, Google has developed a simulator for each version using QEMU, which greatly reduces developer costs and facilitates the promotion of Android technology. QEMU is an open source analog processor software, and Google uses QEMU to simulate the Arm926ej-s goldfish processor, if the developer in the absence of the target Development Board, to operate the hardware, it is necessary to operate the android underlying driver, We can use the simulator's kernel source code.
Ø Download Goldfish Kernel source code
First go to the Android source directory, create the source directory kernel:
[Plain]View Plaincopy
- $ CD Working_directory
- $ mkdir Kernel
Download the source code from the Android remote source repository:
[Plain]View Plaincopy
- $git Clone Http://android.googlesource.com/kernel/goldfish.git
Of course, if you want to compile the kernel of the target platform, you can also download it from the designated repository, and the kernel of the following processors are given:
[Plain]View Plaincopy
- $ git clone https://android.googlesource.com/kernel/common.git
- $ git clone https://android.googlesource.com/kernel/exynos.git
- $ git clone https://android.googlesource.com/kernel/goldfish.git
- $ git clone https://android.googlesource.com/kernel/msm.git
- $ git clone https://android.googlesource.com/kernel/omap.git
- $ git clone https://android.googlesource.com/kernel/samsung.git
- $ git clone https://android.googlesource.com/kernel/tegra.git
After about 10 minutes, the download is finished, as shown in:
In the kernel directory, generate a goldfish directory that goes into the directory:
[Plain]View Plaincopy
- $ CD Goldfish
- $ ls-al
View the current directory with the Ls–al command to see the hidden. Git.
Using Git branch–a to view the branch:
[Plain]View Plaincopy
- $ git branch-a
Use git checkout to get the source code:
[Plain]View Plaincopy
- $ git checkout remotes/origin/android-goldfish-2.6.29
As shown, the directory structure of the Linux kernel source code appears in the current directory:
Android system porting and Platform development (i)