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: ...@@ -97,10 +97,12 @@ class IsoBuilder:
).split()) ).split())
def prepare_efi_img(self): def prepare_efi_img(self):
prebootloader_path = "/usr/lib/prebootloader" efitools_path = "/usr/share/efitools/efi/"
assert os.path.isdir(prebootloader_path), "preloader must be installed" assert os.path.isdir(efitools_path), "efitools must be installed"
efi_path = "/usr/lib/syslinux/efi64/" efi_path = "/usr/lib/syslinux/efi64/"
assert os.path.isdir(efi_path), "syslinux must be installed" 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: with open("log", "w") as log:
os.makedirs(pjoin(self.iso_root, "EFI/chakraiso")) os.makedirs(pjoin(self.iso_root, "EFI/chakraiso"))
...@@ -115,21 +117,28 @@ class IsoBuilder: ...@@ -115,21 +117,28 @@ class IsoBuilder:
# copy the initramfs # copy the initramfs
shutil.copy(pjoin(self.outputdir, "chakra/boot/chakraiso.img"), pjoin(efi_root, "EFI/chakraiso/chakraiso.img")) shutil.copy(pjoin(self.outputdir, "chakra/boot/chakraiso.img"), pjoin(efi_root, "EFI/chakraiso/chakraiso.img"))
# copy the kernel # 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")) os.makedirs(pjoin(efi_root, "EFI/boot"))
shutil.copy(pjoin(prebootloader_path, "PreLoader.efi"), pjoin(efi_root, "EFI/boot/BOOTX64.efi")) shutil.copy(pjoin(efi_path, "syslinux.efi"), pjoin(efi_root, "EFI/boot/BOOTX64.efi"))
shutil.copy(pjoin(prebootloader_path, "HashTool.efi"), pjoin(efi_root, "EFI/boot/")) subprocess.check_call(["sbsign {} --key {} --cert {} --output {}"]
shutil.copy(pjoin(efi_path, "syslinux.efi"), pjoin(efi_root, "EFI/boot/loader.efi")) , pjoin(efi_root, "EFI/boot/BOOTX64.efi")
, pjoin(key_path, "microsoft-kekca-public.der")
shutil.copytree(pjoin(self.datadir, "efi/loader"), pjoin(efi_root, "loader")) , pjoin(key_path, "microsoft-uefica-public.crt")
for f in ["chakraiso.conf", "chakraiso-nonfree.conf"]: , pjoin(efi_root, "EFI/boot/BOOTX64.efi"))
with open(pjoin(self.datadir, "efi/loader/entries", f)) as infile: os.makedirs(pjoin(efi_root, "EFI/boot"))
lines = infile.readlines() # shutil.copytree(pjoin(self.datadir, "efi/loader"), pjoin(efi_root, "loader"))
with open(pjoin(efi_root, "loader/entries", f), "w") as outfile: # for f in ["chakraiso.conf", "chakraiso-nonfree.conf"]:
for line in lines: # with open(pjoin(self.datadir, "efi/loader/entries", f)) as infile:
line = re.sub("%CHAKRAISO_LABEL%", self.label, line) # lines = infile.readlines()
outfile.write(line) # 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_v1.efi"), pjoin(efi_root, "EFI/"))
shutil.copy(pjoin(self.datadir, "efi/shellx64_v2.efi"), pjoin(efi_root, "EFI/")) shutil.copy(pjoin(self.datadir, "efi/shellx64_v2.efi"), pjoin(efi_root, "EFI/"))
...@@ -214,7 +223,7 @@ class IsoBuilder: ...@@ -214,7 +223,7 @@ class IsoBuilder:
-boot-info-table -boot-info-table
-isohybrid-mbr {isohdpfx_path} -isohybrid-mbr {isohdpfx_path}
-eltorito-alt-boot -eltorito-alt-boot
-e EFI/chakraiso/chakraiso.img -e EFI/chakraiso/efiboot.img
-no-emul-boot -no-emul-boot
-isohybrid-gpt-basdat -isohybrid-gpt-basdat
-V {label} -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