aboutsummaryrefslogtreecommitdiff
path: root/scripts/kernel.py
blob: 76255d0cbc46f49a24a4ff74aeba6c0641770f99 (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
import os
import sys
import subprocess

from conf import conf
import utils
from exceptions import KernelConfigFailed

def config():
	# Executing old linux config
	env = dict(os.environ)
	wd = os.getcwd()
	os.chdir(conf.linux_sources)
	sprc = subprocess.Popen(['make', 'oldconfig'], stdout=subprocess.PIPE, env=utils.get_kernel_env())
	while True:
		line = sprc.stdout.readline()
		if line != '':
			if b'Restart config' in line:
				sprc.terminate()
				raise KernelConfigFailed()
				break
			else:
				if conf.kernel_config_output:
					print(line.decode('utf-8'), end="")
		else:
			break
	os.chdir(wd)

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