说明
应该是2016年之前的记录,之前没有写文档记录的习惯,都是随手记录的txt文件,所以没有图片、格式等。甚至现在看来有些地方逻辑不通(可能还因为年少轻狂,有些偏颇的话语),但是这些与现在的我不重要了,所以也不打算再复现、推理,重新编辑等,仅仅是在旧硬盘中发现,删除之前觉得可能还有点价值,记录下来吧。
1:ccache的设置:
export USE_CCACHE=1
好像老安卓版本是prebuilt/linux-x86/ccache/ccache -M 20G
prebuilts/misc/linux-x86/ccache/ccache -M 20G
//默认是在用户目录.ccache,如果设定目录用下面的命令,然后再指定下大小。
export CCACHE_DIR=/media/ubuntu/home/dong/.ccache
2:tmpfs的使用,是使用内存和交互空间存储数据,不指定容量大小默认是内存的一半。
sudo mount -t tmpfs tmpfs ./out/target/product -o size=8G
占用空间是动态的不像ramdisk即使没有存储任何东西也占用那么多的空间。空间如果使用完了:
sudo mount ./out/target/product -o remount,size=10G
实际上我觉的还是不使用好了,因为米2cm10.2要设置tmpfs为12g才装得下。
查看ccache的运行状况:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
3:因为任何一次编译都要查找所有的Android.mk,所以很慢。所以把build/core/main.mk修改了一下,增加了一个cache:
I add cache for Android.mk
subdir_makefiles :=
(
s
h
e
l
l
c
a
t
b
u
i
l
d
/
t
o
o
l
s
/
A
n
d
r
o
i
d
.
m
k
.
c
a
c
h
e
)
i
f
e
q
(
(shell cat build/tools/Android.mk.cache) ifeq (
(shellcatbuild/tools/Android.mk.cache)ifeq((subdir_makefiles),)
$(warning no cache. create build/tools/Android.mk.cache)
(
s
h
e
l
l
b
u
i
l
d
/
t
o
o
l
s
/
f
i
n
d
l
e
a
v
e
s
.
p
y
−
−
p
r
u
n
e
=
(shell build/tools/findleaves.py --prune=
(shellbuild/tools/findleaves.py−−prune=(OUT_DIR) --prune=.repo --prune=.git $(subdirs) Android.mk > build/tools/Android.mk.cache)
subdir_makefiles :=
$(shell cat build/tools/Android.mk.cache)
else
$(warning use cache: build/tools/Android.mk.cache")
endif
#subdir_makefiles := \
( s h e l l b u i l d / t o o l s / f i n d l e a v e s . p y − − p r u n e = (shell build/tools/findleaves.py --prune= (shellbuild/tools/findleaves.py−−prune=(OUT_DIR) --prune=.repo --prune=.git $(subdirs) Android.mk)
注意如果增加了模块,那么要自己记得在这个cache中添加上去。