2019-03-28 15:34:30 +00:00
|
|
|
<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot"/>
|
2011-05-09 14:47:25 +00:00
|
|
|
<%
|
2011-10-21 20:12:12 +00:00
|
|
|
configdir="tmp/config_files/s390"
|
2011-05-09 14:47:25 +00:00
|
|
|
BOOTDIR="images"
|
|
|
|
KERNELDIR=BOOTDIR
|
|
|
|
INITRD_ADDRESS="0x02000000"
|
2015-04-29 14:35:41 +00:00
|
|
|
LORAXDIR="usr/share/lorax/"
|
2011-05-09 14:47:25 +00:00
|
|
|
# The assumption seems to be that there is only one s390 kernel, ever
|
|
|
|
kernel = kernels[0]
|
2017-03-09 19:08:19 +00:00
|
|
|
|
2019-03-28 15:34:30 +00:00
|
|
|
import os
|
2017-03-09 19:08:19 +00:00
|
|
|
from os.path import basename
|
2019-03-28 15:34:30 +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 = ""
|
2011-05-09 14:47:25 +00:00
|
|
|
%>
|
|
|
|
|
2011-06-23 00:22:24 +00:00
|
|
|
mkdir images
|
2011-06-23 14:46:28 +00:00
|
|
|
install ${runtime_img} images
|
2012-02-09 15:59:15 +00:00
|
|
|
treeinfo stage2 mainimage images/${runtime_base}
|
2011-06-23 00:22:24 +00:00
|
|
|
|
2011-10-21 20:12:12 +00:00
|
|
|
## install bootloader (such as it is) and bootloader config
|
2011-08-09 00:35:35 +00:00
|
|
|
install ${configdir}/redhat.exec ${BOOTDIR}
|
|
|
|
install ${configdir}/generic.prm ${BOOTDIR}
|
2014-08-21 07:53:14 +00:00
|
|
|
install ${configdir}/genericdvd.prm ${BOOTDIR}
|
2017-08-14 21:03:41 +00:00
|
|
|
install ${configdir}/cdboot.prm ${BOOTDIR}
|
2011-08-09 00:35:35 +00:00
|
|
|
install ${configdir}/generic.ins .
|
2011-05-09 14:47:25 +00:00
|
|
|
|
2011-10-21 20:12:12 +00:00
|
|
|
## configure bootloader
|
2011-05-09 14:47:25 +00:00
|
|
|
replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins
|
|
|
|
|
2011-10-21 20:12:12 +00:00
|
|
|
## install kernel
|
2011-05-09 14:47:25 +00:00
|
|
|
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
|
|
|
|
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
2011-10-21 20:12:12 +00:00
|
|
|
|
|
|
|
## s390 needs some extra boot config
|
2012-02-07 17:46:30 +00:00
|
|
|
createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
|
2011-10-21 20:12:12 +00:00
|
|
|
|
|
|
|
## s390 also has some special treeinfo data
|
2012-02-07 17:46:30 +00:00
|
|
|
treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize
|
2011-05-09 14:47:25 +00:00
|
|
|
treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm
|
2014-08-21 07:53:14 +00:00
|
|
|
treeinfo images-${basearch} genericdvd.prm ${BOOTDIR}/genericdvd.prm
|
2011-05-09 14:47:25 +00:00
|
|
|
treeinfo images-${basearch} generic.ins generic.ins
|
2018-06-21 15:24:31 +00:00
|
|
|
treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec
|
2015-04-29 14:35:41 +00:00
|
|
|
|
2017-09-27 16:50:11 +00:00
|
|
|
# Create optional product.img and updates.img in /images/
|
2017-03-09 19:08:19 +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
|
2015-04-29 14:35:41 +00:00
|
|
|
%endif
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
# Inherit iso-graft/ if it exists from external templates
|
|
|
|
<%
|
|
|
|
import os
|
|
|
|
if os.path.exists(workdir + "/iso-graft"):
|
2017-03-09 19:08:19 +00:00
|
|
|
filegraft += " " + workdir + "/iso-graft"
|
2015-04-29 14:35:41 +00:00
|
|
|
%>
|
2017-03-09 19:08:19 +00:00
|
|
|
|
|
|
|
# Add the license files
|
2021-01-18 00:58:01 +00:00
|
|
|
%for f in glob("usr/share/licenses/*-release-common/*"):
|
2017-03-09 19:08:19 +00:00
|
|
|
install ${f} ${f|basename}
|
|
|
|
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
|
|
|
%endfor
|
2017-08-14 21:03:41 +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
|
2019-03-28 15:34:30 +00:00
|
|
|
runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
2017-08-14 21:03:41 +00:00
|
|
|
-b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \
|
2017-08-18 17:19:28 +00:00
|
|
|
-boot-load-size 4 -no-emul-boot \
|
2018-04-26 16:52:07 +00:00
|
|
|
-R -J -V '${isolabel}' -graft-points \
|
2019-01-24 00:52:51 +00:00
|
|
|
.discinfo=${outroot}/.discinfo \
|
2020-06-09 15:50:42 +00:00
|
|
|
generic.ins=${outroot}/generic.ins \
|
2017-08-14 21:03:41 +00:00
|
|
|
${BOOTDIR}=${outroot}/${BOOTDIR} \
|
2017-09-27 12:18:24 +00:00
|
|
|
${filegraft}
|
2017-08-14 21:03:41 +00:00
|
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|