2019-06-18 18:33:05 +00:00
|
|
|
<%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel, extra_boot_args"/>
|
2012-07-27 14:45:57 +00:00
|
|
|
<%
|
2014-10-14 21:11:27 +00:00
|
|
|
from string import lower
|
2012-07-27 14:45:57 +00:00
|
|
|
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}
|
2012-08-21 23:19:45 +00:00
|
|
|
mkdir ${EFIBOOTDIR}/fonts/
|
2014-02-28 16:02:18 +00:00
|
|
|
%if exists("usr/share/shim/lockdown.efi"):
|
2015-04-13 17:30:24 +00:00
|
|
|
install usr/share/shim/lockdown.efi ${EFIBOOTDIR}/
|
|
|
|
%endif
|
2017-06-05 20:14:38 +00:00
|
|
|
%if efiarch64:
|
2015-04-13 17:30:24 +00:00
|
|
|
install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI
|
|
|
|
install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/
|
|
|
|
install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi
|
|
|
|
%endif
|
|
|
|
%if efiarch32:
|
|
|
|
install boot/efi/EFI/*/shim${efiarch32|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch32}.EFI
|
|
|
|
install boot/efi/EFI/*/mm${efiarch32|lower}.efi ${EFIBOOTDIR}/
|
|
|
|
install boot/efi/EFI/*/gcd${efiarch32|lower}.efi ${EFIBOOTDIR}/grub${efiarch32|lower}.efi
|
2014-02-28 16:02:18 +00:00
|
|
|
%endif
|
2015-04-13 17:30:24 +00:00
|
|
|
install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/
|
2012-07-27 14:45:57 +00:00
|
|
|
|
|
|
|
## actually make the EFI images
|
|
|
|
${make_efiboot("images/efiboot.img")}
|
|
|
|
%if domacboot:
|
|
|
|
${make_efiboot("images/macboot.img", imgtype="apple")}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
## 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
|
2012-08-21 23:19:45 +00:00
|
|
|
eficonf = "%s/grub.cfg" % (EFIBOOTDIR, )
|
2012-07-27 14:45:57 +00:00
|
|
|
args = "--label=ANACONDA"
|
|
|
|
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}
|
|
|
|
copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR}
|
|
|
|
%endif
|
2014-02-28 16:02:18 +00:00
|
|
|
%if exists("usr/share/shim/lockdown.efi"):
|
|
|
|
install ${configdir}/grub2-efi-lockdown.cfg ${eficonf}
|
|
|
|
%else:
|
|
|
|
install ${configdir}/grub2-efi.cfg ${eficonf}
|
|
|
|
%endif
|
2012-07-27 14:45:57 +00:00
|
|
|
replace @PRODUCT@ '${product.name}' ${eficonf}
|
|
|
|
replace @VERSION@ ${product.version} ${eficonf}
|
2012-08-21 23:19:45 +00:00
|
|
|
replace @KERNELNAME@ vmlinuz ${eficonf}
|
2012-07-27 14:45:57 +00:00
|
|
|
replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf}
|
|
|
|
replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf}
|
2012-08-21 23:19:45 +00:00
|
|
|
replace @ISOLABEL@ '${isolabel}' ${eficonf}
|
2019-06-18 18:33:05 +00:00
|
|
|
replace @EXTRA@ '${extra_boot_args}' ${eficonf}
|
2012-07-27 14:45:57 +00:00
|
|
|
%if disk:
|
2012-09-13 23:07:24 +00:00
|
|
|
replace @ROOT@ root=live:LABEL=ANACONDA ${eficonf}
|
2012-07-27 14:45:57 +00:00
|
|
|
%else:
|
2012-09-13 23:07:24 +00:00
|
|
|
replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${eficonf}
|
2012-07-27 14:45:57 +00:00
|
|
|
%endif
|
|
|
|
runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img}
|
|
|
|
%if include_kernel:
|
|
|
|
remove ${EFIBOOTDIR}/vmlinuz
|
|
|
|
remove ${EFIBOOTDIR}/initrd.img
|
|
|
|
%endif
|
|
|
|
</%def>
|