arm.tmpl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, arch"/>
  2. <%
  3. configdir="tmp/config_files/uboot"
  4. PXEBOOTDIR="images/pxeboot"
  5. DTBDIR="images/pxeboot/dtb"
  6. BOOTDIR="boot"
  7. KERNELDIR=PXEBOOTDIR
  8. STAGE2IMG="images/install.img"
  9. LORAXDIR="usr/share/lorax/"
  10. # keep a comma-delimited list of platforms installed to add to .treeinfo
  11. platforms = ""
  12. delimiter = ''
  13. import os
  14. from os.path import basename
  15. from pylorax.sysutils import joinpaths
  16. # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
  17. if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
  18. isoargs = "-iso-level 3"
  19. else:
  20. isoargs = ""
  21. %>
  22. mkdir images
  23. install ${runtime_img} ${STAGE2IMG}
  24. treeinfo stage2 mainimage ${STAGE2IMG}
  25. mkdir ${DTBDIR}
  26. install boot/dtb-*/*dtb ${DTBDIR}/
  27. ## install kernels
  28. mkdir ${KERNELDIR}
  29. %for kernel in kernels:
  30. %if kernel.flavor:
  31. installkernel images-${kernel.flavor}-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
  32. installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
  33. <%
  34. platforms = platforms + delimiter + kernel.flavor
  35. delimiter = ','
  36. %>
  37. %else:
  38. installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
  39. installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
  40. %endif
  41. %endfor
  42. <% efiargs=""; efigraft="" %>
  43. %if exists("boot/efi/EFI/*/gcdaa64.efi"):
  44. <%
  45. efiarch32 = ARM
  46. efiarch64 = None
  47. efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
  48. images = ["images/efiboot.img"]
  49. %>
  50. %for img in images:
  51. <%
  52. efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
  53. efigraft += " {0}={1}/{0}".format(img,outroot)
  54. %>
  55. treeinfo images-${basearch} ${img|basename} ${img}
  56. %endfor
  57. <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/>
  58. %endif
  59. # add platform to treeinfo for Beaker support
  60. treeinfo ${basearch} platforms ${platforms}
  61. # Create optional product.img and updates.img
  62. <% filegraft=""; images=["product", "updates"] %>
  63. %for img in images:
  64. %if exists("%s/%s/" % (LORAXDIR, img)):
  65. installimg --xz -9 --memlimit-compress=3700MiB ${LORAXDIR}/${img}/ images/${img}.img
  66. treeinfo images-${basearch} ${img}.img images/${img}.img
  67. <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
  68. %endif
  69. %endfor
  70. # Inherit iso-graft/ if it exists from external templates
  71. <%
  72. import os
  73. if os.path.exists(workdir + "/iso-graft"):
  74. filegraft += " " + workdir + "/iso-graft"
  75. %>
  76. # Add the license files
  77. %for f in glob("usr/share/licenses/*-release-common/*"):
  78. install ${f} ${f|basename}
  79. <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
  80. %endfor
  81. %if exists("boot/efi/EFI/*/gcdarm.efi"):
  82. ## make boot.iso
  83. runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
  84. ${efiargs} -R -J -V '${isolabel}' \
  85. -graft-points \
  86. .discinfo=${outroot}/.discinfo \
  87. ${KERNELDIR}=${outroot}/${KERNELDIR} \
  88. ${STAGE2IMG}=${outroot}/${STAGE2IMG} \
  89. ${efigraft} ${filegraft}
  90. treeinfo images-${basearch} boot.iso images/boot.iso
  91. %endif