Commit dc26827c authored by BrLi's avatar BrLi
Browse files

attempt using syslinux directly to boot efi

parent 0ab9fd96
......@@ -97,10 +97,12 @@ class IsoBuilder:
).split())
def prepare_efi_img(self):
prebootloader_path = "/usr/lib/prebootloader"
assert os.path.isdir(prebootloader_path), "preloader must be installed"
efitools_path = "/usr/share/efitools/efi/"
assert os.path.isdir(efitools_path), "efitools must be installed"
efi_path = "/usr/lib/syslinux/efi64/"
assert os.path.isdir(efi_path), "syslinux must be installed"
key_path = "/usr/share/refind/keys/"
assert os.path.isdir(key_path), "refind-efi must be installed"
with open("log", "w") as log:
os.makedirs(pjoin(self.iso_root, "EFI/chakraiso"))
......@@ -115,21 +117,28 @@ class IsoBuilder:
# copy the initramfs
shutil.copy(pjoin(self.outputdir, "chakra/boot/chakraiso.img"), pjoin(efi_root, "EFI/chakraiso/chakraiso.img"))
# copy the kernel
shutil.copy(pjoin(self.outputdir, "chakra/boot/vmlinuz-linux"), pjoin(efi_root, "EFI/chakraiso/chakraiso"))
subprocess.check_call(["sbsign {} --key {} --cert {} --output {}"]
, pjoin(self.outputdir, "chakra/boot/vmlinuz-linux")
, pjoin(key_path, "microsoft-kekca-public.der")
, pjoin(key_path, "microsoft-uefica-public.crt")
, pjoin(self.outputdir, "chakra/boot/vmlinuz-linux"))
os.makedirs(pjoin(efi_root, "EFI/boot"))
shutil.copy(pjoin(prebootloader_path, "PreLoader.efi"), pjoin(efi_root, "EFI/boot/BOOTX64.efi"))
shutil.copy(pjoin(prebootloader_path, "HashTool.efi"), pjoin(efi_root, "EFI/boot/"))
shutil.copy(pjoin(efi_path, "syslinux.efi"), pjoin(efi_root, "EFI/boot/loader.efi"))
shutil.copytree(pjoin(self.datadir, "efi/loader"), pjoin(efi_root, "loader"))
for f in ["chakraiso.conf", "chakraiso-nonfree.conf"]:
with open(pjoin(self.datadir, "efi/loader/entries", f)) as infile:
lines = infile.readlines()
with open(pjoin(efi_root, "loader/entries", f), "w") as outfile:
for line in lines:
line = re.sub("%CHAKRAISO_LABEL%", self.label, line)
outfile.write(line)
shutil.copy(pjoin(efi_path, "syslinux.efi"), pjoin(efi_root, "EFI/boot/BOOTX64.efi"))
subprocess.check_call(["sbsign {} --key {} --cert {} --output {}"]
, pjoin(efi_root, "EFI/boot/BOOTX64.efi")
, pjoin(key_path, "microsoft-kekca-public.der")
, pjoin(key_path, "microsoft-uefica-public.crt")
, pjoin(efi_root, "EFI/boot/BOOTX64.efi"))
os.makedirs(pjoin(efi_root, "EFI/boot"))
# shutil.copytree(pjoin(self.datadir, "efi/loader"), pjoin(efi_root, "loader"))
# for f in ["chakraiso.conf", "chakraiso-nonfree.conf"]:
# with open(pjoin(self.datadir, "efi/loader/entries", f)) as infile:
# lines = infile.readlines()
# with open(pjoin(efi_root, "loader/entries", f), "w") as outfile:
# for line in lines:
# line = re.sub("%CHAKRAISO_LABEL%", self.label, line)
# outfile.write(line)
shutil.copy(pjoin(self.datadir, "efi/shellx64_v1.efi"), pjoin(efi_root, "EFI/"))
shutil.copy(pjoin(self.datadir, "efi/shellx64_v2.efi"), pjoin(efi_root, "EFI/"))
......@@ -214,7 +223,7 @@ class IsoBuilder:
-boot-info-table
-isohybrid-mbr {isohdpfx_path}
-eltorito-alt-boot
-e EFI/chakraiso/chakraiso.img
-e EFI/chakraiso/efiboot.img
-no-emul-boot
-isohybrid-gpt-basdat
-V {label}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment