]> rtime.felk.cvut.cz Git - linux-conf-perf.git/blob - conf.py
kconfig2sat almost finished
[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 # # db_user
44 # # Define PostgreSQL user
45 # db_user = 'user'
46 # # db_password
47 # # Define PostrgreSQL user password
48 # db_password = 'password'
49 # # db_host
50 # # Address of PostgreSQL database server
51 # db_host = 'localhost'
52 # # db_port
53 # # Port of PotgreSQL database server
54 # db_port = 5432
55
56 # multithread
57 # Define if measurement and kernel build should be executed in parallel.
58 multithread = False
59 # multithread_buffer
60 # Defines maximal number of buffered configurations before generating is suspended.
61 multithread_buffer = 32
62
63 # git_describe_cmd
64 # Command used for getting tools version and status from git
65 git_describe_cmd = ['git', 'describe', '--always', '--tags', '--dirty']
66 # git_commit_cmd
67 # Command used for getting commit hash from git
68 git_commit_cmd = ['git', 'rev-parse', '--verify', 'HEAD']
69
70 ## Programs output show/hide
71 # These options hides output of launched programs from terminal.
72 # If variable is True, output is printed. Otherwise is hidden.
73 # What ever are these settings, output is always written to files in folder log.
74 parse_kconfig_output = False
75 picosat_output = False
76 kernel_config_output = True
77 kernel_make_output = True
78 boot_output = True
79 parse_output = False
80
81 ## Configs for debugging
82 single_loop = False # Executes only one loop and exits.
83 only_config = False # Executes only to configuration phase. Building and booting phases are skipped.
84 ignore_misconfig = False # Ignore if configuration wasn't applied correctly.
85 #######################################
86 # Most probably you don't want touch rest of these.
87 ## Path settings
88 dot_confmk = '.conf.mk'
89 dot_config = 'dot_config'
90
91 linux_sources = 'linux/'
92 linux_build_folder = 'linux/'
93 linux_image = linux_build_folder + 'arch/' + kernel_arch + '/boot/bzImage'
94
95 build_folder = 'jobfiles/'
96 jobfolder_linux_image = build_folder + 'linuxImage'
97 symbol_map_file = build_folder + 'symbol_map' # Also defined in parse_kconfig
98 rules_file = build_folder + 'rules' # Also defined in parse_kconfig
99 variable_count_file = build_folder + 'variable_count' # Also defined in parse_kconfig
100 fixed_file = build_folder + 'fixed'
101 measure_file = build_folder + 'measure'
102 dot_measure_file = build_folder + 'dot_measure'
103 dot_config_back_file = build_folder + 'dot_config_back'
104 single_generated_file = build_folder + 'single_generated'
105 measurechecked_file = build_folder + 'measurechecked'
106
107 buildroot_config_cyclictest = '/dev/null'
108
109 result_folder = 'result/'
110 log_folder = 'log/'
111
112 ## Programs paths
113 parse_kconfig = 'scripts/parse_kconfig/parse'
114 write_config = 'scripts/write_config/write_config'
115 picosat = 'scripts/picosat-959/picosat'
116 allconfig = 'scripts/allconfig/allconfig'
117
118 #######################################
119 absroot = os.path.dirname(os.path.realpath(__file__))
120
121 #######################################
122 # Override configuration for specified target
123 try:
124         target = open(os.path.join(absroot, '.target'), 'r').readline().rstrip()
125         conffile = os.path.join(absroot, 'targets', target, 'conf.py')
126         try:
127                 ovconf = importlib.machinery.SourceFileLoader("module.name", conffile).load_module()
128                 for name in dir(ovconf):
129                         if not re.match('__*__', name):
130                                 vars()[name] = vars(ovconf)[name]
131         except:
132                 print("E: Invalid target specifier. Write valid target to .target file.")
133                 sys.exit(-99)
134 except:
135         print("E: No target specifier. Write target to .target file.")
136         sys.exit(-99)