aboutsummaryrefslogtreecommitdiffstats
path: root/gen_json.sh
blob: bde0dd7513adea43f6b8a4476cd2e2142f5d46ed (plain)
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
#!/bin/bash
ME=$(basename $0)
INPUT_FILE=input.csv

# Usage

usage () {
cat << EOT
Usage: 	$ME [-h]
	$ME [-s] - bitbake core-image-sato
	$ME [-k] - bitbake virtual/kernel
	$ME [-r] - bitbake core-image-sato (rm_work)
	$ME [-P] - bitbake -p (rm -rf cache /tmp/cache/)
	$ME [-p] - bitbake -p
	$ME [-t] - size of tmp dir
	$ME [-T] - size of tmp dir (rm_work)

EOT
}


while getopts "h:s:k:r:p:P:t:T:" opt; do
	case $opt in
#case $1 in
		-h)	usage
			exit 0
			;;
		-s)	param=3
			file=core-image-sato.json
			;;
		-k)	param=4
			file=bbkernel.json
			;;
		-r)	param=5
			file=core-image-sato-rmw.json
			;;
		-P)	param=6
			file=rmcache.json
			;;
		-p)	param=7
			file=p.json
			;;
		-t)	param=8
			file=tmpdir.json
			;;
		-T)	param=9
			file=tmpdir_rmwork.json
			;;
		*)	usage
			exit 1
			;;
	esac
done

#check machine_type:
read line < $INPUT_FILE
MACHINE=`echo $line | cut -d ',' -f1`

#backup 
mv "$MACHINE-$file" "$MACHINE-$file-`date  +%Y%m%d%H%M%S`"
#create JSON by machine type
python compute_json.py $param > "$MACHINE-$file"