summaryrefslogtreecommitdiff
blob: 65632f976064d850092c987270d89b74281664d7 (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
48
49
50
#!/usr/bin/python

import os, sys, shutil

src_d = '/usr/src/linux'

config_d = '/home/wrobel/usr/devel/website/config/kernel/' + os.environ['HOSTNAME']
os.makedirs(config_d)

norm_kernel = '/boot/kernel'
safe_kernel = '/boot/kernel-safe'

norm_sysmap = '/boot/System.map'
safe_sysmap = '/boot/System.map-safe'

os.chdir(src_d)

shutil.copyfile('.config', config_d + '/kernel-config')

os.system('make && make modules_install')

suffix = '-'.join(os.path.basename(os.path.realpath(src_d)).split('-')[1:])

if os.path.exists(safe_kernel):
    safe_kernel_d = os.path.realpath(safe_kernel)
    os.unlink(safe_kernel_d)
    os.unlink(safe_kernel)
    
if os.path.exists(safe_sysmap):
    safe_sysmap_d = os.path.realpath(safe_sysmap)
    os.unlink(safe_sysmap_d)
    os.unlink(safe_sysmap)


norm_kernel_d = os.path.realpath(norm_kernel)
norm_sysmap_d = os.path.realpath(norm_sysmap)

os.symlink(safe_kernel, norm_kernel_d)
os.symlink(safe_sysmap, norm_sysmap_d)

new_kernel_d = 'kernel-' + suffix
new_sysmap_d = 'System.map-' + suffix

shutil.copyfile(src_d + '/arch/i386/boot/bzImage', new_kernel_d)
shutil.copyfile(src_d + '/System.map', new_sysmap_d)

os.symlink(norm_kernel, new_kernel_d)
os.symlink(norm_sysmap, new_sysmap_d)

print 'Do not forget to commit the kernel config changes to your repository with a useful comment!'