【【【常用的ubuntu第三方工具及android命令(自存档)】】】


经典的参考文档(以及具体产品build mk):

http://pan.baidu.com/s/1i3KJkvN


1、android脚本

1、#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)

参考:http://blog.sina.com.cn/s/blog_6e654d2b0101cw2q.html

原因其实很简单, xargs 默认是以空白字符 (空格, TAB, 换行符) 来分割记录的, 因此文件名 ./file 1.log 被解释成了两个记录 ./file 和 1.log, 不幸的是 rm 找不到这两个文件.
为了解决此类问题, 聪明的人想出了一个办法, 让 find 在打印出一个文件名之后接着输出一个 NULL 字符 ('')而不是换行符, 然后再告诉 xargs 也用 NULL 字符来作为记录的分隔符. 这就是 find 的 -print0 和 xargs 的-0 的来历吧.


2、 makefile 参考文档:

http://blog.csdn.net/haoel/article/details/2894


3、build/core/main.mk

makeshowcommands在编译的时候显示脚本的命令,而不是显示编译的简报。用于调试脚本


4、build/core/config.mk

config.mk文件的主要内容如下:
> 头文件的定义;(各种include文件夹的设定)
在定义头文件的部分,还include了pathmap.mk,如下:
include $(BUILD_SYSTEM)/pathmap.mk
该文件设置include目录和frameworks/base下子目录等的信息。
> 编译系统内部mk文件的定义; <Build system internal files>
> 设定通用的名称;<Set common values>
> Include必要的子配置文件;<Include sub-configuration files>
>> buildspec.mk
>> envsetup.mk
>> BoardConfig.mk
>> /combo/select.mk
>> /combo/javac.mk
> 检查BUILD_ENV_SEQUENCE_NUMBER版本号;
In order to make easier for people when the build system changes, when it is necessary to make changes to buildspec.mk or to rerun the environment setup scripts, they contain a version number in the variable BUILD_ENV_SEQUENCE_NUMBER. If this variable does not match what the build system expects, it fails printing an error message explaining what happened. If you make a change that requires an update, you need to update two places so this message will be printed.
· In config/envsetup.make, increment the CORRECT_BUILD_ENV_SEQUENCE_NUMBER definition.
· In buildspec.mk.default, update the BUILD_ENV_SEQUENCE_DUMBER definition to match the one in config/envsetup.make
The scripts automatically get the value from the build system, so they will trigger the warning as well.
> 设置常用工具的常量;< Generic tools.>
> 设置目标选项;< Set up final options.>
> 遍历并设置SDK版本;


5、make product-graph

图片的构成其实来源于Android编译系统的一个核心函数inherit-product。其功能是以继承性的方法去取得另一个.mk文件里定义的PRODUCT_xxxx变量。 最顶级的.mk定义了最核心的功能,越底级的越接近产品特性。

要安装工具:sudoapt-getinstallgraphviz


6、Makefile variables ($@, $< …)

http://www.linux-pages.com/2013/02/gnu-makefile-special-variables-dollar-at/

Here’s what these two mean, and you can look up the rest on the GNU Makefile “Automatic Variables” help page:

$@ -is the name of the target currently being processed.

$< -is the name of the first dependency.


all: clean libs app
@echo 'Building target: $@. First dependency is: $<
...

Then when you invoke ’make all’ you will see the message:
Building target: all. First dependency is: clean.'

7、jgrep cgrep 实现

function jgrep()
{
find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
}


function cgrep()
{
find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
}



function
resgrep()
{
for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
}


8、常用的一些方法

cgrep

jgrep

get_build_var 获取变量的值


9、 luncher 菜单增加

在envsetup.sh的最后,会搜索这么几个地址,进行vendorsetup.sh的获取,

# Execute the contents of any vendorsetup.sh files we can find.
for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
do
echo "including $f"
. $f
done
unset f


以rk3066为例:

./device/rockchip/rk30sdk/vendorsetup.sh

add_lunch_combo rk30sdk-eng
add_lunch_combo rk30sdk-userdebug
add_lunch_combo rk30sdk-user


10、android编译简单说明

source ./build/envsetup.sh #进行环境变量设置,常用函数设置,luncher 菜单增加。

lunchrk30sdk-eng #进行product:rk30sdk, eng/user模式解析;

make #build/core/main.mk 中依次调用core,mk 以及其他mk,还有rk30sdk.mk的搜索加载,然后由rk30sdk.mk再进行模块的加载,可以参考

make product-graph的生成图示


2、android 知识

1、全量ota升级的时候,会把 整个system分区的内容都会格式化的,也就是说里面的bin framwrok jar 以及vendor ko文件、kl文件全部都会被替换掉。
2、 wifi密码,手机ROOT后可以看这里,防止密码忘记了的不就方法: data/misc/wifi/wpa_supplicant.conf
3、关于短信的英文160个字符,汉字70个字符而不是80个字符的道理。如果是全英文或者数字,7BIT就可与表示。一旦有汉字的话,双字节。160*7=2*70*8的道理!

3、脚本知识

1、windows上netstat -aon |findstr port && killTASK -f -pid xxxx 2、linux上netstat -apn |grep port && kill xxx
3、linux下格式化数据 可以使用 dd if=/dev/random(/dev/zero或者/dev/unrandom) of=/your/path bs=4096 (bs 一次写的大小) 4、/dev/null 是输出设备无底洞 /dev/zero是输入设备

4、字符转换


1、常见的json字符串中的 比如: {"news":[{"id":1,"title":"\u5934\u6761","params":"721,722,760"},{"id":43,"title":"\u89c6\u9891","params":"723"}

\u5934\u6761 替换关键字符 \u 为&#x,这样可以在utf-8在线 转换中转换过来

http://tool.chinaz.com/Tools/UTF-8.aspx


2、如果是json中的话,直接到json 检测网站,会自动进行中文转换!

更多相关文章

  1. android Settings中的各个默认设置
  2. Android(安卓)编译NDK
  3. AndroidStudio使用ViewPagerIndicator
  4. 样式 主题 对话框 国际化
  5. CyanogenMod 编译 Google Galaxy Nexus (GSM) 全过程
  6. Android(安卓)Interface(UI) 界面控件简单介绍01
  7. 在android平台上编译libpcap-0.9.8 和 jnetpcap-1.2.rc1
  8. android webkit
  9. 在RelativeLayout布局中可以设置标签的android:layout_toLeftO..

随机推荐

  1. android permission Suggestion: add 'to
  2. android更新
  3. Cocos2d-x Lua实现从Android回调到Lua的
  4. 解决 Android SDK下载和更新失败“Connec
  5. Android 创建全局变量和Context
  6. Android引用资源(resources) vs 引用样式属
  7. Android 使用ADB命令安装、卸载软件
  8. TabHost—多种实现
  9. Android下编译自己的库文件jar并在应用中
  10. Android SDK更新的问题