tools: add tool to generate kernel boot cd image
This commit is contained in:
4
tools/boot-image/grub.cfg
Normal file
4
tools/boot-image/grub.cfg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
menuentry "Socks Kernel" {
|
||||||
|
multiboot /boot/socks_kernel
|
||||||
|
boot
|
||||||
|
}
|
||||||
39
tools/socks.mkrescue
Executable file
39
tools/socks.mkrescue
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# vim: ft=python
|
||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
kernel_src_path = os.path.join('build', 'socks_kernel')
|
||||||
|
grub_cfg_src_path = os.path.join('tools', 'boot-image', 'grub.cfg')
|
||||||
|
iso_build_dir = os.path.join('build', 'socks-kernel.iso-build')
|
||||||
|
iso_path = os.path.join('build', 'socks-kernel.iso')
|
||||||
|
|
||||||
|
|
||||||
|
def in_source_tree():
|
||||||
|
return os.path.isfile('tools/socks.sync')
|
||||||
|
|
||||||
|
|
||||||
|
if not in_source_tree():
|
||||||
|
print('This script must be executed from the root of the Socks source tree')
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
|
if not os.path.isdir('build'):
|
||||||
|
print('Please build the Socks kernel before using this tool')
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
|
if os.path.isdir(iso_build_dir):
|
||||||
|
shutil.rmtree(iso_build_dir)
|
||||||
|
|
||||||
|
os.mkdir(iso_build_dir)
|
||||||
|
|
||||||
|
os.mkdir(os.path.join(iso_build_dir, 'boot'))
|
||||||
|
os.mkdir(os.path.join(iso_build_dir, 'boot', 'grub'))
|
||||||
|
|
||||||
|
shutil.copyfile(kernel_src_path, os.path.join(iso_build_dir, 'boot', 'socks_kernel'))
|
||||||
|
shutil.copyfile(grub_cfg_src_path, os.path.join(iso_build_dir, 'boot', 'grub', 'grub.cfg'))
|
||||||
|
|
||||||
|
subprocess.run(['grub-mkrescue', '-o', iso_path, iso_build_dir])
|
||||||
Reference in New Issue
Block a user