Cm7 download and compilation reference

Source: Internet
Author: User

Http://wiki.cyanogenmod.com/wiki/HTC_Evo_4G:_Compile_CyanogenMod_%28Linux%29

Http://wiki.cyanogenmod.com/wiki/Building_from_source

Http://source.android.com/source/initializing.html

Reference http://www.hiapk.com/thread-2158774-1-1.html

Add an article http://blog.csdn.net/zhudongya/article/details/6899070

Build the compiling environment
JDK Installation
A) JDK is a required software package for Ubuntu to use the android SDK and compile the source code.
B) download the latest JDK version from Sun's official website. BIN file, the author downloaded is the jdk-6u20-linux-i586.bin (according to different files, the command will also be changed, we should pay attention to when using, mainly the file name and path changes ).
C) Because JDK will be installed in the current directory during runtime, before installation, move it to the directory you want to install, for example, I installed it in the/usr/lib/JVM/Java directory. If you want to install it in the same directory, follow the commands below to do it.
Code:
Sudo-I
CD/usr/lib
Mkdir JVM
CD JVM
Mkdir Java
CD Java
CP "jdk-6u20-linux-i586.bin Directory"/jdk-6u20-linux-i586.bin/usr/lib/JVM/Java
Chmod U + x jdk-6u20-linux-i586.bin
Jdk-6u20-linux-i586.bin
In this case, the JDK installation prompt is displayed. Press enter to keep the prompt, and the prompt will continue to scroll. www.linuxidc.com will start installation after you enter yes/no on the screen, after the installation is complete, the system prompts you to press enter to continue. After you press enter, the installation is successful.
D) Unlike windows, UBUNTU does not have a registry. After the installation is complete, we need to inform the System of the JDK installation directory, therefore, execute the following command in the terminal just now (if it is a new terminal that has not executed "Sudo-I", you need to get the permission before the command + "sudo)
Code:
Gedit/etc/environment
A text editor is displayed.
Code:
Path = "......"
The ellipsis is the default path. Here, we do not need to change it. We need to modify it, write the JDK installation path, and tell the system where our JDK is installed, make the following changes:
I. Original Path = "......" Add:
Code:
Path = "...... :/Usr/lib/JVM/Java/jdk1.6.0 _ 20/bin"
Ii. Add two rows and enter the following content:
Code:
Classpath =.:/usr/lib/JVM/Java/jdk1.6.0 _ 20/lib
Java_home =/usr/lib/JVM/Java/jdk1.6.0 _ 20
The final form is as follows:
Code:
Path = "...... :/Usr/lib/JVM/Java/jdk1.6.0 _ 20/bin"
Classpath =.:/usr/lib/JVM/Java/jdk1.6.0 _ 20/lib
Java_home =/usr/lib/JVM/Java/jdk1.6.0 _ 20
The ellipsis is the original content of the file. We Add a new part of content and two new lines. Save the modification and exit.
E) Ubuntu may come with JDK or Install Multiple JDK. In this case, we need to set this to the default one.
I. First, add the JDK installation directory to the JDK selection menu and execute the following code:
Code:
Update-alternatives-install/usr/bin/Java/usr/lib/JVM/Java/jdk1.6.0 _ 12/bin/Java 300
Update-alternatives-install/usr/bin/javac/usr/lib/JVM/Java/jdk1.6.0 _ 12/bin/javac 300
Ii. Second, use the command to select the default JDK and execute the following code:
Code:
Update-alternatives-config Java
Iii. Finally, check the current JDK version of the system and enter the following code to view it:
Code:
Java-version
F) So far, JDK is installed successfully.
Android SDK Installation
A) Since Rom is used, debugging and testing tools are required. The official Android SDK also provides an official version. You can download and install it directly.
B) go to Google's official website to download the latest SDK version. Just a few days ago, we launched R6 that supports 2.2. However, after the official website of the SDK is on the wall, we can only download the SDK from FQ, this is helpless. Windows, Mac OS X, and Linux are officially available. We need to download the Linux version.
C) You can directly decompress the SDK without installing it. It is recommended to put it in the main directory for convenient calling.
D) to facilitate the use of the ADB command, we also need to add the directory where the ADB command is located to the system environment variable so that ADB can be directly called under any directory, you do not need to add CD to the SDK directory. This is more convenient. The implementation method is as follows:
Code:
Sudo gedit ~ /. Bashrc
Open the. bashrc file in a text editor and add the following line at the end:
Code:
Export path =$ {path }:< your SDK directory>/tools
Here, you need to add the installation directory of your SDK and save it.
E) connect the mobile phone to USB and enter:
Code:
ADB Devices
All Android devices connected to the computer are listed. If a serial number of numbers and letters is displayed, the SDK is successfully installed.

