Repository navigation
Expand file tree
/
Copy pathtest.cpp.sh
More file actions
105 lines (77 loc) · 2.07 KB
/
Copy pathtest.cpp.sh
File metadata and controls
105 lines (77 loc) · 2.07 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
#!/bin/bash
tinyDir=$(dirname $0)
tinyVM="TinyCPP"
tinyID="0"
buildroot=mini-os-x86_64-tinycpp
dirname=tinycpp
makeTarget=tinycpp-stubdom
waitTime="1"
function Usage(){
echo "--------------------------------------"
echo "Usage: $0 [option [GNU make option]]"
echo "Available options:"
echo "'': if no option, it will just run TinyVMI without re-build."
echo "'$0 make, m': just build TinyVMI, same as make -C stubdom/ tinyvmi-stubdom."
echo "'$0 makerun, mr': build TinyVMI and run it."
echo "'$0 build, b': make clean and rebuild TinyVMI."
echo "'$0 buildrun, br': make clean and rebuild TinyVMI."
echo "With last three options, you can also pass additional options to GNU make as following:"
echo "'$0 make -j4'"
echo "'$0 makerun -j4'"
echo "'$0 build -j4'"
echo "--------------------------------------"
echo ""
}
git log | head
# create TinyVMI VM and run it.
function createTinyStub(){
cd $buildroot
sudo xl create -c ../$dirname/domain_config
cd -
}
# go to dir of xen-src/stubdom/
cd $tinyDir
cd ..
options=""
if [ ! -z $2 ]; then
options="$2"
fi
opRun="run"
opMake="make"
opMakeRun="makerun"
opBuild="build"
opBuildRun="buildrun"
mode=$1
if [ -z "$mode" -o "$mode" == "$opRun" -o "$mode" == "r" ];then
createTinyStub
elif [ "$mode" == "$opMake" -o "$mode" == "m" -o "$mode" == "$opMakeRun" -o "$mode" == "mr" ];then
make $makeTarget $options
res=$?
if [ $res -ne 0 ]; then
echo "error run make, return $res"
exit $res
fi
if [ "$mode" == "$opMakeRun" -o "$mode" == "mr" ];then
createTinyStub
fi
elif [ "$mode" == "$opBuild" -o "$mode" == "b" -o "$mode" == "$opBuildRun" -o "$mode" == "br" ];then
make clean -C ../extras/mini-os $options
make clean -C $dirname $options
make -C ../extras/mini-os $options
res=$?
if [ $res -ne 0 ]; then
echo "error run make, return $res"
exit $res
fi
make $makeTarget $options
res=$?
if [ $res -ne 0 ]; then
echo "error run make, return $res"
exit $res
fi
if [ "$mode" == "$opBuildRun" -o "$mode" == "br" ];then
createTinyStub
fi
else
Usage
fi