From ff30f2571851c175e213b5189e96dc7780bacd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 24 Mar 2015 00:31:22 +0100 Subject: [PATCH] lorax: preliminary EFI support --- .../templates/config_files/x86/grub2-efi.cfg | 15 ++++---- .../templates/config_files/x86/xen-efi.cfg | 7 ++++ lorax-templates-qubes/templates/efi.tmpl | 22 ++++++++---- lorax-templates-qubes/templates/x86.tmpl | 34 +++++++++---------- 4 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 lorax-templates-qubes/templates/config_files/x86/xen-efi.cfg diff --git a/lorax-templates-qubes/templates/config_files/x86/grub2-efi.cfg b/lorax-templates-qubes/templates/config_files/x86/grub2-efi.cfg index f21d085..71215c8 100644 --- a/lorax-templates-qubes/templates/config_files/x86/grub2-efi.cfg +++ b/lorax-templates-qubes/templates/config_files/x86/grub2-efi.cfg @@ -13,19 +13,18 @@ set gfxpayload=keep insmod gzio insmod part_gpt insmod ext2 +insmod chain set timeout=5 ### END /etc/grub.d/00_header ### search --no-floppy --set=root -l '@ISOLABEL@' -### BEGIN /etc/grub.d/10_linux ### -menuentry '@PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { - linuxefi @KERNELPATH@ @ROOT@ - initrdefi @INITRDPATH@ -} -menuentry 'Test this media & start @PRODUCT@' --class fedora --class gnu-linux --class gnu --class os { - linuxefi @KERNELPATH@ @ROOT@ quiet rd.live.check - initrdefi @INITRDPATH@ +menuentry 'Test media and install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { + chainloader @EFIDIR@/xen-check.efi +} + +menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { + chainloader @EFIDIR@/xen.efi } diff --git a/lorax-templates-qubes/templates/config_files/x86/xen-efi.cfg b/lorax-templates-qubes/templates/config_files/x86/xen-efi.cfg new file mode 100644 index 0000000..8008dca --- /dev/null +++ b/lorax-templates-qubes/templates/config_files/x86/xen-efi.cfg @@ -0,0 +1,7 @@ +[global] +default=qubes + +[qubes] +options=loglvl=all +kernel=vmlinuz @ROOT@ rd.live.check +ramdisk=initrd.img diff --git a/lorax-templates-qubes/templates/efi.tmpl b/lorax-templates-qubes/templates/efi.tmpl index dee095f..119b030 100644 --- a/lorax-templates-qubes/templates/efi.tmpl +++ b/lorax-templates-qubes/templates/efi.tmpl @@ -1,5 +1,6 @@ <%page args="configdir, KERNELDIR, efiarch, isolabel"/> <% +from string import lower EFIBOOTDIR="EFI/BOOT" APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" @@ -8,12 +9,14 @@ APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" mkdir ${EFIBOOTDIR} mkdir ${EFIBOOTDIR}/fonts/ install boot/efi/EFI/*/shim.efi ${EFIBOOTDIR}/BOOT${efiarch}.efi +install boot/efi/EFI/*/xen*.efi ${EFIBOOTDIR}/xen-check.efi +install boot/efi/EFI/*/xen*.efi ${EFIBOOTDIR}/xen.efi install boot/efi/EFI/*/MokManager.efi ${EFIBOOTDIR}/ -install boot/efi/EFI/*/gcdx64.efi ${EFIBOOTDIR}/grubx64.efi +install boot/efi/EFI/*/gcd${efiarch|lower}.efi ${EFIBOOTDIR}/grub${efiarch|lower}.efi install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/ ## actually make the EFI images -${make_efiboot("images/efiboot.img")} +${make_efiboot("images/efiboot.img", include_kernel=True)} %if domacboot: ${make_efiboot("images/macboot.img", imgtype="apple")} %endif @@ -23,7 +26,9 @@ ${make_efiboot("images/efiboot.img")} <% kdir = EFIBOOTDIR if include_kernel else KERNELDIR eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) - args = "--label=ANACONDA" + xenconf = "%s/xen-check.cfg" % (EFIBOOTDIR, ) + xenconf_no_check = "%s/xen.cfg" % (EFIBOOTDIR, ) + args = "--label=ANACONDA --debug" if disk: args += " --disk" if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version) %> @@ -32,23 +37,26 @@ ${make_efiboot("images/efiboot.img")} copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} %endif install ${configdir}/grub2-efi.cfg ${eficonf} + install ${configdir}/xen-efi.cfg ${xenconf} replace @PRODUCT@ '${product.name}' ${eficonf} replace @VERSION@ ${product.version} ${eficonf} replace @KERNELNAME@ vmlinuz ${eficonf} replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} + replace @KERNELPATH@ /${kdir}/vmlinuz ${xenconf} replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} + replace @EFIDIR@ /${EFIBOOTDIR} ${eficonf} replace @ISOLABEL@ '${isolabel}' ${eficonf} %if disk: replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf} + replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${xenconf} %else: replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf} + replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${xenconf} %endif + copy ${xenconf} ${xenconf_no_check} + replace rd.live.check '' ${xenconf_no_check} %if efiarch == 'IA32': copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf %endif runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} - %if include_kernel: - remove ${EFIBOOTDIR}/vmlinuz - remove ${EFIBOOTDIR}/initrd.img - %endif diff --git a/lorax-templates-qubes/templates/x86.tmpl b/lorax-templates-qubes/templates/x86.tmpl index 8b71de4..a9ed9f9 100644 --- a/lorax-templates-qubes/templates/x86.tmpl +++ b/lorax-templates-qubes/templates/x86.tmpl @@ -90,23 +90,23 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR} %endif %endif -## ## WHeeeeeeee, EFI. -## ## We could remove the basearch restriction someday.. -## <% efiargs=""; efigraft=""; efihybrid="" %> -## %if exists("boot/efi/EFI/fedora/gcdx64.efi") and basearch != 'i386': -## <% -## efiarch = 'X64' if basearch=='x86_64' else 'IA32' -## efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) -## images = ["images/efiboot.img"] -## if domacboot: -## images.append("images/macboot.img") -## for img in images: -## efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) -## efigraft += " {0}={1}/{0}".format(img,outroot) -## efihybrid = "--uefi --mac" if domacboot else "--uefi" -## %> -## <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> -## %endif +## WHeeeeeeee, EFI. +## We could remove the basearch restriction someday.. +<% efiargs=""; efigraft=""; efihybrid="" %> +%if exists("boot/efi/EFI/*/gcdx64.efi") and basearch != 'i386': + <% + efiarch = 'X64' if basearch=='x86_64' else 'IA32' + efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) + images = ["images/efiboot.img"] + if domacboot: + images.append("images/macboot.img") + for img in images: + efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) + efigraft += " {0}={1}/{0}".format(img,outroot) + efihybrid = "--uefi --mac" if domacboot else "--uefi" + %> + <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> +%endif ## ## make boot.iso ## runcmd mkisofs -o ${outroot}/images/boot.iso \