lorax/share/templates.d/99-generic/arm.tmpl
Brian C. Lane 458d120afe Copy .discinfo to the boot.iso
This should close #187
2019-01-29 14:06:28 -08:00

96 lines
3.0 KiB
Cheetah

<%page args="kernels, runtime_img, runtime_base, basearch, outroot, arch"/>
<%
configdir="tmp/config_files/uboot"
PXEBOOTDIR="images/pxeboot"
DTBDIR="images/pxeboot/dtb"
BOOTDIR="boot"
KERNELDIR=PXEBOOTDIR
STAGE2IMG="images/install.img"
LORAXDIR="usr/share/lorax/"
# keep a comma-delimited list of platforms installed to add to .treeinfo
platforms = ""
delimiter = ''
from os.path import basename
%>
mkdir images
install ${runtime_img} ${STAGE2IMG}
treeinfo stage2 mainimage ${STAGE2IMG}
mkdir ${DTBDIR}
install boot/dtb-*/*dtb ${DTBDIR}/
## install kernels
mkdir ${KERNELDIR}
%for kernel in kernels:
%if kernel.flavor:
installkernel images-${kernel.flavor}-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
<%
platforms = platforms + delimiter + kernel.flavor
delimiter = ','
%>
%else:
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
%endif
%endfor
<% efiargs=""; efigraft="" %>
%if exists("boot/efi/EFI/*/gcdaa64.efi"):
<%
efiarch32 = ARM
efiarch64 = None
efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
images = ["images/efiboot.img"]
%>
%for img in images:
<%
efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
efigraft += " {0}={1}/{0}".format(img,outroot)
%>
treeinfo images-${basearch} ${img|basename} ${img}
%endfor
<%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/>
%endif
# add platform to treeinfo for Beaker support
treeinfo ${basearch} platforms ${platforms}
# Create optional product.img and updates.img
<% filegraft=""; images=["product", "updates"] %>
%for img in images:
%if exists("%s/%s/" % (LORAXDIR, img)):
installimg --xz -9 --memlimit-compress=3700MiB ${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
%for f in glob("/usr/share/licenses/*-release/*"):
install ${f} ${f|basename}
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
%endfor
%if exists("boot/efi/EFI/*/gcdarm.efi"):
## make boot.iso
runcmd xorrisofs -o ${outroot}/images/boot.iso \
${efiargs} -R -J -V '${isolabel}' \
-graft-points \
.discinfo=${outroot}/.discinfo \
${KERNELDIR}=${outroot}/${KERNELDIR} \
${STAGE2IMG}=${outroot}/${STAGE2IMG} \
${efigraft} ${filegraft}
treeinfo images-${basearch} boot.iso images/boot.iso
%endif