Run compiled android on the simulator

Source: Internet
Author: User
Tags uncompress

7) run the compiled Android SDK on the simulator.

After compiling Android,

Emulator IN ~ /Android/out/host/linux-x86/bin,

Ramdisk. IMG, system. IMG, and userdata. IMG are ~ 1 In/Android/out/target/product/generic
$ Cd ~ /Android/out/host/linux-x86/bin

Add environment variable

1 $ gvim ~ /. Bashrc

Add environment variables in. bashrc as follows:

1 # Some environment variables for Java program development/running

2 Export android_product_out = ~ /Android/out/target/product/generic

3 android_product_out_bin = ~ /Android/out/host/linux-x86/bin

4 Export path =$ {path }:$ {android_product_out_bin }:: {android_product_out };

Finally, synchronize these changes:

1 $ source ~ /. Bashrc

2 $ Cd ~ /Android/out/target/product/generic

3 $ emulator-system. IMG-data userdata. IMG-ramdisk. img

After entering the android desktop, it means the operation is successful.

8) Compilation Module

An application in android can be compiled separately. After compilation, system. IMG must be regenerated.

Run 1 $. Build/envsetup. Sh in the source code directory (. There is a space behind it)

There are more commands:

-Croot: Changes directory to the top of the tree.

-M: makes from the top of the tree.

-Mm: builds all of the modules in the current directory.

-Mmm: builds all of the modules in the supplied directories.

-Cgrep: greps on all local C/C ++ files.

-Jgrep: greps on all local java files.

-Resgrep: greps on all local Res/*. XML files.

-Godir: Go to the directory containing a file.

You can add-help to view usage

We can use Mmm to compile the module of the specified directory, for example, compile the contact: 1 $ Mmm packages/apps/contacts/

Generate two files after editing:

Out/target/product/generic/data/APP/contactstests.apk

Out/target/product/generic/system/APP/contacts.apk

Available

1 $ make Snod

Regenerate system. IMG and then run the simulator.

9) Compile the SDK

Directly executing make does not include the make SDK. Make SDK is used to generate the SDK, so that we can use the SDK synchronized with the source code to develop android.

A)(This step is not required. Check your configuration.) Modify/frameworks/base/include/utils/asset. h.

Change 'uncompress _ data_max = 1*1024*1024 'to 'uncompress _ data_max = 2*1024*1024'

The reason is that the eclipse compilation project requires a buffer greater than 1.3m;

B)Compile ADT.

I did not perform this step;

C)Run make SDK.

Note that the javadoc version needed here is 1.5, so you need to install the sun-java5-jdk1 at the same time in step 1
$ Make SDK

Compilation is slow. The compiled SDK is stored in out/host/linux-x86/SDK/, which has a android-sdk_eng.xxx_linux-x86.zip and a android-sdk_eng.xxx_linux-x86 directory. Android-sdk_eng.xxx_linux-x86 is the SDK directory

In fact, when using the mmm command to compile the module, the same will clear the SDK output file, so it is best to move the android-sdk_eng.xxx_linux-x86 out

This SDK will be used for subsequent application development ~ /. Comment out the changes to bashrc and add the following line:

1 Export path =$ {path }:~ /Android/out/host/linux-x86/sdks/android-sdk_eng.xxx_linux-x86/tools

Replace xxx with a real path;

D)Selection of environment variables and Android tools

Currently, Android tools include:

A. the SDK we downloaded from the Internet, if you have downloaded it (there are many Android tools under tools and IMG images under lib/images)

B. the SDK compiled using make SDK (there are also many Android tools in tools, and IMG images in lib/images)

C. The out directory compiled with make (there are also many Android tools in tools, and IMG images in lib/images)

So what tools should we use and IMG?

First, we generally do not use the option tool and IMG, because it is generally old and the source code is not synchronized. Second, the C option tools and IMG are not used, because these tools and IMG are not classified by the SDK, and tools and configurations cannot be found. In fact, many tools and IMG generated by the make SDK are compiled when make is compiled out of the directory. The make SDK only implements copy.

E)Install and configure ADT

Skipped;

F)Create an android Virtual Device

The compiled SDK does not have AVD (Android Virtual Device). You can use the android tool to view: 1.
$ Android list

Create AVD: 1 $ Android create AVD-T 1-N myavd

You can use Android-help to view the usage of the preceding Command Options. There are some options in the creation, the default is enough

Run the android LIST command to view the location where AVD is stored.

-AVD myavd or @ myavd option will be added for every running of emulator in the future: 1 $ emulator-AVD myavd

10) Compile the Linux kernel Image

A)Prepare the cross-compilation tool chain

The android code tree contains a prebuilt project that contains the cross-compilation tools required for compiling the kernel.

B)Set the environment variable 1 $ gvim ~ /. Bashrc

Add the following two rows:

1 Export Path = $ path :~ /Android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

2 Export arch = arm

Save and synchronize changes: 1 $ source ~ /. Bashrc

C)Obtain the appropriate kernel source code 1 $ Cd ~ /Android

Obtain the kernel source code repository

1 $ git clone git: // android.git.kernel.org/kernel/common.git Kernel

2 $ CD Kernel

3 $ git Branch

Display

* Android-2.6.27:

It means that you are now in the branch Android-2.6.27, which is also the default main branch of kernel/common. Git.

Show all head branches: 1 $ git branch-

Display

* Android-2.6.27:

Remotes/ORIGIN/head-> origin/Android-2.6.27

Remotes/ORIGIN/Android-2.6.25

Remotes/ORIGIN/Android-2.6.27

Remotes/ORIGIN/Android-2.6.29

Remotes/ORIGIN/Android-goldfsh-2.6.27

Remotes/ORIGIN/Android-goldfsh-2.6.29

We select the latest Android-goldfish-2.6.29, where goldfish is the CPU simulated by the android simulator.

1 $ git checkout-B Android-goldfish-2.6.29 origin/Android-goldfish-2.6.29

2 $ git Branch

Display

Android 2.6.27

* Android-goldfish-2.6.29

We have already worked on the Android-goldfish-2.6.29 branch.

D)Set cross-compilation Parameters

Open the MAKEFILE file in the kernel directory and point cross_compile to the arm-Eabi compiler in the prebuilt you just downloaded.

Cross_compile? = Arm-Eabi-

Set

1 ldflags_build_id = $ (patsubst-wl $ (comma) %, % ,/

2 $ (call LD-option,-wl $ (comma)-Build-ID ,))

Comment out this line and add an empty ldflags_build_id definition, as follows: 1 ldflags_build_id =

E)Compile the kernel Image

1 $ Cd ~ /Android/kernel

2 $ make goldfish_defconfig

3 $ make

F)Test the generated kernel image 1 $ emulator-AVD myavd-kernel ~ /Android/kernel/ARCH/ARM/boot/zimage

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