Android Rom development-compile cyanogenmod in Ubuntu to generate the SDK

Source: Internet
Author: User

Because cm2.3.7 has some problems, if you need to use a stable version of cyanogenmod 2.3.4 to compile and download the corresponding vendor file, you can download it to my online disk.


Custom sdks are often added to the source code during development of custom Rom. For example, many added functions in Xiaomi miui use custom methods during coding, these all need to be compiled into the SDK. during development, the developer will also use the self-generated SDK to develop the software and call the newly added method. For example, the android SDK does not contain the hello () method. If you want to make this method effective during software development, you can add this method to the source code to compile and generate the SDK.

This document does not describe how to add modules. This article only describes how to generate the SDK by compiling cyanogenmod, because this step seems to have only one command, but it faces many risks.

First you make sure that you have been able to successfully compile the generated cm brush, if not, by reference:

Of course, the versions of different types of brunch are also different. You need to know the code of your development machine. My development machine Is HTC Desire Z, code: Vision


1. Replace the corresponding folders in the vendor directory, such as vision

This step is mainly used to compile the source code. For details about the compilation process, refer to the previous article.

Some packages, or library files, may be missing directly through the./, for reasons such as version modification. During execution of. Get-rommanager, an error may occur during compilation because the latest information is obtained.

To avoid this, replace the corresponding folder (such as Vision) in the online drive with the vision under your vendor/HTC directory. Because all the files have been tested, the corresponding cm source code


Ii. Back up the userdata. imgfile

Why? If you do not copy the file in advance, you will suffer if you encounter the following errors.

Development/build/SDK. atree: 71: couldn't locate source file: userdata. img

Make: *** [out/host/linux-x86/SDK/] Error 44

After a fl is successfully compiled and generated, the fl include fl is generated under cyanogenmod/out/target/product/vision (a zip package like a cyanogen_vision-ota-eng.loulijun is), system. IMG, userdata. IMG, ramdisk. IMG and other image files, kernel, and other information; such

Note: What you need to do in this step is to back up userdata. IMG or the entire vision (or other names), which will be used later.

A brief introduction to these image files

System. IMG: includes major packages and library files

Userdata. IMG: includes user data and the main user initialization system

Recovery. IMG: the files required for the recovery burning mode, and fastboot for the second burning mode (for example, we need to recovery when refreshing the machine)

Ramdisk. IMG: The file system of the simulator.

Boot. IMG: Compile the kernel image generated by the kernel source code

3. Compile the SDK

Once again, the premise is that you have compiled cyanogenmod (problems may occur if you compile it directly), and you have not made clean (clear data compilation)

$ CD cyanogenmod

$ Make SDK

(The above command will be stuck on the computer if it is the make-J4 SDK, which is very slow)

Then open the out/target/product/vision directory. After a while, you will find that the data in the directory suddenly disappears, and other files are generated at the end, including refreshing. However, this is the userdata. IMG generation is delayed. It doesn't matter. paste the copied userdata. imgfile into Vision (paste it when userdata. IMG disappears ). This problem has plagued me for a long time.

Okay, wait a moment and we will find that our SDK is generated, it is in the out/host/linux-x86/SDK, this is your generated SDK, configure it to environment variables.

The generated directory is as follows:


4. Use the SDK

Replace the original SDK and configure Environment Variables

$ Vim. bashrc

Add or modify to at last, save and exit

Export Path = $ path:/home/loulijun/cyanogenmod/out/host/linux-x86/SDK/android-sdk_eng.loulijun_linux-x86

$ Source. bashrc

Make it take effect

Open Window -- preferences -- Android -- SDK location in eclipse, find the SDK directory, and apply.

Related Article

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: 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.