Software Installation
A) The configuration source, update source, and other issues will not be mentioned. Let's talk about the software we need directly, from synchronizing the source code to compiling Rom, we need to use the following software in total, some software may have been automatically installed during our update process, but this does not affect our work. I listed all the programs we need:
? Git-core
? GnuPG
? Flex
? Bison

? Gperf

 

? Libsdl-Dev
? Libesd0-dev
? Libwxgtk2.6-Dev
? Build-essential
? Zip
? Curl
? Libncurses5-dev
? Zlib1g-dev
? Valgrind
? Libreadline5-dev
B) All the above programs are installed using the apt-GET command. For example, to install the git-core software, run the following command:
Code:
Sudo apt-Get install Git-core
C) the installation process of other software is similar. Replace the final software name.
D) after installing all the software, all the environments required for cyanogenmod compilation are completed.

Source Code Synchronization
Repo Installation
A) The Source Code address of cyanogenmod is http://github.com/cyanogen/android. you can download the source code through download source in the upper right corner of the network. However, we do not recommend this method for download because the source code changes frequently. Once the source code changes, we need to download the complete source code package again, which is time-consuming, laborious, and inefficient, therefore, we recommend that you use the repo synchronization method. During the synchronization process, only the changed part of the source code is synchronized, which is more efficient.
B) repo Installation
I. repo is easy to install. You need to download a file, set it to executable permissions, and add it to the system environment. The specific command is as follows:
Code:
Cd ~
Mkdir Bin
Create a folder named bin in your home root directory.
Code:
Sudo gedit ~. /Bashrc
Open your environment variable configuration file and add the following line at the end:
Code:
Export Path = $ path :~ /Bin
Save the file and exit. Close the terminal and open a terminal again. Run the following command to verify whether the path is successfully added to the environment variable:
Code:
Echo $ path
After confirmation, install repo and run the following command:
Code:
Curl http://Android.git.kernel.org/repo> ~ /Bin/Repo
Chmod A + x ~ /Bin/Repo
Use the curl command to download the repo to the bin and modify its permissions to an executable file. Now the repo installation is complete.
Repo configuration and Synchronization
I. Create a folder in the main directory to store the source code.
Code:
Cd ~
Mkdir cyanogenmod
CD cyanogenmod
Ii. Run the repo command in the cyanogenmod directory to set the source code to be synchronized:
Code:
Repo init-u git: // github.com/cyanogen/android.git-B eclair
The URL is the address of cyanogenmod.-B indicates that we select the branch to be synchronized. cyanogenmod has many branches, such as dount and eclair. froyo will be available in the future. Currently, we need to compile the code 2.1, -B eclair is used to select the branch of eclair 2.1.
Iii. During the configuration process, you will be asked to select the name and email address, which will be displayed in the basic information of the RoM you finally compiled. You can choose the one you like to write.
Iv. After the configuration is complete, you can start synchronizing the source code:
Code:
Repo sync
The synchronization process will take a long time. We recommend that you start synchronization before going to bed at night. Generally, you can get up in the morning.
Compiling environment settings
Build a compilation environment
A) After synchronizing the source code, you must first establish a compilation environment. CM source code writes these commands into scripts. You only need to run the corresponding scripts. First, first CD to the source code root directory, and then execute the following command:
Code:
./Build/envsetup. Sh
After execution, the screen displays:
Code:
Including vendor/cyanogen/vendorsetup. Sh
At this time, the compiling environment is set successfully.

Exclusive file Extraction
A) although the Android system is open-source, some of dream's exclusive files are not open-source, so they are not included in the source code tree. But if you want the Rom to run on the dream real machine and need these files, you need to extract these files. In cm, this operation is relatively simple, steve has prepared a script for us.
B) first, make sure that all the above software is installed successfully, and then connect dream to your computer through USB.
C) CD to the/vendor/HTC/dream_sapphire directory of the source code, and then execute the script:

