Android 编译摘要

原创 2011年01月14日 14:46:00

> 编译选项的help

liuxu@liuxu:~/workspace/froyo_td$ help
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- 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.

Look at the source to view more functions. The complete list is:
add_lunch_combo cgrep check_product check_variant choosecombo chooseproduct choosetype choosevariant cproj croot findmakefile gdbclient get_abs_build_var getbugreports get_build_var getprebuilt gettop godir help isviewserverstarted jgrep lunch m mm mmm pid printconfig print_lunch_menu resgrep runhat runtest setpaths set_sequence_number set_stuff_for_environment settitle smoketest startviewserver stopviewserver systemstack tapas tracedmdump

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 编译命令

liuxu@liuxu:~/workspace/froyo_td$ . build/envsetup.sh
including device/htc/dream/vendorsetup.sh
including device/htc/passion/vendorsetup.sh
including device/htc/sapphire/vendorsetup.sh
including device/lenovo/rainbow/vendorsetup.sh
liuxu@liuxu:~/workspace/froyo_td$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. generic-eng
     2. simulator
     3. full_dream-userdebug
     4. full_passion-userdebug
     5. full_sapphire-userdebug
     6. rainbow-userdebug

Which would you like? [generic-eng] 6

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2.1
TARGET_PRODUCT=rainbow
TARGET_BUILD_VARIANT=userdebug
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRG83
============================================
liuxu@liuxu:~/workspace/froyo_td$ choosecombo
Build for the simulator or the device?
     1. Device
     2. Simulator

Which would you like? [1]


Build type choices are:
     1. release
     2. debug

Which would you like? [1]


Which product would you like? [rainbow]


Variant choices are:
     1. user
     2. userdebug
     3. eng
Which would you like? [eng] 2

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2.1
TARGET_PRODUCT=rainbow
TARGET_BUILD_VARIANT=userdebug
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRG83
============================================



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Android编译系统

1.            Android编译系统

编译脚本主要位置:

*.mk

build/core/

build/tools/

build/envsetup.sh:定义函数mm,mmm,choosecombo等;
2.            模块编译
2.1       Java模块

通常Java模块的编译提供一个Android.mk就可以了。

LOCAL_PACKAGE_NAME:模块名。

LOCAL_SRC_FILES:代码;
2.2       C/C++模块

通常C/C++模块的编译提供一个Android.mk就可以了。

LOCAL_MODULE:模块名;

LOCAL_SRC_FILES:编译的源文件;

LOCAL_C_INCLUDES:需要包含的头文件目录;

LOCAL_SHARED_LIBRARIES:链接时需要的外部库;

LOCAL_PRELINK_MODULE:是否需要prelink处理;

BUILD_SHARED_LIBRARY:指明要编译成动态库;

LOCAL_PATH:编译时的目录;

http://linux.chinaunix.net/techdoc/beginner/2009/10/25/1141239.shtml

http://heaven.branda.to/~thinker/GinGin_CGI.py/show_id_doc/393
2.3           build/envsetup.sh

定义函数mm,mmm,choosecombo等。
2.4           choosecombo

定义于:build/envsetup.sh。

function choosecombo()

{

    choosesim $1

//选择模拟器类型,echo $TARGET_SIMULATOR,值为   

//     1. Device

//     2. Simulator

    echo

    echo

    choosetype $2

//选择编译类型,echo $TARGET_BUILD_TYPE

//     1. release

//     2. debug

    echo

    echo

    chooseproduct $3

//选择产品类型,echo $TARGET_PRODUCT,如abcde

    echo

    echo

    choosevariant $4

//选择编译变量,echo $TARGET_BUILD_VARIANT

//     1. user

//     2. userdebug

//     3. eng

    echo

    set_stuff_for_environment

    printconfig

}  

综上,choosecombo选择这些命令后,把所有的用户选择信息输出在环境变量之中。所以,如果重新打开shell,需要重新选择,否则原有的配置信息丢失。
2.5           vendor/vendorabc/abcde/BoardConfig.mk

config输出:

system/core/include/arch/linux-arm/AndroidConfig.h
2.5.1      BOARD_HAVE_BLUETOOTH

主要引用处:frameworks/base/libs/audioflinger/。

实验:如何通过设置BOARD_HAVE_BLUETOOTH来避免编译蓝牙。

办法:删除 rm -rf  out/target/product/abcde/obj/STATIC_LIBRARIES/libaudiointerface_intermediates/ -rf

在vendor/vendorabc/abcde/BoardConfig.mk加入BOARD_HAVE_BLUETOOTH := false,才可以让宏BOARD_HAVE_BLUETOOTH生效.
2.5.2      TARGET_CPU_ABI

引用处:build/core/
2.6           build/core/

device.mk

prelink-linux-arm.map
2.7           build/core/Makefile
2.7.1      system.img制作

system.img的制作是由build/core/Makefile的宏build-systemimage-target调用MKYAFFS2来完成的。

命令MKYAFFS2定义于build/core/config.mk:

MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)

图 system.img制作流程
2.7.2      prop设定

 
2.8           build/core/ definitions.mk

transform-java-to-classes.jar

create-resource-java-files

transform-host-o-to-executable-inner

transform-o-to-executable-inner

transform-o-to-shared-lib-inner

transform-host-c-or-s-to-o-no-deps

transform-host-cpp-to-o

transform-cpp-to-o

版权声明:欢迎转载,转载请注明出处

Android通话记录CallLog简单摘要

最近做些和通讯相关的东西,正好梳理下流程,以备不需之用;俗话说得好“好脑子比不了烂笔头”;...

Android--消息摘要MD5,SHA加密

使用场景: 对用户密码进行md5 加密后保存到数据库里软件下载站使用消息摘要计算文件指纹,防止被篡改数字签名百度云,360网盘等云盘的妙传功能用的就是sha1值Eclipse和Android S...

android开发环境配置及helloworld程序(笔记摘要)

1.安装jdk,    安装方法:http://blog.csdn.net/tianhen791/article/details/7211255 2.安装eclipse   下载Eclipse压...

中国Android软件商店摘要(2011-1-21统计)

中国Android软件商店摘要,最新添加“安丰下载”,“XDA市场”,“历趣安卓市场 ”。迈奔灵动(mAPPn) 机...

Android 之 Handler 知识摘要

这里 handler的概念就不做介绍,若还不知道handler是啥的同学请移步。 首先说下handler messager looper之间的关系: looper: 一个线程只有一个looper对...

Java(Android)对文件全文生成MD5摘要

程序出处:http://liuxiang8484.blog.163.com/blog/static/734790972011101093250899/ import java.io.File...

Android 系统广播摘要

//关闭或打开飞行模式时的广播 Intent.ACTION_AIRPLANE_M;//充电状态,或者电池的电量发生变化;//电池的充电状态、电荷级别改变,不能通过组建声; Intent.ACTIO...

Android 学习历程摘要(三)

" 1.proguard混淆:对与Activity等不应进行混淆,否则系统将找不到生命周期函数;JSON字符串要考虑混淆之后是否会影响字段名;native方法也不混淆,否则调用不到 2.ListV...

android 摘要----数据存储全方案,详解持久化技术

数据持久化:         只将那些内存中的瞬时数据保存到存储设备中,保证即使在手机或电脑关机的情况下,这些数据也不会丢失。 1,文件存储:             是android中...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Android 编译摘要
举报原因:
原因补充:

(最多只允许输入30个字)