ppc64le.tmpl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel, extra_boot_args"/>
  2. <%
  3. configdir="tmp/config_files/ppc"
  4. BOOTDIR="ppc"
  5. GRUBDIR="boot/grub"
  6. LIVEDIR="LiveOS"
  7. LORAXDIR="usr/share/lorax/"
  8. ## NOTE: yaboot freaks out and stops parsing its config if it sees a '\',
  9. ## so we can't use the udev escape sequences in the root arg.
  10. ## Instead we'll just replace any non-ASCII characters in the isolabel
  11. ## with '_', which means we won't need any udev escapes.
  12. isolabel = ''.join(ch if ch.isalnum() else '_' for ch in isolabel)
  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 ${LIVEDIR}
  23. install ${runtime_img} ${LIVEDIR}/squashfs.img
  24. treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img
  25. ## install the bootloaders
  26. ## ppc/chrp: for normal PPC systems.
  27. ## uses /ppc/bootinfo.txt in the iso root
  28. ## uses /boot/grub/grub.cfg in the iso root
  29. mkdir ${BOOTDIR}
  30. ## boot stuff for normal (CHRP/PREP) PPC systems
  31. install ${configdir}/bootinfo.txt ${BOOTDIR}
  32. mkdir ${GRUBDIR}/powerpc-ieee1275
  33. install /usr/lib/grub/powerpc-ieee1275/core.elf ${GRUBDIR}/powerpc-ieee1275
  34. install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275
  35. install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275
  36. install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg
  37. replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg
  38. replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg
  39. replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${GRUBDIR}/grub.cfg
  40. replace @EXTRA@ '${extra_boot_args}' ${GRUBDIR}/grub.cfg
  41. ## Install kernel and bootloader config (in separate places for each arch)
  42. %for kernel in kernels:
  43. <%
  44. bits = 64
  45. ## separate dirs/images for each arch
  46. KERNELDIR=BOOTDIR+"/ppc%s" % bits
  47. %>
  48. ## install kernel
  49. mkdir ${KERNELDIR}
  50. installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
  51. installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
  52. treeinfo images-${kernel.arch} zimage
  53. %endfor
  54. # Create optional product.img and updates.img
  55. <% filegraft=""; images=["product", "updates"] %>
  56. %for img in images:
  57. %if exists("%s/%s/" % (LORAXDIR, img)):
  58. installimg ${LORAXDIR}/${img}/ images/${img}.img
  59. treeinfo images-${basearch} ${img}.img images/${img}.img
  60. <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
  61. %endif
  62. %endfor
  63. # Add the license files
  64. %for f in glob("/usr/share/licenses/*-release/*"):
  65. install ${f} ${f|basename}
  66. <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
  67. %endfor
  68. ## make boot.iso
  69. runcmd xorrisofs -v -U -J -R ${isoargs} \
  70. -o ${outroot}/images/boot.iso \
  71. -r -l -sysid PPC \
  72. -A "${product.name} ${product.version}" -V '${isolabel}' \
  73. -volset "${product.version}" -volset-size 1 -volset-seqno 1 \
  74. -chrp-boot \
  75. -graft-points \
  76. ${BOOTDIR}=${outroot}/${BOOTDIR} \
  77. ${GRUBDIR}=${outroot}/${GRUBDIR} \
  78. ${LIVEDIR}=${outroot}/${LIVEDIR} ${filegraft}
  79. %for kernel in kernels:
  80. treeinfo images-${kernel.arch} boot.iso images/boot.iso
  81. %endfor