summaryrefslogtreecommitdiff
path: root/packaging/exec-ttrace-marker
blob: ef52ffbda220c52c9138fc4b560043db6af9bbac (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
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
#!/bin/bash
# Note: This file has been deprecated
tag="/tmp/ttrace_tag"
conf="/etc/ttrace.conf"
change_permission="--update"

function init_perms(){
    chown root:developer /tmp/ttrace_tag
    chmod 0664 /tmp/ttrace_tag
    chsmack -a '*' /tmp/ttrace_tag

    chmod 0755 /sys/kernel/debug
    chown root:developer /sys/kernel/debug/tracing/trace_marker
    chmod 0222 /sys/kernel/debug/tracing/trace_marker
    chsmack -a '*' /sys/kernel/debug/tracing/trace_marker

    chown root:developer /sys/kernel/debug/tracing/trace_clock
    chmod 0664 /sys/kernel/debug/tracing/trace_clock
    chsmack -a '*' /sys/kernel/debug/tracing/trace_clock

    chown root:developer /sys/kernel/debug/tracing/buffer_size_kb
    chmod 0664 /sys/kernel/debug/tracing/buffer_size_kb
    chsmack -a '*' /sys/kernel/debug/tracing/buffer_size_kb

    chown root:developer /sys/kernel/debug/tracing/options/overwrite
    chmod 0664 /sys/kernel/debug/tracing/options/overwrite
    chsmack -a '*' /sys/kernel/debug/tracing/options/overwrite

    chown root:developer /sys/kernel/debug/tracing/options/print-tgid
    chmod 0664 /sys/kernel/debug/tracing/options/print-tgid
    chsmack -a '*' /sys/kernel/debug/tracing/options/print-tgid

    chown root:developer /sys/kernel/debug/tracing/events/sched/sched_switch/enable
    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/sched/sched_switch/enable

    chown root:developer /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable

    chown root:developer /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
    chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/power/cpu_frequency/enable

    chown root:developer /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
    chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/power/clock_set_rate/enable

    chown root:developer /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
    chmod 0664 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/cpufreq_interactive/enable

    chown root:developer /sys/kernel/debug/tracing/events/power/cpu_idle/enable
    chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_idle/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/power/cpu_idle/enable

    chown root:developer /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable
    chmod 0664 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable

    chown root:developer /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable
    chmod 0664 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable

    chown root:developer /sys/kernel/debug/tracing/events/block/block_rq_issue/enable
    chmod 0664 /sys/kernel/debug/tracing/events/block/block_rq_issue/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/block/block_rq_issue/enable

    chown root:developer /sys/kernel/debug/tracing/events/block/block_rq_complete/enable
    chmod 0664 /sys/kernel/debug/tracing/events/block/block_rq_complete/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/block/block_rq_complete/enable

    chown root:developer /sys/kernel/debug/tracing/events/mmc/enable
    chmod 0664 /sys/kernel/debug/tracing/events/mmc/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/mmc/enable

    chown root:developer /sys/kernel/debug/tracing/events/sync/enable
    chmod 0664 /sys/kernel/debug/tracing/events/sync/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/sync/enable

    chown root:developer /sys/kernel/debug/tracing/events/workqueue/enable
    chmod 0664 /sys/kernel/debug/tracing/events/workqueue/enable
    chsmack -a '*' /sys/kernel/debug/tracing/events/workqueue/enable

    chown root:developer /sys/kernel/debug/tracing/current_tracer
    chmod 0664 /sys/kernel/debug/tracing/current_tracer
    chsmack -a '*' /sys/kernel/debug/tracing/current_tracer

    chown root:developer /sys/kernel/debug/tracing/tracing_on
    chmod 0664 /sys/kernel/debug/tracing/tracing_on
    chsmack -a '*' /sys/kernel/debug/tracing/tracing_on

    chown root:developer /sys/kernel/debug/tracing/trace
    chmod 0660 /sys/kernel/debug/tracing/trace
    chsmack -a '*' /sys/kernel/debug/tracing/trace

    chown root:developer /usr/bin/atrace
    chmod 0755 /usr/bin/atrace
}


if [ -e "$tag" ]
then
	echo "$tag was created already!!!"
	exit 0
else
	# create ttrace tag 
	atrace --init_exec

	# initialize permission, smack rule for ttrace_tag, sysfs nodes
	init_perms
fi

if [ -e "$conf" ]
then
	echo "$conf was found!!!"

	while read line
	do
		options=$line
		echo "File name is - $conf"
		echo "Options is - $options"
	done < "$conf"
	# below script is not available on TV profile
	change-booting-mode.sh "$change_permission" 
	$options
	rm "$conf"
else
	echo "$conf was NOT found!!!"
fi
exit 0