aarch64.tmpl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/>
  2. <%
  3. configdir="tmp/config_files/aarch64"
  4. PXEBOOTDIR="images/pxeboot"
  5. KERNELDIR=PXEBOOTDIR
  6. STAGE2IMG="images/install.img"
  7. LORAXDIR="usr/share/lorax/"
  8. import os
  9. from os.path import basename
  10. from pylorax.sysutils import joinpaths
  11. # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
  12. if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
  13. isoargs = "-iso-level 3"
  14. else:
  15. isoargs = ""
  16. %>
  17. mkdir images
  18. install ${runtime_img} ${STAGE2IMG}
  19. treeinfo stage2 mainimage ${STAGE2IMG}
  20. ## install kernels
  21. mkdir ${KERNELDIR}
  22. %for kernel in kernels:
  23. ## normal aarch64
  24. installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
  25. installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
  26. %endfor
  27. #FIXME: this will need adjusted when we have a real bootloader.
  28. ## WHeeeeeeee, EFI.
  29. ## We could remove the basearch restriction someday..
  30. <% efiargs=""; efigraft="" %>
  31. %if exists("boot/efi/EFI/*/gcdaa64.efi"):
  32. <%
  33. efiarch32 = None
  34. efiarch64 = 'AA64'
  35. efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
  36. images = ["images/efiboot.img"]
  37. %>
  38. %for img in images:
  39. <%
  40. efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
  41. efigraft += " {0}={1}/{0}".format(img,outroot)
  42. %>
  43. treeinfo images-${basearch} ${img|basename} ${img}
  44. %endfor
  45. <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/>
  46. %endif
  47. # Create optional product.img and updates.img
  48. <% filegraft=""; images=["product", "updates"] %>
  49. %for img in images:
  50. %if exists("%s/%s/" % (LORAXDIR, img)):
  51. installimg ${LORAXDIR}/${img}/ images/${img}.img
  52. treeinfo images-${basearch} ${img}.img images/${img}.img
  53. <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
  54. %endif
  55. %endfor
  56. # Inherit iso-graft/ if it exists from external templates
  57. <%
  58. import os
  59. if os.path.exists(workdir + "/iso-graft"):
  60. filegraft += " " + workdir + "/iso-graft"
  61. %>
  62. # Add the license files
  63. %for f in glob("/usr/share/licenses/*-release/*"):
  64. install ${f} ${f|basename}
  65. <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
  66. %endfor
  67. %if exists("boot/efi/EFI/*/gcdaa64.efi"):
  68. ## make boot.iso
  69. runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
  70. ${efiargs} -R -J -V '${isolabel}' \
  71. -graft-points \
  72. .discinfo=${outroot}/.discinfo \
  73. ${KERNELDIR}=${outroot}/${KERNELDIR} \
  74. ${STAGE2IMG}=${outroot}/${STAGE2IMG} \
  75. ${efigraft} ${filegraft}
  76. treeinfo images-${basearch} boot.iso images/boot.iso
  77. %endif