new commit

This commit is contained in:
Manuel 2025-04-26 10:46:19 +00:00
parent 01db2c70ad
commit c7865546cc

View File

@ -319,41 +319,6 @@ def create_grub_efi_boot(architecture, paths, grub_cfg_template_dir, memtest_wan
grub_platform = "arm64-efi" grub_platform = "arm64-efi"
build_grub_image(architecture, "arm64", "aarch64", grub_platform) build_grub_image(architecture, "arm64", "aarch64", grub_platform)
logger.info("=> Copying EFI boot files from efiboot.img to ISO root...")
efi_boot_dest_in_iso = os.path.join(paths['IMAGEDIR'], 'EFI', 'BOOT')
os.makedirs(efi_boot_dest_in_iso, exist_ok=True)
try:
mount_point = tempfile.mkdtemp(dir=paths['BUILDDIR'], prefix="efi-img-mnt.")
subprocess.run(["mount", "-o", "loop", efi_img_path, mount_point], check=True, text=True)
logger.debug(f" efiboot.img mounted at: {mount_point}")
efi_boot_source_in_img = os.path.join(mount_point, 'EFI', 'BOOT')
if os.path.exists(efi_boot_source_in_img):
for item in os.listdir(efi_boot_source_in_img):
source = os.path.join(efi_boot_source_in_img, item)
destination = os.path.join(efi_boot_dest_in_iso, item)
if os.path.isdir(source):
shutil.copytree(source, destination, dirs_exist_ok=True)
logger.debug(f" Copied EFI directory: {source} to {destination}")
else:
shutil.copy2(source, destination)
logger.debug(f" Copied EFI file: {source} to {destination}")
else:
logger.warning(f" EFI/BOOT directory not found in {efi_boot_source_in_img}")
except subprocess.CalledProcessError as e:
logger.error(f" Error mounting or copying files from efiboot.img: {e}")
except FileNotFoundError as e:
logger.error(f" File not found: {e}")
except Exception as e:
logger.error(f" Unexpected error while copying EFI files: {e}")
finally:
if 'mount_point' in locals():
subprocess.run(["umount", mount_point], check=True, text=True)
os.rmdir(mount_point)
logger.debug(f" efiboot.img unmounted from: {mount_point} and directory removed.")
logger.info("=> GRUB EFI bootloader generated successfully.") logger.info("=> GRUB EFI bootloader generated successfully.")
return grub_dir return grub_dir