install.sh
3.24 KB
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
#!/bin/bash
#
# install
#
# This script must be run from the Android main directory.
# embedian/install must be at ~/q1000_100_build
#
# Embedian SMARC-MX8M patches for Android 10.0.0 1.0.0
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}/../../.."
readonly BASE_BRANCH_NAME="base_q10.0.0_1.0.0"
## git variables get from base script!
readonly _EXTPARAM_BRANCH="smarc-8mq-q10.0.0_1.0.0-ga"
## dirs ##
readonly EMBEDIAN_PATCHS_DIR="${SCRIPT_POINT}/platform"
readonly EMBEDIAN_SH_DIR="${SCRIPT_POINT}/sh"
VENDOR_BASE_DIR=${ANDROID_DIR}/vendor/embedian
# 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:20200401)"
# disable NXP kernel Android.mk
cd ${ANDROID_DIR} > /dev/null
mv vendor/nxp-opensource/kernel_imx/drivers/staging/greybus/tools/Android.mk vendor/nxp-opensource/kernel_imx/drivers/staging/greybus/tools/Android.mk__
cd ${ANDROID_DIR} > /dev/null
######## extended create repositories #######
pr_info "###############################"
pr_info "# Misc. external repositories #"
pr_info "###############################"
pr_info "clone ${VENDOR_BASE_DIR}/can-utils"
git clone https://github.com/linux-can/can-utils.git ${VENDOR_BASE_DIR}/can-utils
cd ${VENDOR_BASE_DIR}/can-utils > /dev/null
git checkout 791890542ac1ce99131f36435e72af5635afc2fa -b ${BASE_BRANCH_NAME}
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 "# Copy shell utilites #"
pr_info "#######################"
cp -r ${EMBEDIAN_SH_DIR}/* ${ANDROID_DIR}/
pr_info "#####################"
pr_info "# Done #"
pr_info "#####################"
exit 0