qubes-installer-qubes-os/lorax-templates-qubes/templates/efi.tmpl
2015-09-25 16:25:05 +02:00

58 lines
2.7 KiB
Cheetah

<%page args="configdir, KERNELDIR, efiarch, isolabel, kver"/>
<%
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"
%>
mkdir ${EFIBOOTDIR}
mkdir ${EFIBOOTDIR}/fonts/
install boot/efi/EFI/*/gcd${efiarch|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch}.efi
## keep also under original name to make mkefiboot --apple happy
##install boot/efi/EFI/*/gcd${efiarch|lower}.efi ${EFIBOOTDIR}/grub${efiarch|lower}.efi
install boot/efi/EFI/*/xen*.efi ${EFIBOOTDIR}/xen.efi
install boot/efi/EFI/*/MokManager.efi ${EFIBOOTDIR}/
install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/
## actually make the EFI images
${make_efiboot("images/efiboot.img", include_kernel=True)}
## This is kinda gross, but then... so's EFI.
<%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')">
<%
kdir = EFIBOOTDIR if include_kernel else KERNELDIR
eficonf = "%s/grub.cfg" % (EFIBOOTDIR, )
xenconf = "%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)
%>
%if include_kernel:
copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR}
runcmd chroot ${inroot} dracut --nomdadmconf --nolvmconf --xz --install '/.buildstamp' --add 'anaconda pollcdrom' --omit "network multipath modsign systemd crypt shutdown plymouth fcoe fcoe-uefi nfs iscsi ifcfg" /boot/efi/EFI/qubes/initrd-small.img ${kver}
install boot/efi/EFI/qubes/initrd-small.img ${EFIBOOTDIR}/initrd.img
%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
%if efiarch == 'IA32':
copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf
%endif
runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img}
</%def>