20 configurations.generate()
21 except exceptions.NoSolution:
23 # check if database is initialized
27 print('Initialize base...')
29 os.mkdir(sf(conf.build_folder))
30 except FileExistsError:
33 os.mkdir(sf(conf.configurations_folder))
34 except FileExistsError:
37 os.mkdir(sf(conf.log_folder))
38 except FileExistsError:
41 if os.path.isfile(sf(conf.phase_file)):
42 print("Warning: file " + conf.phase_file + " already exists. Not overwritten.")
46 if os.path.isfile(sf(conf.iteration_file)):
47 print("Warning: file " + conf.iteration_file + " already exists. Not overwritten.")
49 loop.iteration_reset()
53 "Execute parse_kconfig in linux_sources directory."
54 if os.path.isfile(sf(conf.symbol_map_file)) and \
55 os.path.isfile(sf(conf.rules_file)) and \
56 os.path.isfile(sf(conf.variable_count_file)):
57 print('Warning: parse_kconfig not executed. Files already exists.')
59 print('Executing parse_kconfig...')
60 env = dict(os.environ)
62 os.chdir(sf(conf.linux_sources))
63 parse_kconfig_cmd = [sf(conf.parse_kconfig)]
64 parse_kconfig_cmd += [sf(conf.linux_kconfig_head), sf(conf.build_folder)]
65 parse_kconfig_cmd += ['-v', '-v']
66 utils.callsubprocess("parse_kconfig", parse_kconfig_cmd,
67 conf.parse_kconfig_output, env=utils.get_kernel_env())
72 "Generates required depenpency from dot_config file."
73 print('Generating required configuration...')
75 if not os.path.isfile(sf(conf.dot_config)):
76 raise exceptions.MissingFile(sf(conf.dot_config),
77 'Generate fixed configuration. Use make dot_config.')
79 utils.build_symbol_map() # Ensure smap existence
80 srmap = {value:key for key, value in utils.smap.items()} # swap dictionary
82 shutil.copy(sf(conf.dot_config), sf(conf.dot_config_back_file))
84 with open(sf(conf.dot_config), 'r') as f:
85 with open(sf(conf.required_file), 'w') as freq:
87 if (line[0] == '#') or (not '=' in line):
89 indx = line.index('=')
90 if (line[indx + 1] == 'y'):
91 if line[7:indx] == "MODULES": # exception if modules set
92 raise exceptions.ConfigurationError("Fixed kernel configuration must have MODULES disabled.")
93 freq.write(str(srmap[line[7:indx]]) + "\n")
94 elif (line[indx + 1] == 'n' or line[indx + 1] == 'm'):
95 freq.write("-" + str(srmap[line[7:indx]]) + "\n")
98 #################################################################################
100 if __name__ == '__main__':