efi.tmpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel"/>
  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 --debug"
  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. %if disk:
  51. replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf}
  52. %else:
  53. replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf}
  54. %endif
  55. %if efiarch32 == 'IA32':
  56. copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf
  57. %endif
  58. runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img}
  59. %if include_kernel:
  60. remove ${EFIBOOTDIR}/vmlinuz
  61. remove ${EFIBOOTDIR}/initrd.img
  62. %endif
  63. </%def>