2019-03-14 16:45:40 +00:00
|
|
|
<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel, extra_boot_args"/>
|
2017-05-22 17:10:59 +00:00
|
|
|
<%
|
|
|
|
configdir="tmp/config_files/aarch64"
|
|
|
|
PXEBOOTDIR="images/pxeboot"
|
|
|
|
KERNELDIR=PXEBOOTDIR
|
|
|
|
LIVEDIR="LiveOS"
|
|
|
|
LORAXDIR="usr/share/lorax/"
|
|
|
|
|
|
|
|
## 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)
|
|
|
|
|
2019-03-28 15:34:30 +00:00
|
|
|
import os
|
2017-05-22 17:10:59 +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 = ""
|
2017-05-22 17:10:59 +00:00
|
|
|
%>
|
|
|
|
|
|
|
|
mkdir ${LIVEDIR}
|
|
|
|
install ${runtime_img} ${LIVEDIR}/squashfs.img
|
|
|
|
treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img
|
|
|
|
|
|
|
|
## install kernels
|
|
|
|
mkdir ${KERNELDIR}
|
|
|
|
%for kernel in kernels:
|
|
|
|
## normal aarch64
|
|
|
|
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
|
|
|
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
#FIXME: this will need adjusted when we have a real bootloader.
|
|
|
|
## WHeeeeeeee, EFI.
|
|
|
|
## We could remove the basearch restriction someday..
|
|
|
|
<% efiargs=""; efigraft="" %>
|
|
|
|
%if exists("boot/efi/EFI/*/gcdaa64.efi"):
|
|
|
|
<%
|
2017-08-22 15:16:39 +00:00
|
|
|
efiarch32 = None
|
|
|
|
efiarch64 = 'AA64'
|
2017-05-22 17:10:59 +00:00
|
|
|
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
|
2019-03-14 16:45:40 +00:00
|
|
|
<%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel, extra_boot_args=extra_boot_args"/>
|
2017-05-22 17:10:59 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Add the license files
|
2021-01-18 00:58:01 +00:00
|
|
|
%for f in glob("usr/share/licenses/*-release-common/*"):
|
2017-05-22 17:10:59 +00:00
|
|
|
install ${f} ${f|basename}
|
|
|
|
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
|
|
|
%endfor
|
|
|
|
|
|
|
|
%if exists("boot/efi/EFI/*/gcdaa64.efi"):
|
|
|
|
## make boot.iso
|
2019-03-28 15:34:30 +00:00
|
|
|
runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
2018-04-26 16:52:07 +00:00
|
|
|
${efiargs} -R -J -V '${isolabel}' \
|
2017-05-22 17:10:59 +00:00
|
|
|
-graft-points \
|
|
|
|
${KERNELDIR}=${outroot}/${KERNELDIR} \
|
|
|
|
${LIVEDIR}=${outroot}/${LIVEDIR} \
|
|
|
|
${efigraft} ${filegraft}
|
|
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|
|
|
|
%endif
|