s390.tmpl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot"/>
  2. <%
  3. configdir="tmp/config_files/s390"
  4. BOOTDIR="images"
  5. KERNELDIR=BOOTDIR
  6. INITRD_ADDRESS="0x02000000"
  7. LORAXDIR="usr/share/lorax/"
  8. MKS390IMAGE="/usr/bin/mk-s390image"
  9. # The assumption seems to be that there is only one s390 kernel, ever
  10. kernel = kernels[0]
  11. import os
  12. from os.path import basename
  13. from pylorax.sysutils import joinpaths
  14. # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
  15. if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
  16. isoargs = "-iso-level 3"
  17. else:
  18. isoargs = ""
  19. %>
  20. mkdir images
  21. install ${runtime_img} images
  22. treeinfo stage2 mainimage images/${runtime_base}
  23. ## install bootloader (such as it is) and bootloader config
  24. install ${configdir}/redhat.exec ${BOOTDIR}
  25. install ${configdir}/generic.prm ${BOOTDIR}
  26. install ${configdir}/genericdvd.prm ${BOOTDIR}
  27. install ${configdir}/cdboot.prm ${BOOTDIR}
  28. install ${configdir}/generic.ins .
  29. ## configure bootloader
  30. replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins
  31. replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/cdboot.prm
  32. ## install kernel
  33. installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
  34. installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
  35. ## s390 needs some extra boot config
  36. createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
  37. ## s390 also has some special treeinfo data
  38. treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize
  39. treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm
  40. treeinfo images-${basearch} genericdvd.prm ${BOOTDIR}/genericdvd.prm
  41. treeinfo images-${basearch} generic.ins generic.ins
  42. treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec
  43. # Create optional product.img and updates.img in /images/
  44. <% filegraft=""; images=["product", "updates"] %>
  45. %for img in images:
  46. %if exists("%s/%s/" % (LORAXDIR, img)):
  47. installimg ${LORAXDIR}/${img}/ images/${img}.img
  48. treeinfo images-${basearch} ${img}.img images/${img}.img
  49. %endif
  50. %endfor
  51. # Inherit iso-graft/ if it exists from external templates
  52. <%
  53. import os
  54. if os.path.exists(workdir + "/iso-graft"):
  55. filegraft += " " + workdir + "/iso-graft"
  56. %>
  57. # Add the license files
  58. %for f in glob("/usr/share/licenses/*-release/*"):
  59. install ${f} ${f|basename}
  60. <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
  61. %endfor
  62. ## Make a combined kernel+initrd image for the iso
  63. runcmd ${MKS390IMAGE} ${outroot}/${KERNELDIR}/kernel.img \
  64. ${outroot}/${BOOTDIR}/cdboot.img \
  65. -r ${outroot}/${KERNELDIR}/initrd.img \
  66. -p ${outroot}/${BOOTDIR}/cdboot.prm
  67. ## make boot.iso
  68. runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
  69. -b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \
  70. -boot-load-size 4 -no-emul-boot \
  71. -R -J -V '${isolabel}' -graft-points \
  72. .discinfo=${outroot}/.discinfo \
  73. generic.ins=${outroot}/generic.ins \
  74. ${BOOTDIR}=${outroot}/${BOOTDIR} \
  75. ${filegraft}
  76. treeinfo images-${basearch} boot.iso images/boot.iso