summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--z-distfiles/scripts-gw/kernel-recompile50
1 files changed, 50 insertions, 0 deletions
diff --git a/z-distfiles/scripts-gw/kernel-recompile b/z-distfiles/scripts-gw/kernel-recompile
new file mode 100644
index 0000000..65632f9
--- /dev/null
+++ b/z-distfiles/scripts-gw/kernel-recompile
@@ -0,0 +1,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!'