-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·116 lines (101 loc) · 3.86 KB
/
deploy.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
#!/bin/bash
#==============================================================================
# Copyright (C) 2019 Allied Vision Technologies. All Rights Reserved.
#
# Redistribution of this file, in original or modified form, without
# prior written consent of Allied Vision Technologies is prohibited.
#
#------------------------------------------------------------------------------
#
# File: -deploy.sh
#
# Description: -bash script for deploying kernel binaries
#
#------------------------------------------------------------------------------
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
# NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==============================================================================
# ========================================================= colors
NC='\033[0m'
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHT_GRAY='\033[0;37m'
DARK_GRAY='\033[1;30m'
LIGHT_RED='\033[1;31m'
LIGHT_GREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHT_BLUE='\033[1;34m'
LIGHT_PURPLE='\033[1;35m'
LIGHT_CYAN='\033[1;36m'
WHITE='\033[1;37m'
# ========================================================= logging function
log()
{
if [[ ($1 == "info") ]]
then
echo -e "${WHITE}${2}${NC}"
elif [[ ($1 == "success") ]]
then
echo -e "${GREEN}Success!${2}${NC}"
elif [[ ($1 == "failed") ]]
then
echo -e "${RED}Fail!${NC}"
elif [[ ($1 == "hint") ]]
then
echo -e "${YELLOW}${2}${NC}"
elif [[ ($1 == "error") ]]
then
echo -e "${RED}${2}!${NC}"
fi
}
# ========================================================= default parameters
FNAME="AlliedVision_Wandboard_imx6_"
KR=`cat include/config/kernel.release`
export KERNEL_SRC=$PWD
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
# ========================================================= usage function
function usage() {
echo -e "deploy.sh:"
echo -e "The deploy script collects all necessary files for deployment and packs them together."
echo -e "Make sure the kernel is built (e.g. by calling the build.sh script).\n"
echo -e "The script will create a tarball for manual installation of the kernel and driver modules.\n"
echo -e "${YELLOW}Usage: ./deploy -t${NC}"
echo -e "-h, --help\t\t\t Display this message"
echo -e "-t, --tarball\t\t\t Create a tarball [default]"
exit 1
}
# ========================================================= help
if [[ ( $1 == "--help") || ( $1 == "-h") ]]; then
usage
# ========================================================= tarball
elif [[ ( $1 == "--tarball") || ( $1 == "-t") || (-z ${1-}) ]]; then
# Create zip with all files from build_archive and install.sh
mkdir -p ./deploy/${FNAME}${KR}
cp ./deploy/install.sh ./deploy/${FNAME}${KR}
cp ./build_archive/zImage ./deploy/${FNAME}${KR}
cp ./build_archive/*.dtb ./deploy/${FNAME}${KR}
cp ./build_archive/*.tar.gz ./deploy/${FNAME}${KR}
rm -f ./deploy/"${FNAME}${KR}".zip
rm -f ./deploy/"${FNAME}${KR}".tar.gz
(cd ./deploy && tar -zcvf ./"${FNAME}${KR}".tar.gz ${FNAME}${KR})
(cd ./deploy && rm -r ./${FNAME}${KR}/)
else
log error "unknown parameter $1"
usage
fi