-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmakekernel.sh
More file actions
executable file
·31 lines (22 loc) · 847 Bytes
/
Copy pathmakekernel.sh
File metadata and controls
executable file
·31 lines (22 loc) · 847 Bytes
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
#!/usr/bin/env python
import os
from subprocess import check_call
linux_version = "4.6.3"
linux_base = "linux-{}".format(linux_version)
linux_tar = "{}.tar.xz".format(linux_base)
linux_url = "https://cdn.kernel.org/pub/linux/kernel/v4.x/{}".format(linux_tar)
class cd:
"""Context manager for changing the current working directory"""
def __init__(self, newPath):
self.newPath = os.path.expanduser(newPath)
def __enter__(self):
self.savedPath = os.getcwd()
os.chdir(self.newPath)
def __exit__(self, etype, value, traceback):
os.chdir(self.savedPath)
if not os.path.exists(linux_tar):
check_call(["wget", linux_url])
check_call(["tar", "xf", linux_tar])
with cd(linux_base):
check_call(["make", "KCONFIG_ALLCONFIG=../linux-config", "allnoconfig"])
check_call(["make", "-j4"])