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

import utils
from conf import conf


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:
				print("Kernel config failed")
				sprc.terminate()
				break
			else:
				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)