Current location - Quotes Website - Personality signature - Introduction of Android learning construction environment
Introduction of Android learning construction environment
Here, I will skip the elaboration of the file system framework of android on mobile phones (Google or Baidu can help you find the corresponding information), mainly to see how Google integrates the work of generating suitable rootfs into its construction system, and at the same time, I will take a look at the construction mechanism corresponding to various models in CyanogenMod.

First of all, let's take a look at the compilation options and related tools used by Android's build system.

The specific directory is located at: mydroid/build/tools/

|-ACP Group

This is a slightly improved cp command, which is used to deal with the defects of cp command under windows/MAC/Linux. The readme is worth a look!

|-Asian Development Bank

This is a tool to view crash problems. See the Android debugging tool adbs for details.

| - Android.mk

| - apicheck

Used to check the API before release (see mydroid/build/core/tasks/apicheck.mk) to see if there are any APIs that undermine API compatibility or are illegal in the newly compiled system.

The code here is an xml file written in Java (in mydroid/framework/base/api/) to check the api information generated at compile time. You can refer to the code that parses xml files.

|-transcendental

Tools for pre-linking. See (mydroid/bionic/linker/readme.txt) for a brief introduction.

|-A tree

A tool of android SDK service, which is used to perform some file operations according to the contents of the specified xxx.atree file.

| - bin2asm

I don't quite understand the specific purpose. It should be used to deal with some gcc-related problems of compiling android on mac.

| - buildinfo.sh

Generate various xxx.prop files in the target, such as system.prop, build.prop, etc.

| - check_builds.sh

Diff is wrapped to see the changes between the two versions.

|-Check prerequisites

One of the tools for ota upgrade on devices.

| - compare_fileslist.py

Script to complete version comparison using check_builds.sh

| - droiddoc

Android has some javadoc porting.

|-Dump-Package-Statistics

Just look at the size information of dex and other files in jar/apk file.

|-Event log label. py

Handles the contents of the event log label. For the meaning of the event log tag file, please refer to what is the event log tag for Android learning?

| - fileslist.py

Simplify the script that lists all files and sizes in the specified directory-you can use it in your own tool library:)

| - findleaves.py

Find the script (s) of the specified file in the specified directory-you can put it into your own tool library for use:)

| - fixlinebreaks.sh

Change the line break in windows to Linux-you can put it in your own tool library:)

|-File System Configuration

Lists the permissions for the specified folders and files.

|-File System Get Status

Get simple statistics of files in the specified folder.

|-Myself

Determine whether the file is in ELF format.

| - isprelinked

Judge whether the file is pre-linked.

| - java-event-log-tags.py

Handles the contents of the event log label. For the meaning of the event log tag file, please refer to what is the event log tag for Android learning?

| - kcm

For key character mapping tools, please refer to:

|-Ecstasy

! ! ! ! ! !

|-Merge-Event-Log-Label.py

Handles the contents of the event log label. For the meaning of the event log tag file, please refer to what is the event log tag for Android learning?

| - mktarball.sh

Packaging tool executed with fs_get_stats.

|-print _ module _ license.sh

Displays all module information in the current directory.

|-Publishing tool

-Check the target file signature

| - common.py

|-Enlightenment _ Generator. py

|-img from the target file

|-OTA _ From _ Destination _ File

`-signature _ target _ file _apks

| - rgb2565

Rgb conversion tool

| - signapk

Jar package signing tool under command line

|-Soslin

One of the customized compilation tools for Android. See (mydroid/bionic/linker/readme.txt) for a brief introduction.

| - warn.py

Tools for parsing Android system compilation logs

`- zipalign

For the alignment tool of Zipfile, please refer to README. TXT is placed under this folder.

#p# Subtitle #e#

Let's take a look at some common XXX.mk files defined in the Android compiler system.

mydroid/build/core/

| - armelflib.x

| - armelf.x

| - armelf.xsc

| - base_rules.mk

| - binary.mk

| - build_id.mk

|-build-system.html

|-Check the tree

| - cleanbuild.mk

| - cleanspec.mk

| - clear_vars.mk

|-Combination

| - config.mk

| - copy_headers.mk

| - definitions.mk

| - device.mk

| - dex_preopt.mk

| - distdir.mk

| - droiddoc.mk

| - dumpvar.mk

| - dynamic_binary.mk

| - envsetup.mk

| - executable.mk

|-Filter _ symbol. sh

| - find-jdk-tools-jar.sh

| - help.mk

| - host_executable.mk

| - host_java_library.mk

|-Host _ Local _ Test.mk

|-host _ pre build . MK

|-Host Shared Library. mk

|-Host static library. mk

| - java_library.mk

| - java.mk

|-legacy _ pre builds . MK

| - main.mk

| - Makefile

|-multi _ pre build . MK

| - native_test.mk

| - node_fns.mk

| - notice_files.mk

| - package.mk

| - pathmap.mk | - phony_package.mk

|-pre build . MK

|-process wrapper gdb.cmds

| - process_wrapper_gdb.sh

|-Process Wrapper. sh

|-product configuration. mk

| - product.mk

| - proguard.flags

| - proguard_tests.flags

