-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_all.sh
executable file
·192 lines (147 loc) · 4.49 KB
/
make_all.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
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
#!/bin/bash
#Trap in case of error
set -e
#Print all commands executed.. Only for debug
#set -o verbose
if [ -z ${setup_env+x} ]; then
echo -e "$c_info Sourcing setup_env.sh.. $c_default"
source ./setup_env.sh
fi
# make sure to be in the same directory as this script #########################
script_dir_abs=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd "${script_dir_abs}"
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
# Functions definitions ########################################################
print_info(){
echo -e ""
echo -e ""
echo -e "$c_info Check ./build/make_bootbin.sh to get the baud rate for the UART (should be 115200)$c_default"
echo -e "$c_info Use 'minicom -c on' or 'miniterm.py' to use the UART-USB$c_default"
echo -e "$c_info You can type ssh $sshcommand (password root) $c_default"
echo -e "$c_info If you don't have ssh working: dpkg -i *.deb in Desktop/pkg $c_default"
echo -e "$c_info \t Or you can type sudo apt-get install openssh-server $c_default"
date
}
function ctrl_c() {
print_info
echo -e "$c_good \nExited by user with CTRL+C $c_default"
echo -e "$c_good *** DONE `basename "$0"` *** $c_default"
trap : 0
exit 0
}
abort() {
echo -e "$c_error Error in `basename "$0"`$c_default"
exit 1
}
function hcenter {
text="$1"
cols=`tput cols`
IFS=$'\n'$'\r'
for line in $(echo -e $text); do
line_length=`echo $line| wc -c`
half_of_line_length=`expr $line_length / 2`
center=`expr \( $cols / 2 \) - $half_of_line_length`
spaces=""
for ((i=0; i < $center; i++)) {
spaces="$spaces "
}
echo -e "$spaces$line"
done
}
function asking_to_do {
ACTION=$1
COMMAND=$2
echo -e "\e[0;33m"
read -r -s -n 1 -p "Do $ACTION ? [y,n] : " doit
case $doit in
y|Y) echo -e "$c_orange doing $ACTION $c_default" && $COMMAND;;
n|N) echo -e "$c_orange passing $ACTION $c_default" ;;
*) echo -e "$c_orange bad option $c_orange" && asking_to_do $ACTION $COMMAND ;;
esac
}
trap 'abort' 0
echo -e "$c_good *** START `basename "$0"` *** $c_default"
#Copy files to sd card
if [ -z "$1" ]; then
echo -e "$c_error You need to specify a HDF location$c_default"
exit 1
fi
$preset_dir_r/make_preset.sh
hdf_location="$1"
sdcard_abs="$2"
#if [ "$3" = "y" ]
#then
# ./clean_files.sh
#else
# asking_to_do "clean files" ./clean_files.sh
#fi
#./clean_files.sh
abs_path_hdf=`readlink -f $hdf_location`
hdf_name_only=`basename "$abs_path_hdf" .hdf`
#echo -e ""
#echo -e "$c_orange \t\t\t --------------------- $c_default"
#echo -e "$c_orange \t\t\t| Menu MakeAll |$c_default"
#echo -e "$c_orange \t\t\t --------------------- $c_default"
old_IFS=$IFS
echo -e ""
hcenter "$c_orange --------------------- $c_default"
hcenter "$c_orange Menu_MakeAll$c_default"
hcenter "$c_orange --------------------- $c_default"
echo -e ""
echo -e ""
PS3="Menu #?> "
IFS=$old_IFS
select opt in $OPTIONS_MENU; do
if [ "$opt" = "Quit" ]; then
echo "Exit menu"
break
elif [ "$opt" = "Make_all" ]; then
#./clean_files.sh
#$linux_dir_r/make_kernel.sh
$linux_dir_r/make_uboot.sh
$dev_dir_r/make_dtb.sh $abs_path_hdf
$dev_dir_r/make_fsbl.sh $abs_path_hdf
$build_dir_r/make_bootbin.sh $hdf_name_only
$dev_dir_r/make_applications.sh $hdf_name_only
./copy_to_sd_card.sh $sdcard_abs
elif [ "$opt" = "Clean_build" ]; then
./clean_files.sh
elif [ "$opt" = "Make_kernel" ]; then
select opt_s in $OPTIONS_MENU_KERNEL; do
if [ "$opt_s" = "Quit" ]; then
echo "Exit sub menu"
break
elif [ "$opt_s" = "Use_default_config" ]; then
$linux_dir_r/make_kernel.sh
elif [ "$opt_s" = "Use_custom_config" ]; then
$linux_dir_r/make_kernel.sh zynq_custom_defconfig
else
echo "Bad option"
fi
done
elif [ "$opt" = "Make_Uboot" ]; then
$linux_dir_r/make_uboot.sh
elif [ "$opt" = "Make_dtb" ]; then
$dev_dir_r/make_dtb.sh $abs_path_hdf
elif [ "$opt" = "Make_fsbl" ]; then
$dev_dir_r/make_fsbl.sh $abs_path_hdf
elif [ "$opt" = "Make_bootbin" ]; then
$build_dir_r/make_bootbin.sh $hdf_name_only
elif [ "$opt" = "Make_applications" ]; then
$dev_dir_r/make_applications.sh $hdf_name_only
elif [ "$opt" = "Send_applications" ]; then
$dev_dir_r/send_applications.sh $hdf_name_only
elif [ "$opt" = "Push_to_sd_card" ]; then
./copy_to_sd_card.sh $sdcard_abs
elif [ "$opt" = "Get_Results" ]; then
./get_results.sh
else
echo "Bad option"
fi
echo -e ""
done
trap : 0
print_info
echo -e "$c_good \nExited by user $c_default"
echo -e "$c_good *** DONE `basename "$0"` *** $c_default"