aboutsummaryrefslogtreecommitdiff
path: root/scripts/kernel.py
blob: 994d5cf65a5d1d44af5d8708c11780733060be7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
import sys
import subprocess

from conf import conf
from conf import sf
import exceptions
import utils

def config():
	env = dict(os.environ)
	wd = os.getcwd()
	os.chdir(sf(conf.linux_sources))
	if conf.kernel_config_output:
		sprc = subprocess.call([sf(conf.write_config), sf(conf.linux_kconfig_head),
			sf(conf.build_folder)], env=utils.get_kernel_env())
	else:
		sprc = subprocess.call([sf(conf.write_config), sf(conf.linux_kconfig_head),
			sf(conf.build_folder)], stdout=subprocess.DEVNULL,
			env=utils.get_kernel_env())
	if sprc > 0:
		raise exceptions.ConfigurationError("some configs mismatch")
	os.chdir(wd)

def config_noprogram():
	# Executing old linux config
	env = dict(os.environ)
	wd = os.getcwd()
	os.chdir(sf(conf.linux_sources))
	if conf.kernel_config_output:
		sprc = subprocess.call('yes "" | make oldconfig', shell=True,
			env=utils.get_kernel_env())
	else:
		sprc = subprocess.call('yes "" | make oldconfig', shell=True,
			stdout=subprocess.DEVNULL, env=utils.get_kernel_env())
	os.chdir(wd)

def make():
	wd = os.getcwd()
	os.chdir(sf(conf.linux_sources))
	if conf.kernel_make_output:
		subprocess.call(['make'] + conf.linux_make_args,
				env=utils.get_kernel_env())
	else:
		subprocess.call(['make'] + conf.linux_make_args,
				stdout=subprocess.DEVNULL, env=utils.get_kernel_env())
	os.chdir(wd)