2024-05-22 22:17:38 +00:00
|
|
|
<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/>
|
2018-06-18 18:56:22 +00:00
|
|
|
<%
|
|
|
|
configdir="tmp/config_files/s390"
|
|
|
|
BOOTDIR="images"
|
|
|
|
KERNELDIR=BOOTDIR
|
|
|
|
INITRD_ADDRESS="0x02000000"
|
|
|
|
LORAXDIR="usr/share/lorax/"
|
2020-10-27 21:03:58 +00:00
|
|
|
MKS390IMAGE="/usr/bin/mk-s390image"
|
2018-06-18 18:56:22 +00:00
|
|
|
# The assumption seems to be that there is only one s390 kernel, ever
|
|
|
|
kernel = kernels[0]
|
|
|
|
|
2024-05-22 22:17:38 +00:00
|
|
|
## Don't allow spaces or escape characters in the iso label
|
|
|
|
def valid_label(ch):
|
|
|
|
return ch.isalnum() or ch == '_'
|
|
|
|
|
|
|
|
isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel)
|
|
|
|
|
2021-10-26 20:50:43 +00:00
|
|
|
import os
|
2018-06-18 18:56:22 +00:00
|
|
|
from os.path import basename
|
2021-10-26 20:50:43 +00:00
|
|
|
from pylorax.sysutils import joinpaths
|
|
|
|
|
|
|
|
# Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
|
|
|
|
if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
|
|
|
|
isoargs = "-iso-level 3"
|
|
|
|
else:
|
|
|
|
isoargs = ""
|
2018-06-18 18:56:22 +00:00
|
|
|
%>
|
|
|
|
|
|
|
|
mkdir images
|
|
|
|
install ${runtime_img} images
|
|
|
|
treeinfo stage2 mainimage images/${runtime_base}
|
|
|
|
|
|
|
|
## install bootloader (such as it is) and bootloader config
|
|
|
|
install ${configdir}/redhat.exec ${BOOTDIR}
|
|
|
|
install ${configdir}/generic.prm ${BOOTDIR}
|
|
|
|
install ${configdir}/genericdvd.prm ${BOOTDIR}
|
|
|
|
install ${configdir}/cdboot.prm ${BOOTDIR}
|
|
|
|
install ${configdir}/generic.ins .
|
|
|
|
|
|
|
|
## configure bootloader
|
|
|
|
replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins
|
2020-10-27 21:03:58 +00:00
|
|
|
replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/cdboot.prm
|
2018-06-18 18:56:22 +00:00
|
|
|
|
|
|
|
## install kernel
|
|
|
|
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
|
|
|
|
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
|
|
|
|
|
|
|
## s390 needs some extra boot config
|
|
|
|
createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
|
|
|
|
|
|
|
|
## s390 also has some special treeinfo data
|
|
|
|
treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize
|
|
|
|
treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm
|
|
|
|
treeinfo images-${basearch} genericdvd.prm ${BOOTDIR}/genericdvd.prm
|
|
|
|
treeinfo images-${basearch} generic.ins generic.ins
|
2021-10-26 20:50:43 +00:00
|
|
|
treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec
|
2018-06-18 18:56:22 +00:00
|
|
|
|
|
|
|
# Create optional product.img and updates.img in /images/
|
|
|
|
<% filegraft=""; images=["product", "updates"] %>
|
|
|
|
%for img in images:
|
|
|
|
%if exists("%s/%s/" % (LORAXDIR, img)):
|
|
|
|
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
|
|
|
treeinfo images-${basearch} ${img}.img images/${img}.img
|
|
|
|
%endif
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
# Inherit iso-graft/ if it exists from external templates
|
|
|
|
<%
|
|
|
|
import os
|
|
|
|
if os.path.exists(workdir + "/iso-graft"):
|
|
|
|
filegraft += " " + workdir + "/iso-graft"
|
|
|
|
%>
|
|
|
|
|
|
|
|
# Add the license files
|
2023-06-09 13:21:30 +00:00
|
|
|
%for f in glob("usr/share/licenses/*-release-common/*"):
|
2018-06-18 18:56:22 +00:00
|
|
|
install ${f} ${f|basename}
|
|
|
|
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
## Make a combined kernel+initrd image for the iso
|
2020-10-27 21:03:58 +00:00
|
|
|
runcmd ${MKS390IMAGE} ${outroot}/${KERNELDIR}/kernel.img \
|
|
|
|
${outroot}/${BOOTDIR}/cdboot.img \
|
2018-06-18 18:56:22 +00:00
|
|
|
-r ${outroot}/${KERNELDIR}/initrd.img \
|
2020-10-27 21:03:58 +00:00
|
|
|
-p ${outroot}/${BOOTDIR}/cdboot.prm
|
2018-06-18 18:56:22 +00:00
|
|
|
|
|
|
|
## make boot.iso
|
2021-10-26 20:50:43 +00:00
|
|
|
runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
2018-06-18 18:56:22 +00:00
|
|
|
-b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \
|
|
|
|
-boot-load-size 4 -no-emul-boot \
|
2021-10-26 20:50:43 +00:00
|
|
|
-R -J -V '${isolabel}' -graft-points \
|
|
|
|
.discinfo=${outroot}/.discinfo \
|
2022-01-25 17:25:39 +00:00
|
|
|
generic.ins=${outroot}/generic.ins \
|
2018-06-18 18:56:22 +00:00
|
|
|
${BOOTDIR}=${outroot}/${BOOTDIR} \
|
|
|
|
${filegraft}
|
|
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|