Code:
/Extract-files.sh
D) this operation will call the ADB command, from the exclusive files required by pull on your phone to the vendor directory.
Modify the compilation File
A) The default compilation process contains all the languages and programs, but we don't need them. You can define the language and software to be output by modifying the compilation file.
B) Open the cyanogen. mk file in the/vendor/cyanogen/products Directory, which defines the software and language to be output. You can directly Delete unnecessary software. But it is not recommended to modify it here. You can delete unnecessary files from the final output directory, and change them here to be error-prone.
C) At the end of the file, there is a line "product_locales", which contains the language types supported by Rom. By default, there are dozens of languages. After compilation, the software will be relatively large, generally, we only need to retain the commonly used languages. I chose to retain the three languages en_us, zh_cn and zh_tw, And the compiled software is much smaller.
Kernel Compilation
1. kernel is the core of Android and the most important part. Although the compiled kernel is included in the CM source code, since it is self-compiled, you must change the kernel information, for example, the name of the kernel, such as the BFS patch and overclocking Patch, you need to compile the kernel on your own.
2. it is also very easy to compile the kernel. First, you need a Kernel configuration file. The cm provides a ready-to-use file, which can be found directly in the/kernel-MSM/ARCH/ARM/configs directory, there is a configuration file named cyanogen_msm_defconfig, which is the quota file we need (If You Want To compile kernel for nexus, You need to select cyanogen_mahimahi_defconfig ). Copy it to the root directory of/kernel-MSM and rename it to. config.
3. open in a text editor. config. One of the parameters is config_localversion = "-cyanogenmod", which is the name displayed after the kernel is compiled. You can change cyanogenmod to any name you like.
4. After the settings are complete, you can start compiling. First CD to the/kernel-MSM directory, and then execute the following command
Code:
Export arch = arm
Export cross_compile = arm-Eabi-
Export Path = $ path :~ /Cyanogenmod/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin
These commands define the environment and settings required for compiling the kernel. Note that when the third command is entered, the path must be consistent with the path where the source code is actually placed. In addition, you must re-enter the three commands before each kernel compilation.
5. After Entering the command, you can start make:
Code:
Make-J3
Make is the command to start compilation. The following parameter-J3 indicates the number of CPU Cores Used for compilation. Generally, it is the number of CPU cores plus 1. For example, the dual-core CPU uses the-J3 parameter.
6. The compilation process varies according to the configuration. The t6400 used in my notebook is dual-core 2 GB, and the kernel Compilation Time is generally within 10 minutes. The compiled kernel is generated in the/kernel-MSM/ARCH/ARM/boot/directory named zimage.
Cyanogenmod Compilation
1. After compiling the kernel, you can start to compile the main course cm. Before compilation, you must generate a buildspec. mk file to define the basic information of the RoM to be compiled. First CD to the source code root directory, create an empty file named buildspec. mk, and open it with notepad. Enter the following information:
Code:
Target_product: = cyanogen_dream_sapphire
Target_build_variant: = ENG
Target_build_type: = release
Target_prebuilt_kernel: = kernel/ARCH/ARM/boot/zimage
A) The first command indicates the Rom to be compiled. We are compiling the G1 Rom, so cyanogen_dream_sapphire is selected;
B) The second command indicates the type of the compiled Rom. Two types are available: ENG and userdebug. Of course, Eng is selected;
C) The third command indicates the type of the compiled Rom. Select release.
D) The fourth command indicates which kernel is used to compile the Rom. If this command is not set, it will be compiled based on the built-in kernel. Since we have compiled the kernel ourselves, of course, we use our own, so we have set the compiled kernel directory for the make process to call.
2. After the buildspec. mk file is created, you can start to compile the Rom, CD to the source code root directory, and then run the command:
Code:
Make-J3
Start to compile the source code. The compilation process of the source code will be long. The trial configuration is different and the time required is different. It takes about two hours for the complete cm compilation of the t6400.
3. after compilation, our finished product is in the/out/target/product directory, which contains system. IMG, recovery. IMG, boot. IMG and system folders. Here, friends who have some experience in ROM creation don't need to talk about it. You can directly click system in fastboot. IMG, and boot. IMG; you can also set the system folder and boot. the IMG package into a zip package, add the update script and sign it, and recovery it to the machine. Now we have compiled our own cyanogenmod for HTC Dream.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.