summaryrefslogtreecommitdiffstats
path: root/src/utils/boot.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/boot.py')
-rw-r--r--src/utils/boot.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/utils/boot.py b/src/utils/boot.py
index 07a29ba..724fc06 100644
--- a/src/utils/boot.py
+++ b/src/utils/boot.py
@@ -14,6 +14,7 @@ import subprocess
from src.utils.probe import OSFamily, get_os_family, get_linux_distro_id, os_probe
from src.utils.disk import get_partition_device, get_efi_partition
+from src.utils.bios import *
from src.utils.uefi import *
from src.utils.fs import *
@@ -27,7 +28,22 @@ def _boot_bios_linux(disk, part, mountpoint):
if not get_linux_distro_id(mountpoint) == 'ubuntu':
raise NotImplementedError(f'{os_probe(mountpoint)} detected, only Ubuntu is supported for legacy BIOS boot')
- _boot_bios_legacy(disk, part, mountpoint)
+ kernel_path = get_vmlinuz_path(mountpoint)
+ initrd_path = get_initrd_path(mountpoint)
+
+ device = get_partition_device(disk, part)
+ grub_boot_params = get_grub_boot_params(mountpoint, device)
+
+ kexec_cmd = f'kexec -l {kernel_path} --append="{grub_boot_params}" --initrd="{initrd_path}"'
+ kexec_reboot_cmd = 'kexec -e'
+
+ logging.info(f'Booting with: {kexec_cmd}')
+ try:
+ subprocess.run(shlex.split(kexec_cmd), check=True, text=True)
+ subprocess.run(shlex.split(kexec_reboot_cmd), check=True, text=True)
+ except subprocess.CalledProcessError as e:
+ logging.error(f'Error processing kexec: {e}')
+ raise e
def _boot_bios_windows(disk, part, mountpoint):
logging.info(f'Booting Windows system')