Blame view

install 6.67 KB
aed04bac2   Eric Lee   Initial commit fo...
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
  #!/bin/bash
  #
  # install
  #
  # This script must be run from the Android main directory.
  # embedian/install must be at ~/m_601_210_build
  #
  # Embedian SMARC-FiMX6 patches for Android m6.0.1 210
  
  set -e
  #set -x
  
  SCRIPT_NAME=${0##*/}
  readonly SCRIPT_VERSION="0.1"
  
  #### Exports Variables ####
  #### global variables ####
  readonly ABSOLUTE_FILENAME=$(readlink -e "$0")
  readonly ABSOLUTE_DIRECTORY=$(dirname ${ABSOLUTE_FILENAME})
  readonly SCRIPT_POINT=${ABSOLUTE_DIRECTORY}
  readonly SCRIPT_START_DATE=$(date +%Y%m%d)
  readonly ANDROID_DIR="${SCRIPT_POINT}/../m_601_210_build"
  
  readonly BASE_BRANCH_NAME="base_M6.0.1_2.1.0"
  
  ## git variables get from base script!
  readonly _EXTPARAM_BRANCH="smarc-m6.0.1_2.1.0-ga"
  readonly _EXTPARAM_KERNEL_ANDROID_SUBDIR="kernel_imx"
  readonly _EXTPARAM_KERNEL_PATCH_FOLDER="kernel"
  #readonly _EXTPARAM_KERNEL_START_HASH="ad65770512d2baeb45f5d0622d985f9856b7cc1e"
  
  ## dirs ##
  readonly EMBEDIAN_PATCHS_DIR="${SCRIPT_POINT}/platform"
  readonly EMBEDIAN_SH_DIR="${SCRIPT_POINT}/sh"
  readonly EMBEDIAN_KERNEL_PATCH_DIR="${SCRIPT_POINT}/${_EXTPARAM_KERNEL_PATCH_FOLDER}"
  
  
  # print error message
  # p1 - printing string
  function pr_error() {
  	echo ${2} "E: $1"
  }
  
  # print warning message
  # p1 - printing string
  function pr_warning() {
  	echo ${2} "W: $1"
  }
  
  # print info message
  # p1 - printing string
  function pr_info() {
  	echo ${2} "I: $1"
  }
  
  # print debug message
  # p1 - printing string
  function pr_debug() {
  	echo ${2} "D: $1"
  }
  
  # test existing brang in git repo
  # p1 - git folder
  # p2 - branch name
  function is_branch_exist()
  {
  	local D="${1}"
  	local B="${2}"
  	local B_found
  	local HERE
  
  	if [ \( ! -d "${D}" \) -o \( -z "${B}" \) ]; then
  		echo false
  		return
  	fi
  
  	HERE=${PWD}
  	cd "${D}" > /dev/null
  
  	# Check branch
  	git branch 2>&1 > /dev/null
  	if [ ${?} -ne 0 ]; then
  		echo false
  		cd ${HERE} > /dev/null
  		return
  	fi
  	B_found=$(git branch | grep -w "${B}")
  	if [ -z "${B_found}" ]; then
  		echo false
  	else
  		echo true
  	fi
  
  	cd ${HERE} > /dev/null
  	return
  }
  
  ############### main code ##############
  pr_info "Script version ${SCRIPT_VERSION} (g:20160527)"
  
  cd ${ANDROID_DIR} > /dev/null
  
  ######## extended create repositories #######
  pr_info "########################"
  pr_info "# WiLink8 repositories #"
  pr_info "########################"
  
  mkdir -p ${ANDROID_DIR}/hardware/ti && :;
  cd ${ANDROID_DIR}/hardware/ti > /dev/null
  
  pr_info "clone hardware/ti/wlan"
  git clone git://git.omapzoom.org/platform/hardware/ti/wlan.git ${ANDROID_DIR}/hardware/ti/wlan
  cd ${ANDROID_DIR}/hardware/ti/wlan > /dev/null
  git checkout 4ba8edfbd44814d2e2c7b8167401344ddd8f2736 -b ${BASE_BRANCH_NAME}
  git rm -qrf ${ANDROID_DIR}/hardware/ti/wlan/mac80211/compat_wl18xx/
  git commit -qa -m "Remove compat_wl18xx" -m "Build it from the kernel source code instead"
  
  pr_info "clone hardware/ti/wl18xx-ti-utils"
  git clone git://git.ti.com/wilink8-wlan/18xx-ti-utils.git ${ANDROID_DIR}/hardware/ti/wl18xx-ti-utils
  cd ${ANDROID_DIR}/hardware/ti/wl18xx-ti-utils > /dev/null
  git checkout ee653d2845b0029c14f49ca83a2f6c02037ec239 -b ${BASE_BRANCH_NAME}
  
  pr_info "clone hardware/ti/wpan"
  git clone git://git.omapzoom.org/platform/hardware/ti/wpan.git ${ANDROID_DIR}/hardware/ti/wpan
  cd ${ANDROID_DIR}/hardware/ti/wpan > /dev/null
  git checkout a13583ac4b7bb513d1329a98f063272f01f1855e -b ${BASE_BRANCH_NAME}
  
  pr_info "make device/ti folder"
  mkdir -p ${ANDROID_DIR}/device/ti && :;
  
  pr_info "clone device/ti/proprietary-open"
  git clone git://git.omapzoom.org/device/ti/proprietary-open.git ${ANDROID_DIR}/device/ti/proprietary-open
  cd ${ANDROID_DIR}/device/ti/proprietary-open > /dev/null
  git checkout 1f52bc2b2c0000908f983f49e54e7a80742f24b1 -b ${BASE_BRANCH_NAME}
  
  pr_info "clone externel/crda"
  mkdir -p ${ANDROID_DIR}/external && :;
  git clone git://git.omapzoom.org/platform/external/crda.git ${ANDROID_DIR}/external/crda
  cd ${ANDROID_DIR}/external/crda > /dev/null
  git checkout c49a083c96fe60682ddf2ba9cddc9003b5564058 -b ${BASE_BRANCH_NAME}
  
  pr_info "###############################"
  pr_info "# Misc. external repositories #"
  pr_info "###############################"
  
  pr_info "clone externel/can-utils"
  git clone https://github.com/linux-can/can-utils.git ${ANDROID_DIR}/external/can-utils
  cd ${ANDROID_DIR}/external/can-utils > /dev/null
  git checkout cda61171f1f559dbb3b25c9fede2cc2a85c7cd0d -b ${BASE_BRANCH_NAME}
  
  pr_info "clone externel/i2c-tools"
  git clone https://github.com/Hashcode/i2c-tools.git ${ANDROID_DIR}/external/i2c-tools
  cd ${ANDROID_DIR}/external/i2c-tools > /dev/null
  git checkout 4aea42526b73eed33f811ce4b894df5d545e4d57 -b ${BASE_BRANCH_NAME}
  
  pr_info "clone externel/iw"
  git clone https://git.sipsolutions.net/iw.git ${ANDROID_DIR}/external/iw
  cd ${ANDROID_DIR}/external/iw > /dev/null
  git checkout 96fa73c7564fa7eba89cd78a24f20acd68d2f55f -b ${BASE_BRANCH_NAME}
  
  pr_info "clone externel/libtruezip"
  git clone https://github.com/jruesga/android_external_libtruezip.git ${ANDROID_DIR}/external/libtruezip
  cd ${ANDROID_DIR}/external/libtruezip > /dev/null
  git checkout 45ac3d07b5a4753bd1abc9fa38fd48221312a3d9 -b ${BASE_BRANCH_NAME}
  cd - > /dev/null
  
  pr_info "#########################"
  pr_info "# Add Embedian device  #"
  pr_info "#########################"
  cp -r ${SCRIPT_POINT}/embedian ${ANDROID_DIR}/device/
  
  pr_info "###########################"
  pr_info "# Apply framework patches #"
  pr_info "###########################"
  cd ${EMBEDIAN_PATCHS_DIR} > /dev/null
  git_array=$(find * -type d | grep '.git')
  cd - > /dev/null
  
  for _ddd in ${git_array}
  do
  	_git_p=$(echo ${_ddd} | sed 's/.git//g')
  	cd ${ANDROID_DIR}/${_git_p}/ > /dev/null
  	
  	pr_info "Apply patches for this git: \"${_git_p}/\""
  	
  	git checkout -b ${_EXTPARAM_BRANCH} || {
  		pr_warning "Branch ${_EXTPARAM_BRANCH} is present!"
  	};
  
  	git am ${EMBEDIAN_PATCHS_DIR}/${_ddd}/*
  
  	cd - > /dev/null
  done
  
  # pr_info "########################"
  # pr_info "# Apply kernel patches #"
  # pr_info "########################"
  # cd ${ANDROID_DIR}/${_EXTPARAM_KERNEL_ANDROID_SUBDIR} > /dev/null
  # 
  # [ "true" != "$(is_branch_exist "${ANDROID_DIR}/${_EXTPARAM_KERNEL_ANDROID_SUBDIR}/\.git" ${_EXTPARAM_BRANCH})" ] && {
  # 	# added nxp kernel repository
  # 	git remote add nxp git://git.freescale.com/imx/linux-2.6-imx.git
  # 
  # 	# get all history fron nxp kernel repository
  # 	git fetch nxp
  # 
  # 	get all tags from nxp kernel repository (interes tag = m6.0.1_1.0.0-ga)
  # 	git fetch nxp --tags
  # 
  # 	# create new branch
  # 	git checkout m6.0.1_1.0.0-ga -b ${_EXTPARAM_BRANCH}
  # 
  # 	# apply patches
  # 	git am ${EMBEDIAN_KERNEL_PATCH_DIR}/*
  # 
  # } || {
  # 	pr_info "Branch in the kernel already exists!"
  # }
  # 
  # cd - > /dev/null
  
  pr_info "#######################"
  pr_info "# Copy shell utilites #"
  pr_info "#######################"
  cp -r ${EMBEDIAN_SH_DIR}/* ${ANDROID_DIR}/
  
  pr_info "#####################"
  pr_info "# Done             #"
  pr_info "#####################"
  
  exit 0