2012-06-21 07:31:58 +00:00
|
|
|
<%page args="kernels, runtime_img, runtime_base, basearch, outroot, arch"/>
|
|
|
|
<%
|
|
|
|
configdir="tmp/config_files/uboot"
|
|
|
|
PXEBOOTDIR="images/pxeboot"
|
2013-10-14 22:55:06 +00:00
|
|
|
DTBDIR="images/pxeboot/dtb"
|
2012-06-21 07:31:58 +00:00
|
|
|
BOOTDIR="boot"
|
|
|
|
KERNELDIR=PXEBOOTDIR
|
2015-02-27 20:00:44 +00:00
|
|
|
STAGE2IMG="images/install.img"
|
2014-11-06 17:16:49 +00:00
|
|
|
LORAXDIR="usr/share/lorax/"
|
2012-06-21 07:31:58 +00:00
|
|
|
|
2013-01-26 01:35:24 +00:00
|
|
|
# keep a comma-delimited list of platforms installed to add to .treeinfo
|
|
|
|
platforms = ""
|
|
|
|
delimiter = ''
|
2017-05-31 15:32:34 +00:00
|
|
|
|
|
|
|
from os.path import basename
|
2012-06-21 07:31:58 +00:00
|
|
|
%>
|
|
|
|
|
2018-09-05 23:15:20 +00:00
|
|
|
## Test ${runtime_img} to see if udf is needed
|
|
|
|
<%
|
|
|
|
import os
|
|
|
|
from pylorax.sysutils import joinpaths
|
|
|
|
if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
|
|
|
|
udfargs = "-allow-limited-size"
|
|
|
|
else:
|
|
|
|
udfargs = ""
|
|
|
|
%>
|
|
|
|
|
2015-02-27 20:00:44 +00:00
|
|
|
mkdir images
|
|
|
|
install ${runtime_img} ${STAGE2IMG}
|
|
|
|
treeinfo stage2 mainimage ${STAGE2IMG}
|
2012-06-21 07:31:58 +00:00
|
|
|
|
2013-10-14 22:55:06 +00:00
|
|
|
mkdir ${DTBDIR}
|
|
|
|
install boot/dtb-*/*dtb ${DTBDIR}/
|
|
|
|
|
2012-06-21 07:31:58 +00:00
|
|
|
## 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
|
2013-01-26 01:35:24 +00:00
|
|
|
<%
|
|
|
|
platforms = platforms + delimiter + kernel.flavor
|
|
|
|
delimiter = ','
|
|
|
|
%>
|
2012-06-21 07:31:58 +00:00
|
|
|
%else:
|
|
|
|
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
|
|
|
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
|
|
|
%endif
|
|
|
|
%endfor
|
|
|
|
|
2018-09-05 23:15:20 +00:00
|
|
|
<% 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
|
|
|
|
|
2013-01-26 01:35:24 +00:00
|
|
|
# add platform to treeinfo for Beaker support
|
|
|
|
treeinfo ${basearch} platforms ${platforms}
|
|
|
|
|
2014-11-06 17:16:49 +00:00
|
|
|
# Create optional product.img and updates.img
|
2018-09-05 23:15:20 +00:00
|
|
|
<% filegraft=""; images=["product", "updates"] %>
|
2014-11-06 17:16:49 +00:00
|
|
|
%for img in images:
|
|
|
|
%if exists("%s/%s/" % (LORAXDIR, img)):
|
2016-03-24 16:33:37 +00:00
|
|
|
installimg --xz -9 --memlimit-compress=3700MiB ${LORAXDIR}/${img}/ images/${img}.img
|
2016-05-11 00:39:01 +00:00
|
|
|
treeinfo images-${basearch} ${img}.img images/${img}.img
|
2018-09-05 23:15:20 +00:00
|
|
|
<% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
2014-11-06 17:16:49 +00:00
|
|
|
%endif
|
|
|
|
%endfor
|
2012-06-21 07:31:58 +00:00
|
|
|
|
2018-09-05 23:15:20 +00:00
|
|
|
# Inherit iso-graft/ if it exists from external templates
|
|
|
|
<%
|
|
|
|
import os
|
|
|
|
if os.path.exists(workdir + "/iso-graft"):
|
|
|
|
filegraft += " " + workdir + "/iso-graft"
|
|
|
|
%>
|
|
|
|
|
2017-03-09 19:08:19 +00:00
|
|
|
# Add the license files
|
|
|
|
%for f in glob("/usr/share/licenses/*-release/*"):
|
|
|
|
install ${f} ${f|basename}
|
2018-09-05 23:15:20 +00:00
|
|
|
<% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
2017-03-09 19:08:19 +00:00
|
|
|
%endfor
|
|
|
|
|
2018-09-05 23:15:20 +00:00
|
|
|
%if exists("boot/efi/EFI/*/gcdarm.efi"):
|
|
|
|
## make boot.iso
|
|
|
|
runcmd mkisofs -o ${outroot}/images/boot.iso \
|
|
|
|
${efiargs} -R -J -V '${isolabel}' -T ${udfargs} \
|
|
|
|
-graft-points \
|
|
|
|
${KERNELDIR}=${outroot}/${KERNELDIR} \
|
|
|
|
${STAGE2IMG}=${outroot}/${STAGE2IMG} \
|
|
|
|
${efigraft} ${filegraft}
|
|
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|
|
|
|
%endif
|