-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathextract_code.sh
executable file
·121 lines (98 loc) · 3.44 KB
/
extract_code.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=$HOME/android
ANDROID_BUILD_TOP=${ANDROID_BUILD_TOP%/}
[ -e "$ANDROID_BUILD_TOP/.repo" ] || {
echo "$ANDROID_BUILD_TOP/.repo not found, where is your android code?"
exit 1
}
TMP_VERSIONS=versions.$$
cleanup () {
echo -e "\nversions:\n"
sort -k 2 -u $TMP_VERSIONS
rm $TMP_VERSIONS
}
find_dir () {
local d=$1
local dir=$(pwd)
while [ -n "$dir" ]; do
[ -d "$dir/$d" ] && break
dir=$(dirname "$dir")
[ "$dir" = "/" ] && dir= && break
done
echo "$dir"
}
get_module_version () {
local d=$1
local module
[ -d "$1" ] || d=$(dirname "$1")
d="$ANDROID_BUILD_TOP/$d"
module=$(cd "$d"; find_dir .git)
module=${module#$ANDROID_BUILD_TOP/}
[ -z "$module" ] && return
echo $(cd "$d"; git rev-parse HEAD) " $module"
}
copy_source () {
#tar -exclude .git -C $ANDROID_BUILD_TOP -cf - $1 | tar -xf -
mkdir -p `dirname $1`
if [ -d $ANDROID_BUILD_TOP/$1 ]; then
rsync -a --exclude .git $ANDROID_BUILD_TOP/$1/ $1
else
rsync -a --exclude .git $ANDROID_BUILD_TOP/$1 $1
fi
get_module_version "$1" >> $TMP_VERSIONS
}
trap cleanup EXIT
copy_source system/core/include
copy_source hardware/libhardware/include
copy_source hardware/libhardware_legacy/include
copy_source hardware/ril/include
copy_source dalvik/libnativehelper/include
copy_source frameworks/base/include
copy_source frameworks/base/opengl/include
copy_source external/skia
copy_source system/core/liblog
copy_source system/core/libcutils
copy_source frameworks/base/libs/utils
copy_source frameworks/opt/emoji
copy_source frameworks/base/libs/ui
copy_source hardware/libhardware
copy_source hardware/libhardware_legacy
copy_source system/core/libpixelflinger
copy_source frameworks/base/opengl/libs
copy_source frameworks/base/opengl/libagl
copy_source frameworks/base/libs/surfaceflinger
copy_source frameworks/base/cmds/surfaceflinger
copy_source frameworks/base/cmds/bootanimation
copy_source frameworks/base/cmds/servicemanager
copy_source system/core/adb
copy_source system/core/logcat
# required by frameworks/base/cmds/bootanimation/BootAnimation.cpp
copy_source frameworks/base/core/res/assets/images/android-logo-mask.png
copy_source frameworks/base/core/res/assets/images/android-logo-shine.png
# required by system/core/libcutils/mspace.c
copy_source bionic/libc/bionic/dlmalloc.c
# required by system/core/libcutils/ashmem-dev.c
copy_source bionic/libc/kernel/common/linux/ashmem.h
# required by frameworks/base/include/private/utils/binder_module.h
copy_source bionic/libc/kernel/common/linux/binder.h
# required by frameworks/base/libs/utils/MemoryHeapBase.cpp
copy_source bionic/libc/kernel/common/linux/android_pmem.h
# required by frameworks/base/libs/ui/EGLDisplaySurface.cpp
copy_source bionic/libc/kernel/common/linux/msm_mdp.h
## new kernel source
#copy_source kernel/mm/ashmem.c
#copy_source kernel/mm/shmem.c
#copy_source kernel/drivers/misc/pmem.c
#copy_source kernel/drivers/staging/android/binder.c
#copy_source kernel/drivers/staging/android/logger.c
#
#copy_source kernel/include/linux/ashmem.h
#copy_source kernel/include/linux/mm.h
#copy_source kernel/include/linux/android_pmem.h
#copy_source kernel/drivers/staging/android/binder.h
#copy_source kernel/drivers/staging/android/logger.h
[ -e modified_sources.txt ] &&
while read f ; do
[ -z "$f" ] && continue
git checkout -- $f
done < modified_sources.txt