2018-06-18 18:56:22 +00:00
|
|
|
<%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/>
|
|
|
|
<%
|
|
|
|
configdir="tmp/config_files/ppc"
|
|
|
|
BOOTDIR="ppc"
|
|
|
|
GRUBDIR="boot/grub"
|
|
|
|
STAGE2IMG="images/install.img"
|
|
|
|
LORAXDIR="usr/share/lorax/"
|
|
|
|
|
2019-11-08 17:59:36 +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)
|
2018-06-18 18:56:22 +00:00
|
|
|
|
2020-10-29 00:00:35 +00:00
|
|
|
import os
|
2018-06-18 18:56:22 +00:00
|
|
|
from os.path import basename
|
2020-10-29 00:00:35 +00:00
|
|
|
from pylorax.sysutils import joinpaths
|
2018-06-18 18:56:22 +00:00
|
|
|
|
2020-10-29 00:00:35 +00:00
|
|
|
# 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} ${STAGE2IMG}
|
|
|
|
treeinfo stage2 mainimage ${STAGE2IMG}
|
|
|
|
|
|
|
|
## install the bootloaders
|
|
|
|
## ppc/chrp: for normal PPC systems.
|
|
|
|
## uses /ppc/bootinfo.txt in the iso root
|
|
|
|
## uses /boot/grub/grub.cfg in the iso root
|
|
|
|
mkdir ${BOOTDIR}
|
|
|
|
## boot stuff for normal (CHRP/PREP) PPC systems
|
|
|
|
install ${configdir}/bootinfo.txt ${BOOTDIR}
|
|
|
|
|
|
|
|
mkdir ${GRUBDIR}/powerpc-ieee1275
|
2022-11-28 23:12:54 +00:00
|
|
|
install /usr/lib/grub/powerpc-ieee1275/core.elf ${GRUBDIR}/powerpc-ieee1275
|
2018-06-18 18:56:22 +00:00
|
|
|
install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275
|
|
|
|
install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275
|
|
|
|
|
|
|
|
install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg
|
|
|
|
replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg
|
|
|
|
replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg
|
2019-11-08 17:56:24 +00:00
|
|
|
replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${GRUBDIR}/grub.cfg
|
2018-06-18 18:56:22 +00:00
|
|
|
|
|
|
|
## Install kernel and bootloader config (in separate places for each arch)
|
|
|
|
%for kernel in kernels:
|
|
|
|
<%
|
|
|
|
bits = 64
|
|
|
|
## separate dirs/images for each arch
|
|
|
|
KERNELDIR=BOOTDIR+"/ppc%s" % bits
|
|
|
|
%>
|
|
|
|
## install kernel
|
|
|
|
mkdir ${KERNELDIR}
|
|
|
|
installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
|
|
|
installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
|
|
|
|
|
|
|
treeinfo images-${kernel.arch} zimage
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
# Create optional product.img and updates.img
|
|
|
|
<% 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
|
|
|
|
<% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
|
|
|
%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 boot.iso
|
2020-10-29 00:00:35 +00:00
|
|
|
runcmd xorrisofs -v -U -J -R ${isoargs} \
|
2018-06-18 18:56:22 +00:00
|
|
|
-o ${outroot}/images/boot.iso \
|
2020-10-29 00:00:35 +00:00
|
|
|
-r -l -sysid PPC \
|
2018-06-18 18:56:22 +00:00
|
|
|
-A "${product.name} ${product.version}" -V '${isolabel}' \
|
|
|
|
-volset "${product.version}" -volset-size 1 -volset-seqno 1 \
|
2020-10-29 00:00:35 +00:00
|
|
|
-chrp-boot \
|
|
|
|
-graft-points \
|
|
|
|
.discinfo=${outroot}/.discinfo \
|
2018-06-18 18:56:22 +00:00
|
|
|
${BOOTDIR}=${outroot}/${BOOTDIR} \
|
|
|
|
${GRUBDIR}=${outroot}/${GRUBDIR} \
|
|
|
|
${STAGE2IMG}=${outroot}/${STAGE2IMG} ${filegraft}
|
|
|
|
|
|
|
|
%for kernel in kernels:
|
|
|
|
treeinfo images-${kernel.arch} boot.iso images/boot.iso
|
|
|
|
%endfor
|