2019-10-25 15:58:50 +00:00
|
|
|
<%page args="kernels, runtime_img, runtime_base, basearch, outroot, isolabel, extra_boot_args"/>
|
2012-07-27 14:45:57 +00:00
|
|
|
<%
|
|
|
|
configdir="tmp/config_files/s390"
|
|
|
|
BOOTDIR="images"
|
|
|
|
KERNELDIR=BOOTDIR
|
|
|
|
INITRD_ADDRESS="0x02000000"
|
2019-10-25 15:58:50 +00:00
|
|
|
LIVEDIR="LiveOS"
|
2015-04-29 14:35:41 +00:00
|
|
|
LORAXDIR="usr/share/lorax/"
|
2012-07-27 14:45:57 +00:00
|
|
|
# The assumption seems to be that there is only one s390 kernel, ever
|
|
|
|
kernel = kernels[0]
|
2017-03-09 19:18:08 +00:00
|
|
|
|
2019-10-25 15:58:50 +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)
|
|
|
|
|
2017-03-09 19:18:08 +00:00
|
|
|
from os.path import basename
|
2019-10-25 15:58:50 +00:00
|
|
|
import os
|
|
|
|
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 = ""
|
2012-07-27 14:45:57 +00:00
|
|
|
%>
|
|
|
|
|
2019-10-25 15:58:50 +00:00
|
|
|
mkdir ${LIVEDIR}
|
|
|
|
install ${runtime_img} ${LIVEDIR}/squashfs.img
|
|
|
|
treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img
|
2012-07-27 14:45:57 +00:00
|
|
|
|
2019-10-25 15:58:50 +00:00
|
|
|
mkdir ${BOOTDIR}
|
2012-07-27 14:45:57 +00:00
|
|
|
## install bootloader (such as it is) and bootloader config
|
|
|
|
install ${configdir}/redhat.exec ${BOOTDIR}
|
|
|
|
install ${configdir}/generic.prm ${BOOTDIR}
|
2019-10-25 15:58:50 +00:00
|
|
|
install ${configdir}/cdboot.prm ${BOOTDIR}
|
2012-07-27 14:45:57 +00:00
|
|
|
install ${configdir}/generic.ins .
|
|
|
|
|
|
|
|
## configure bootloader
|
|
|
|
replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins
|
2019-05-21 17:08:35 +00:00
|
|
|
replace @EXTRA@ '${extra_boot_args}' ${BOOTDIR}/generic.prm
|
2019-10-25 15:58:50 +00:00
|
|
|
replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/cdboot.prm
|
|
|
|
replace @EXTRA@ '${extra_boot_args}' ${BOOTDIR}/cdboot.prm
|
2012-07-27 14:45:57 +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} generic.ins generic.ins
|
2018-06-21 15:24:31 +00:00
|
|
|
treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec
|
2019-10-25 15:58:50 +00:00
|
|
|
treeinfo images-${basearch} cdboot.prm ${BOOTDIR}/cdboot.prm
|
2015-04-29 14:35:41 +00:00
|
|
|
|
|
|
|
# Create optional product.img and updates.img
|
2017-03-09 19:18:08 +00:00
|
|
|
<% filegraft=""; images=["product", "updates"] %>
|
2015-04-29 14:35:41 +00:00
|
|
|
%for img in images:
|
|
|
|
%if exists("%s/%s/" % (LORAXDIR, img)):
|
|
|
|
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
2016-05-11 00:39:01 +00:00
|
|
|
treeinfo images-${basearch} ${img}.img images/${img}.img
|
2017-03-09 19:18:08 +00:00
|
|
|
<% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
2015-04-29 14:35:41 +00:00
|
|
|
%endif
|
|
|
|
%endfor
|
2017-03-09 19:18:08 +00:00
|
|
|
|
|
|
|
# Add the license files
|
|
|
|
%for f in glob("/usr/share/licenses/*-release/*"):
|
|
|
|
install ${f} ${f|basename}
|
|
|
|
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
|
|
|
%endfor
|
2019-10-25 15:58:50 +00:00
|
|
|
|
|
|
|
## Make a combined kernel+initrd image for the iso
|
|
|
|
runcmd mk-s390-cdboot -i ${outroot}/${KERNELDIR}/kernel.img \
|
|
|
|
-r ${outroot}/${KERNELDIR}/initrd.img \
|
|
|
|
-p ${outroot}/${BOOTDIR}/cdboot.prm \
|
|
|
|
-o ${outroot}/${BOOTDIR}/cdboot.img
|
|
|
|
|
|
|
|
## make boot.iso
|
|
|
|
runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
|
|
|
-b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \
|
|
|
|
-boot-load-size 4 -no-emul-boot \
|
|
|
|
-R -J -V '${isolabel}' -graft-points \
|
|
|
|
${BOOTDIR}=${outroot}/${BOOTDIR} \
|
|
|
|
${LIVEDIR}=${outroot}/${LIVEDIR} \
|
|
|
|
${filegraft}
|
|
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|