efi.tmpl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel, extra_boot_args"/>
  2. <%
  3. EFIBOOTDIR="EFI/BOOT"
  4. APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns"
  5. APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol"
  6. %>
  7. mkdir ${EFIBOOTDIR}
  8. mkdir ${EFIBOOTDIR}/fonts/
  9. %if efiarch64:
  10. install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI
  11. install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/
  12. install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi
  13. %endif
  14. %if efiarch32:
  15. install boot/efi/EFI/*/shim${efiarch32|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch32}.EFI
  16. install boot/efi/EFI/*/mm${efiarch32|lower}.efi ${EFIBOOTDIR}/
  17. install boot/efi/EFI/*/gcd${efiarch32|lower}.efi ${EFIBOOTDIR}/grub${efiarch32|lower}.efi
  18. %endif
  19. install boot/grub2/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/
  20. ## Change files permission under ${EFIBOOTDIR}, OL bug 28945615
  21. chmod ${EFIBOOTDIR}/*.EFI 555
  22. chmod ${EFIBOOTDIR}/*.efi 555
  23. chmod ${EFIBOOTDIR}/fonts/ 555
  24. chmod ${EFIBOOTDIR}/fonts/unicode.pf2 555
  25. ## actually make the EFI images
  26. ${make_efiboot("images/efiboot.img")}
  27. %if domacboot:
  28. ${make_efiboot("images/macboot.img", imgtype="apple")}
  29. %endif
  30. ## This is kinda gross, but then... so's EFI.
  31. <%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')">
  32. <%
  33. kdir = EFIBOOTDIR if include_kernel else KERNELDIR
  34. eficonf = "%s/grub.cfg" % (EFIBOOTDIR, )
  35. args = "--label=ANACONDA"
  36. if disk: args += " --disk"
  37. if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version)
  38. %>
  39. %if include_kernel:
  40. copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR}
  41. copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR}
  42. %endif
  43. install ${configdir}/grub2-efi.cfg ${eficonf}
  44. replace @PRODUCT@ '${product.name}' ${eficonf}
  45. replace @VERSION@ ${product.version} ${eficonf}
  46. replace @KERNELNAME@ vmlinuz ${eficonf}
  47. replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf}
  48. replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf}
  49. replace @ISOLABEL@ '${isolabel}' ${eficonf}
  50. replace @EXTRA@ '${extra_boot_args}' ${eficonf}
  51. %if disk:
  52. replace @ROOT@ root=live:LABEL=ANACONDA ${eficonf}
  53. %else:
  54. replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${eficonf}
  55. %endif
  56. %if efiarch32 == 'IA32':
  57. copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf
  58. %endif
  59. runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img}
  60. %if include_kernel:
  61. remove ${EFIBOOTDIR}/vmlinuz
  62. remove ${EFIBOOTDIR}/initrd.img
  63. %endif
  64. </%def>