海王  

此参数会影响到库生成后的存放位置,影响生成位置的应该是相关平台下的变量PRODUCT_PACKAGES

 

http://blog.csdn.net/evilcode/article/details/6459299

LOCAL_MODULE_TAGS :=user eng tests optional

user: 指该模块只在user版本下才编译

eng: 指该模块只在eng版本下才编译

tests: 指该模块只在tests版本下才编译

optional:指该模块在所有版本下都编译

 

eng This is the default flavor. A plain "make" is the same as "make eng". droid is an alias for eng. 
  * Installs modules tagged with: eng, debug, user, and/or development. 
  * Installs non-APK modules that have no tags specified. 
  * Installs APKs according to the product definition files, in addition to tagged APKs. 
  * ro.secure=0 
  * ro.debuggable=1 
  * ro.kernel.android.checkjni=1 
  * adb is enabled by default.   

user "make user"     This is the flavor intended to be the final release bits. 
  * Installs modules tagged with user. 
  * Installs non-APK modules that have no tags specified. 
  * Installs APKs according to the product definition files; tags are ignored for APK modules. 
  * ro.secure=1 
  * ro.debuggable=0 
  * adb is disabled by default.   

userdebug "make userdebug"     The same as user, except: 
  * Also installs modules tagged with debug. 
  * ro.debuggable=1 
  * adb is enabled by default.

 

Build flavors/types

When building for a particular product, it's often useful to have minor variations on what is ultimately the final release build. These are the currently-defined "flavors" or "types" (we need to settle on a real name for these).

eng This is the default flavor. A plain "make " is the same as "make eng ". droid is an alias for eng .
  • Installs modules tagged with: eng , debug , user , and/or development .
  • Installs non-APK modules that have no tags specified.
  • Installs APKs according to the product definition files, in addition to tagged APKs.
  • ro.secure=0
  • ro.debuggable=1
  • ro.kernel.android.checkjni=1
  • adb is enabled by default.
user "make user "

This is the flavor intended to be the final release bits.

  • Installs modules tagged with user .
  • Installs non-APK modules that have no tags specified.
  • Installs APKs according to the product definition files; tags are ignored for APK modules.
  • ro.secure=1
  • ro.debuggable=0
  • adb is disabled by default.
userdebug "make userdebug "

The same as user , except:

  • Also installs modules tagged with debug .
  • ro.debuggable=1
  • adb is enabled by default.

If you build one flavor and then want to build another, you should run "make installclean " between the two makes to guarantee that you don't pick up files installed by the previous flavor. "make clean " will also suffice, but it takes a lot longer.

 

Android 编译重要参数 LOCAL_MODULE_TAGS

最近移植tslib库到android系统,发现编译好的库和测试工具竟然没有输入到out/target/product/Ok6410/system/lib 和 out/target/product/Ok6410/system/bin下面,感觉很奇怪,于是下定决心看一下,到底输入到了哪里。

 

 

过程如下:

 

   tslib的源代码放到了android2.3 源代码下 vendor 目录 (android2.3中自己添加,如何设置自己的vendor 我的博客中有说明)forlinx/OK6410/的下面. tslib目录下面的 Android.mk写好以后,重新make clean 整个android源码,再次make 编译通过,奇怪的是输出目录 out/target/product/Ok6410/system/bin 下面竟然没有tslib相关的工具,而是放在了out/target/product/OK6410/symbols/system/bin 下面,在做打包文件时,由于没有把symbols文件夹放到文件系统里面,所以校准功能不能实现。(事实上提取文件系统过程中也不应该把symbols文件夹考虑在内)。

 

 

 

 最后查找原因 ,是因为tslib文件下的Android.mk文件里面,LOCAL_MODULE_TAGS变量设置的有问题。

LOCAL_MODULE_TAGS :=optional

把这项改为

LOCAL_MODULE_TAGS :=eng即可

 

原因是LOCAL_MODULE_TAGS 变量跟TARGET_BUILD_VARIANT 变量息息相关。 android系统编译时如果不指定

TARGET_BUILD_VARIANT 变量的值,默认 TARGET_BUILD_VARIANT=eng ,这一项指定 编译android时形成的版本风格,一般发布时使用这个值,当然还有user,debuguser等风格值,具体看一下这个链接http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html;h=43bae03b6b7b9cba678b86d2faf424fa565497bf;hb=HEAD,如果打不开,翻个墙就可以。

这样设置好以后,重新编译,输出目录out/target/product/Ok6410/system/bin ,out/target/product/Ok6410/system/lib里面就有tslib 相关的库和测试程序了。

  所以,如果自己需要加额外的模块,或者应用程序,一定要注意Android.mk里面的这个变量,当然了,如果你指定了LOCAL_MODULE_TAGS :=optional,也能编译出来,但是存放的输入路径就不是一般的

out/target/product/Ok6410/system/目录了,而是out/target/product/OK6410/symbols/system/目录。

后来自己在android源代码的 external目录下面放了一个模块,指定该模块的编译风格为LOCAL_MODULE_TAGS :=optional,重新编译,通过以后,竟然直接输出到了out/target/product/Ok6410/system/ 目录,很是惊讶,个人认为还跟模块存放的目录有关.所以无论模块在哪个文件夹下面,最好指定的值跟TARGET_BUILD_VARIANT 相关,如果没指定TARGET_BUILD_VARIANT ,系统会默认设置TARGET_BUILD_VARIANT =eng,你也就指定LOCAL_MODULE_TAGS :=eng 

 

目前自己遇到的 vendor目录,hardware目录下面的模块输出路径跟LOCAL_MODULE_TAGS 有很大的关系

LOCAL_MODULE_TAGS :=optional >> out/target/product/OK6410/symbols/system/

LOCAL_MODULE_TAGS :=eng    >> out/target/product/Ok6410/system/

 

当然前提是TARGET_BUILD_VARIANT=eng .

 

下面是网友遇到的类似问题:

 

"Set LOCAL_MODULE_TAGS to any number of whitespace-separated tags.

This variable controls what build flavors the package gets included
in. For example:

    * user: include this in user/userdebug builds
    * eng: include this in eng builds
    * tests: the target is a testing target and makes it available for tests
    * optional: don't include this"

Are these the same as "variants" and if so, which name would affect
the build and how? I've noticed that everything mentioned in a
product's makefile will always get built. But what gets in the final
system.img not always the same as what gets built.
http://groups.google.com.tw/group/android-platform/browse_thread/thread/a4f70254a2ceb622 
http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html;h=43bae03b6b7b9cba678b86d2faf424fa565497bf;hb=HEAD

 

 

 

 以上是自己在移植android2.3过程中发现的一个问题,如果您也遇到了,并且认为我的解释存在问题,请指出,以免给大家带来误解。

posted on 2013-12-19 18:42  海王  阅读(2646)  评论(0编辑  收藏  举报