| - raw_executable.mk

| - raw_static_library.mk

| - root.mk

| - shared_library.mk

| - static_java_library.mk

| - static_library.mk

|-Task

| - user_tags.mk

`- version_defaults.mk

#p# Subtitle #e#

Here, the directory has some special tasks in mydroid/build/core/tasks/

|-apicheck.mk, to determine whether the api conforms to the specifications of AOSP.

|-cts.mk cts test, you can execute the cts command in the code root directory, so that cts can be compiled and input out/host/linux-x86/bin/.

|-ide.mkide development environment

|-product drawing. mk

`- sdk-addon.mk

The build environment of NDK is not included in the /build/ directory labeled Rare AOSP.

But under mydroid/ndk/build.

$ cd ndk/build/tools

$ export ANDROID _ NDK _ ROOT = aosp-ROOT/ndk

$ ./make-release-help

Some hints

How to display all xxx.mk files included in each compilation?

Find build/core/main.mk.

Replace include $(subdir_makefiles) with

[plain] View plain copy $ (foreach subdir _ makefile, $(subdir_makefiles),

$ (including the information of $(subdir_makefile))

$(eval include $(subdir_makefile)))

subdir_makefile :=

If you encounter API-related packaging/checking API-current-timestamp] error 38.

Need to perform: update api

How to compile outside the AOSP code directory

[plain] View the plaincopy # path and settings.

Target product = generic

ANDROID _ ROOT =/home/Karim/ANDROID/aosp-2.3 . x

Bionic _ LIBC = $(ANDROID _ ROOT)/ bionic /libc

Product _ Output = $(ANDROID _ ROOT)/ Output/Target/Product/$ (Target _ Product)

Cross-compilation =

$(ANDROID _ ROOT)/ pre-build/Linux-x86/Toolchain/arm-eabi-4.4.3/bin/arm-eabi-

# Tool name

AS = $(CROSS_COMPILE)as

AR = $(CROSS_COMPILE)ar

CC = $ (cross-compilation) gcc

CPP = $(CC) -E

LD = $ (cross-compilation) LD

NM = $ (cross-compilation) nm

OBJCOPY = $(CROSS _ COMPILE)OBJCOPY

OBJDUMP = $(CROSS _ COMPILE)OBJDUMP

RANLIB = $(CROSS_COMPILE)ranlib

READELF = $(CROSS _ COMPILE)READELF

SIZE = $(CROSS_COMPILE) size

STRINGS = $(CROSS_COMPILE) string

STRIP = $(CROSS_COMPILE)strip

Export as ar cc CPPLD nm obj copy obj dump ranlib readelf

Size string band

# Build Settings

CFLAGS =-O2-Wall-fno-short-enum

HEADER_OPS = -I$ (bionic _ LIBC)/ arch arm/inclusion

-I$ (bionic _ LIBC)/ kernel/universal

-I$ (bionic _ LIBC)/ core/arch arm

LDFLAGS = -nostdlib -Wl,-dynamic-linker,/system/bin/linker

$(PRODUCT _ OUT)/obj/lib/CRT begin _ dynamic . o

$(PRODUCT _ OUT)/obj/lib/Cr tend _ Android . o

-L $(PRODUCT _ OUT)/obj/lib-LC-LDL

# Install variables

EXEC_NAME = Example-Application

Install = install

INSTALL _ DIR = $(PRODUCT _ OUT)/system/bin

Number of files required to build

OBJS = example -app.o

# Make rules

All: Example-Application

c.o:

$(CC)$(CFLAGS)$(HEADER _ OPS)-c { 1 } lt;

Example-Application: ${OBJS}

$(CC)-o $(EXEC _ NAME)$ { OBJS } $(LD flags)

Installation: Example-Application

Test -d $ (installation directory) | $ (installation) -d -m 755 $ (installation directory)

$ (installation) -m 755 $ (execution name) $ (installation directory)

Cleaning:

rm -f *。 O $ (executive name) core

distclean:

rm -f *~

rm -f *。 O $ (executive name) core

How to add a new device

[plain] view plain copy $ CD ~/Android/aosp-2.3.x

$ .build/envsetup.sh

$ mkdir -p device /acme/coyotepad

$ cd device /acme/coyotepad

Go to AndroidProducts.mk

PRODUCT_MAKEFILES :=

$(LOCAL_DIR)/full_coyotepad.mk

For full_coyotepad.mk

$ (call inherit-product, $ (src _ target _ dir)/product/languages _ full.mk)

$ (call inherit-product, $ (src _ target _ dir)/product/full.mk)

DEVICE_PACKAGE_OVERLAYS :=

Product package+=

Product copy file+=

PRODUCT_NAME := full_coyotepad

Product _ equipment: = coyotepad

Product _ model: = complete Android on coyotepad, meep-meep.

In BoardConfig.mk

Target _ None _ Kernel: = True

TARGET_NO_BOOTLOADER := true

Target _CPU_ABI := armeabi

BOARD_USES_GENERIC_AUDIO := true

Use _ Camera _ Stub: = True

Open vendorsetup.sh

add _ lunch _ combo full _ coyote pad-eng

#p# Subtitle #e#