]> rtime.felk.cvut.cz Git - linux-conf-perf.git/blob - conf.py
Allow importing lcp_django from other python scripts
[linux-conf-perf.git] / conf.py
1 import os
2 import sys
3 import re
4 import importlib.machinery
5 import multiprocessing
6
7 ## Global configs
8 # kernel_arch
9 # This defines environment variable ARCH for linux kernel.
10 # Change this to change target architecture
11 kernel_arch = 'x86'
12
13 # kernle_env
14 # Enviroment variables for Linux
15 kernel_env = {'SRCARCH': kernel_arch, 'ARCH': kernel_arch, 'KERNELVERSION': kernel_arch}
16 # build_command
17 # Command executed for kernel build in linux folder.
18 build_command = ['make', '-j', str(multiprocessing.cpu_count())]
19
20 # boot_command
21 # Command executed for booting. Output of this command is saved to output folder.
22 boot_command = ['echo', 'bootit']
23 # boot_timeout
24 # Set timeout of boot process if no output is generated for selected seconds
25 boot_timeout = 120
26
27 # parse_command
28 # Command to parse double value from boot output
29 parse_command = ['echo', '0']
30
31 # measurement_identifier
32 # Identifier of measurement can consist of measure tool name and version
33 measure_identifier = 'cyclictest-v0.92'
34
35 # picosat_args
36 # Additional arguments passed to PicoSAT.
37 picosat_args = []
38
39 # db_database
40 # Database in PostgreSQL to be used for this tools
41 db_database = 'linux-conf-perf'
42
43 # multithread
44 # Define if measurement and kernel build should be executed in parallel.
45 multithread = False
46 # multithread_buffer
47 # Defines maximal number of buffered configurations before generating is suspended.
48 multithread_buffer = 32
49
50 ## Programs output show/hide
51 # These options hides output of launched programs from terminal.
52 # If variable is True, output is printed. Otherwise is hidden.
53 # What ever are these settings, output is always written to files in folder log.
54 parse_kconfig_output = False
55 picosat_output = False
56 kernel_config_output = True
57 kernel_make_output = True
58 boot_output = True
59 parse_output = False
60
61 ## Configs for debugging
62 single_loop = False # Executes only one loop and exits.
63 only_config = False # Executes only to configuration phase. Building and booting phases are skipped.
64 ignore_misconfig = False # Ignore if configuration wasn't applied correctly.
65 #######################################
66 # Most probably you don't want touch rest of these.
67 ## Path settings
68 dot_confmk = '.conf.mk'
69 dot_config = 'dot_config'
70
71 linux_sources = 'linux/'
72 linux_build_folder = 'linux/'
73 linux_image = linux_build_folder + 'arch/' + kernel_arch + '/boot/bzImage'
74
75 build_folder = 'jobfiles/'
76 jobfolder_linux_image = build_folder + 'linuxImage'
77 symbol_map_file = build_folder + 'symbol_map' # Also defined in parse_kconfig
78 rules_file = build_folder + 'rules' # Also defined in parse_kconfig
79 variable_count_file = build_folder + 'variable_count' # Also defined in parse_kconfig
80 fixed_file = build_folder + 'fixed'
81 measure_file = build_folder + 'measure'
82 dot_measure_file = build_folder + 'dot_measure'
83 dot_config_back_file = build_folder + 'dot_config_back'
84 single_generated_file = build_folder + 'single_generated'
85 measurechecked_file = build_folder + 'measurechecked'
86
87 buildroot_config_cyclictest = '/dev/null'
88
89 result_folder = 'result/'
90 log_folder = 'log/'
91
92 ## Programs paths
93 parse_kconfig = 'scripts/parse_kconfig/parse'
94 write_config = 'scripts/write_config/write_config'
95 picosat = 'scripts/picosat-959/picosat'
96 allconfig = 'scripts/allconfig/allconfig'
97
98 #######################################
99 absroot = os.path.dirname(os.path.realpath(__file__))
100
101 #######################################
102 # Override configuration for specified target
103 try:
104         target = open(os.path.join(absroot, '.target'), 'r').readline().rstrip()
105         conffile = os.path.join(absroot, 'targets', target, 'conf.py')
106         try:
107                 ovconf = importlib.machinery.SourceFileLoader("module.name", conffile).load_module()
108                 for name in dir(ovconf):
109                         if not re.match('__*__', name):
110                                 vars()[name] = vars(ovconf)[name]
111         except:
112                 print("E: Invalid target specifier. Write valid target to .target file.")
113                 sys.exit(-99)
114 except:
115         print("E: No target specifier. Write target to .target file.")
116         sys.exit(-99)