> 编译选项的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

更多相关文章

  1. Android(安卓)自定义选择器Dialog(单选,时间选择)
  2. 使用“aapt dump”查看APK内容
  3. android spinner下拉列表
  4. Gridview实现银行选择列表
  5. 完成登陆实例
  6. android 中的编译选项的对应关系
  7. Linux调试工具之:ftrace
  8. android自定义滑动选择开关
  9. Telephony单元测试分析

随机推荐

  1. Android 检测用户一段时间无操作
  2. Android(安卓)NDK编译常见错误及解决方案
  3. 关于Android中的SQLite使用
  4. Android复习(十一)
  5. 无法关联源码
  6. Android通过socket连接服务器(PC)
  7. 跨进程共享 SharedPreferences
  8. Android批量插入数据
  9. Android(安卓)APP 启动优化(冷启动)
  10. Android创建快捷方式图标