19 if conf.gen_all_solution_oninit:
23 try: os.mkdir(sf(conf.build_folder))
24 except FileExistsError:
27 if os.path.isfile(sf(conf.phase_file)):
28 print("Warning: file " + conf.phase_file + " already exists. Not overwritten.")
32 if os.path.isfile(sf(conf.iteration_file)):
33 print("Warning: file " + conf.iteration_file + " already exists. Not overwritten.")
35 loop.iteration_reset()
39 "Execute parse_kconfig in linux_sources directory."
40 env = dict(os.environ)
42 os.chdir(sf(conf.linux_sources))
43 parse_kconfig_cmd = [sf(conf.parse_kconfig)]
44 parse_kconfig_cmd += [sf(conf.linux_kconfig_head), sf(conf.build_folder)]
45 parse_kconfig_cmd += ['-v', '-v']
46 utils.callsubprocess("parse_kconfig", parse_kconfig_cmd,
47 conf.parse_kconfig_output, env=utils.get_kernel_env())
52 "Generates required depenpency from .config file in linux source tree."
54 if not os.path.isfile(sf(conf.linux_dot_config)):
55 raise exceptions.MissingFile(sf(conf.linux_dot_config),
56 'Generate initial configuration. Execute make defconfig in linux folder. Or use make menuconfig and change configuration.')
58 utils.build_symbol_map() # Ensure smap existence
59 srmap = {value:key for key, value in utils.smap.items()}
61 shutil.copy(sf(conf.linux_dot_config), sf(conf.dot_config_back_file))
63 with open(sf(conf.linux_dot_config), 'r') as f:
64 with open(sf(conf.required_file), 'w') as freq:
65 with open(sf(conf.dot_config_fragment_file), 'w') as fconf:
67 if (line[0] == '#') or (not '=' in line):
69 indx = line.index('=')
70 if (line[7:indx] == "MODULES"): # skip if modules set
71 raise exceptions.ConfigurationError("Initial kernel configuration must have MODULES disabled.")
72 if (line[indx + 1] == 'y'):
73 freq.write(str(srmap[line[7:indx]]) + "\n")
74 elif (line[indx + 1] == 'n' or line[indx + 1] == 'm'):
75 freq.write("-" + str(srmap[line[7:indx]]) + "\n")
78 freq.write("-" + str(srmap["MODULES"]) + "\n"); # force modules no
82 if os.path.isfile(sf(conf.nbscript)):
83 print("Warning: file " + conf.nbscript +
84 " already exists. Generation skipped.")
87 with open(sf(conf.nbscript), 'w') as f:
88 f.write('# generated novaboot script. Please don\'t edit unless you know what are you doing.\n')
89 f.write('load ' + sf(conf.linux_image) + ' console=ttyS0,115200\n')
90 f.write('load ' + sf(conf.buildroot_initram) + '\n')
92 #################################################################################
94 if __name__ == '__main__':