8 from exceptions import MissingFile
11 "Execute parse_kconfig in linux_sources directory and parsed output is placed to build_folder."
12 env = dict(os.environ)
13 env['SRCARCH'] = conf.SRCARCH
14 env['ARCH'] = conf.ARCH
15 env['KERNELVERSION'] = 'KERNELVERSION' # hides error
17 os.chdir(conf.linux_sources)
18 if conf.parse_kconfig_output:
19 subprocess.call([conf.parse_kconfig, conf.linux_kconfig_head, conf.build_folder, "-v", "-v"], env=env)
21 subprocess.call([conf.parse_kconfig, conf.linux_kconfig_head, conf.build_folder], env=env)
26 "Generates required depenpency from required file."
28 if not os.path.isfile(conf.linux_sources + '/.config'):
29 raise MissingFile(conf.linux_sources + '/.config',
30 'Generate initial configuration. Execute make defconfig in linux folder. Or use make menuconfig and change configuration.')
32 utils.build_symbol_map() # Ensure smap existence
33 srmap = {value:key for key, value in utils.smap.items()}
36 os.remove(conf.required_file)
37 os.remove(conf.dot_config_fragment_file)
41 shutil.copy(conf.linux_dot_config, conf.dot_config_back_file)
43 with open(conf.linux_sources + '/.config', 'r') as f:
44 with open(conf.required_file, 'w') as freq:
45 with open(conf.dot_config_fragment_file, 'w') as fconf:
47 if (line[0] == '#') or (not '=' in line):
49 indx = line.index('=')
50 if (line[indx + 1] == 'y' or line[indx + 1] == 'm'):
51 freq.write(srmap[line[7:indx]] + "\n")
52 elif (line[indx + 1] == 'n'):
53 freq.write("-" + srmap[line[7:indx]] + "\n")