-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·145 lines (124 loc) · 2.98 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
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
usage()
{
echo "Usage: $0 [OPTIONS] <ME_NAME>"
echo ""
echo "Where OPTIONS are:"
echo " -a Deploy all"
echo " -b Deploy boot (kernel, U-boot, etc.)"
echo " -r Deploy rootfs (secondary)"
echo " -u Deploy usr apps"
echo " -m Deploy MEs according to the deploy script in ME partition."
echo " -t Deploy Trused Application"
echo " -c Remove all MEs from the third partition."
echo ""
echo "ME_NAME is used with -a or -m and correspond to the <ME_NAME> in the ME path to be deployed."
echo "Examples are:"
echo " SOO.blind"
echo " SOO.refSO3"
exit 1
}
while getopts "abrumtc" o; do
case "$o" in
a)
deploy_rootfs=y
deploy_boot=y
deploy_usr=y
deploy_me=y
deploy_ta=y
;;
b)
deploy_boot=y
;;
c)
clean_me=y
;;
r)
deploy_rootfs=y
;;
u)
deploy_usr=y
;;
m)
deploy_me=y
;;
t)
deploy_ta=y
;;
*)
usage
;;
esac
done
if [ $OPTIND -eq 1 ]; then usage; fi
while read var; do
if [ "$var" != "" ]; then
export $(echo $var | sed -e 's/ //g' -e /^$/d -e 's/://g' -e /^#/d)
fi
done < build.conf
# We now have ${PLATFORM} which names the platform base.
if [ "$PLATFORM" != "virt32" -a "$PLATFORM" != "virt64" ]; then
echo "Specify the device name of MMC (ex: sdb or mmcblk0 or other...)"
read devname
export devname="$devname"
fi
if [ "$deploy_boot" == "y" ]; then
# Deploy files into the boot partition (first partition)
echo Deploying boot files into the first partition...
cd target
./mkuboot.sh ${PLATFORM}
cd ../filesystem
./mount.sh 1
sudo rm -rf fs/*
sudo cp ../target/${PLATFORM}.itb fs/${PLATFORM}.itb
sudo cp ../upgrade/agency.json fs/
sudo cp ../upgrade/root_flag fs/
sudo cp ../u-boot/uEnv.d/uEnv_${PLATFORM}.txt fs/uEnv.txt
if [ "$PLATFORM" == "virt32" -o "$PLATFORM" == "virt64" ]; then
# Nothing else ...
./umount.sh
cd ..
fi
if [ "$PLATFORM" == "rpi4" ]; then
sudo cp -rL ../bsp/rpi4/* fs/
sudo cp ../u-boot/u-boot.bin fs/kernel7.img
./umount.sh
cd ..
fi
if [ "$PLATFORM" == "rpi4_64" -o "$PLATFORM" == "cm4_64" ]; then
sudo cp -rL ../bsp/rpi4/* fs/
sudo cp ../u-boot/u-boot.bin fs/kernel8.img
./umount.sh
cd ..
fi
fi
if [ "$deploy_rootfs" == "y" ]; then
# Deploy of the rootfs (second partition)
cd linux/rootfs
./deploy.sh
cd -
fi
if [ "$deploy_usr" == "y" ]; then
# Deploy the usr apps related to the agency
cd linux/usr
./deploy.sh
cd -
fi
if [ "$deploy_me" == "y" ]; then
# Deploy the usr apps related to the agency
cd ME
./deploy.sh -d $2
cd -
fi
if [ "$deploy_ta" == "y" ]; then
# Deploy the TA related to the agency
cd optee_ta
./deploy.sh
cd -
fi
if [ "$clean_me" == "y" ]; then
# Deploy the usr apps related to the agency
cd ME
./deploy.sh -r
cd -
fi