ppc64le.tmpl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/>
  2. <%
  3. configdir="tmp/config_files/ppc"
  4. BOOTDIR="ppc"
  5. GRUBDIR="boot/grub"
  6. STAGE2IMG="images/install.img"
  7. LORAXDIR="usr/share/lorax/"
  8. ## Don't allow spaces or escape characters in the iso label
  9. def valid_label(ch):
  10. return ch.isalnum() or ch == '_'
  11. isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel)
  12. import os
  13. from os.path import basename
  14. from pylorax.sysutils import joinpaths
  15. # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
  16. if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
  17. isoargs = "-iso-level 3"
  18. else:
  19. isoargs = ""
  20. %>
  21. mkdir images
  22. install ${runtime_img} ${STAGE2IMG}
  23. treeinfo stage2 mainimage ${STAGE2IMG}
  24. ## install the bootloaders
  25. ## ppc/chrp: for normal PPC systems.
  26. ## uses /ppc/bootinfo.txt in the iso root
  27. ## uses /boot/grub/grub.cfg in the iso root
  28. mkdir ${BOOTDIR}
  29. ## boot stuff for normal (CHRP/PREP) PPC systems
  30. install ${configdir}/bootinfo.txt ${BOOTDIR}
  31. mkdir ${GRUBDIR}/powerpc-ieee1275
  32. install /usr/lib/grub/powerpc-ieee1275/core.elf ${GRUBDIR}/powerpc-ieee1275
  33. install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275
  34. install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275
  35. install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg
  36. replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg
  37. replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg
  38. replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${GRUBDIR}/grub.cfg
  39. ## Install kernel and bootloader config (in separate places for each arch)
  40. %for kernel in kernels:
  41. <%
  42. bits = 64
  43. ## separate dirs/images for each arch
  44. KERNELDIR=BOOTDIR+"/ppc%s" % bits
  45. %>
  46. ## install kernel
  47. mkdir ${KERNELDIR}
  48. installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
  49. installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
  50. treeinfo images-${kernel.arch} zimage
  51. %endfor
  52. # Create optional product.img and updates.img
  53. <% filegraft=""; images=["product", "updates"] %>
  54. %for img in images:
  55. %if exists("%s/%s/" % (LORAXDIR, img)):
  56. installimg ${LORAXDIR}/${img}/ images/${img}.img
  57. treeinfo images-${basearch} ${img}.img images/${img}.img
  58. <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
  59. %endif
  60. %endfor
  61. # Inherit iso-graft/ if it exists from external templates
  62. <%
  63. import os
  64. if os.path.exists(workdir + "/iso-graft"):
  65. filegraft += " " + workdir + "/iso-graft"
  66. %>
  67. # Add the license files
  68. %for f in glob("/usr/share/licenses/*-release/*"):
  69. install ${f} ${f|basename}
  70. <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
  71. %endfor
  72. ## make boot.iso
  73. runcmd xorrisofs -v -U -J -R ${isoargs} \
  74. -o ${outroot}/images/boot.iso \
  75. -r -l -sysid PPC \
  76. -A "${product.name} ${product.version}" -V '${isolabel}' \
  77. -volset "${product.version}" -volset-size 1 -volset-seqno 1 \
  78. -chrp-boot \
  79. -graft-points \
  80. .discinfo=${outroot}/.discinfo \
  81. ${BOOTDIR}=${outroot}/${BOOTDIR} \
  82. ${GRUBDIR}=${outroot}/${GRUBDIR} \
  83. ${STAGE2IMG}=${outroot}/${STAGE2IMG} ${filegraft}
  84. %for kernel in kernels:
  85. treeinfo images-${kernel.arch} boot.iso images/boot.iso
  86. %endfor