-
Notifications
You must be signed in to change notification settings - Fork 34
/
docker_cmd.sh
executable file
·68 lines (56 loc) · 2.16 KB
/
docker_cmd.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
#!/bin/bash
function print_usage() {
RED='\033[0;31m'
BLUE='\033[0;34m'
BOLD='\033[1m'
NONE='\033[0m'
echo -e "\n${RED}Usage${NONE}:
.${BOLD}/docker_cmd.sh${NONE} [OPTION]"
echo -e "\n${RED}OPTIONS${NONE}:
${BLUE}build${NONE}: build penglai-demo image
${BLUE}run-qemu${NONE}: run penglai-demo image in (modified) qemu
"
}
# no arguments
if [ $# == 0 ]; then
echo "Default: building penglai demo image"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it fly0307/penglai-enclave:v0.5 bash -c "export PATH=\$PATH:/home/penglai/toolchain/bin && /home/penglai/penglai-enclave/scripts/build_opensbi.sh -v1.2 -k2203"
exit 0
fi
if [[ $1 == *"help"* ]]; then
print_usage
exit 0
fi
# build penglai-0.9/1.0
if [[ $1 == "opensbi-0.9" ]]; then
echo "Build: build-opensbi-0.9/1.0"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it fly0307/penglai-enclave:v0.5 bash -c "export PATH=\$PATH:/home/penglai/toolchain-720/bin && /home/penglai/penglai-enclave/scripts/build_opensbi.sh -v0.9 -k2203"
exit 0
fi
# build penglai
if [[ $1 == "opensbi-1.2" ]]; then
echo "Build: build-opensbi-1.2"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it fly0307/penglai-enclave:v0.5 bash -c "export PATH=\$PATH:/home/penglai/toolchain/bin && /home/penglai/penglai-enclave/scripts/build_opensbi.sh -v1.2 -k2303"
exit 0
fi
# build penglai
if [[ $1 == *"qemu"* ]]; then
echo "Run: run penglai demo image in Qemu (built with openEuler)"
./run_openeuler.sh
exit 0
fi
# run docker
if [[ $1 == *"docker"* ]]; then
echo "Run: run docker"
#sudo docker run --privileged --cap-add=ALL -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it ddnirvana/penglai-enclave:v0.1
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --network=host --rm -it fly0307/penglai-enclave:v0.5 bash
exit 0
fi
# make clean
if [[ $1 == *"clean"* ]]; then
echo "Clean: make clean"
docker run -v $(pwd):/home/penglai/penglai-enclave -w /home/penglai/penglai-enclave --rm -it fly0307/penglai-enclave:v0.1 make clean
exit 0
fi
print_usage
exit 1