205 lines
8.5 KiB
Diff
205 lines
8.5 KiB
Diff
From e0b31ea90a4af94a73d0bb9498e12caa93d2a524 Mon Sep 17 00:00:00 2001
|
|
From: isoft <wenjuan.qiu@i-soft.com.cn>
|
|
Date: Tue, 1 Nov 2022 09:49:12 +0000
|
|
Subject: [PATCH 2/2] sw64 modify
|
|
|
|
---
|
|
share/templates.d/99-generic/sw64.tmpl | 124 ++++++++----------
|
|
src/pylorax/__init__.py | 2 +-
|
|
src/pylorax/treebuilder.py | 2 +-
|
|
|
|
index 193286c..cea9225 100644
|
|
--- a/share/templates.d/99-generic/sw64.tmpl
|
|
+++ b/share/templates.d/99-generic/sw64.tmpl
|
|
@@ -1,11 +1,10 @@
|
|
<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/>
|
|
<%
|
|
configdir="tmp/config_files/sw64"
|
|
-SYSLINUXDIR="usr/share/syslinux"
|
|
-PXEBOOTDIR="pxeboot"
|
|
STAGE2IMG="isoft/sw64/root-image.fs.sfs"
|
|
-BOOTDIR="isolinux"
|
|
-KERNELDIR=PXEBOOTDIR
|
|
+#BOOTDIR="isolinux"
|
|
+BOOTDIR="boot"
|
|
+ISOLINUXDIR="isolinux"
|
|
LORAXDIR="usr/share/lorax/"
|
|
|
|
## Don't allow spaces or escape characters in the iso label
|
|
@@ -30,80 +29,68 @@ install ${runtime_img} ${STAGE2IMG}
|
|
treeinfo stage2 mainimage isoft/sw64/${runtime_base}
|
|
|
|
## install bootloader and config files
|
|
-mkdir ${BOOTDIR}
|
|
-install ${SYSLINUXDIR}/isolinux.bin ${BOOTDIR}
|
|
-install ${SYSLINUXDIR}/vesamenu.c32 ${BOOTDIR}
|
|
-install ${SYSLINUXDIR}/ldlinux.c32 ${BOOTDIR}
|
|
-install ${SYSLINUXDIR}/libcom32.c32 ${BOOTDIR}
|
|
-install ${SYSLINUXDIR}/libutil.c32 ${BOOTDIR}
|
|
-install ${configdir}/isolinux.cfg ${BOOTDIR}
|
|
-install ${configdir}/boot.msg ${BOOTDIR}
|
|
-install ${configdir}/grub.conf ${BOOTDIR}
|
|
-install usr/share/anaconda/boot/syslinux-splash.png ${BOOTDIR}/splash.png
|
|
-install boot/memtest* ${BOOTDIR}/memtest
|
|
+mkdir ${ISOLINUXDIR}
|
|
+install ${configdir}/isolinux.bin ${ISOLINUXDIR}
|
|
+install ${configdir}/isolinux.cfg ${ISOLINUXDIR}
|
|
+install ${configdir}/boot.msg ${ISOLINUXDIR}
|
|
+install ${configdir}/grub.conf ${ISOLINUXDIR}
|
|
+install usr/share/anaconda/boot/syslinux-splash.png ${ISOLINUXDIR}/splash.png
|
|
|
|
## configure bootloader
|
|
-replace @VERSION@ ${product.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg
|
|
-replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg
|
|
-replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg
|
|
+replace @VERSION@ ${product.version} ${ISOLINUXDIR}/grub.conf ${ISOLINUXDIR}/isolinux.cfg ${ISOLINUXDIR}/*.msg
|
|
+replace @PRODUCT@ '${product.name}' ${ISOLINUXDIR}/grub.conf ${ISOLINUXDIR}/isolinux.cfg ${ISOLINUXDIR}/*.msg
|
|
+replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${ISOLINUXDIR}/isolinux.cfg
|
|
|
|
## install kernels
|
|
-mkdir ${KERNELDIR}
|
|
+mkdir ${BOOTDIR}
|
|
+mkdir ${BOOTDIR}/grub
|
|
+mkdir ${BOOTDIR}/grub/fonts
|
|
+mkdir ${BOOTDIR}/grub/locale
|
|
+install ${configdir}/boot/bootloader.bin ${BOOTDIR}
|
|
+install ${configdir}/boot/grub/grub.cfg ${BOOTDIR}/grub/
|
|
+install ${configdir}/boot/grub/grub.efi ${BOOTDIR}/grub/
|
|
+install ${configdir}/boot/grub/kernel.* ${BOOTDIR}/grub/
|
|
+install ${configdir}/boot/grub/splash.xpm.gz ${BOOTDIR}/grub/
|
|
+install ${configdir}/boot/grub/fonts/unicode.pf2 ${BOOTDIR}/grub/fonts/
|
|
+install ${configdir}/boot/grub/locale/zh_CN.mo ${BOOTDIR}/grub/locale/
|
|
+
|
|
%for kernel in kernels:
|
|
%if kernel.flavor:
|
|
## i386 PAE
|
|
- installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
|
|
- installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
|
|
+ installkernel images-xen ${kernel.path} ${BOOTDIR}/vmlinuz-${kernel.flavor}
|
|
+ installinitrd images-xen ${kernel.initrd.path} ${BOOTDIR}/initrd-${kernel.flavor}.img
|
|
%else:
|
|
## normal i386, x86_64
|
|
- installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
|
- installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
|
+ installkernel images-${basearch} ${kernel.path} ${BOOTDIR}/vmlinuz
|
|
+ installinitrd images-${basearch} ${kernel.initrd.path} ${BOOTDIR}/initrd.img
|
|
%endif
|
|
%endfor
|
|
|
|
-hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR}
|
|
-hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
|
|
-%if basearch == 'x86_64':
|
|
- treeinfo images-xen kernel ${KERNELDIR}/vmlinuz
|
|
- treeinfo images-xen initrd ${KERNELDIR}/initrd.img
|
|
-%endif
|
|
-
|
|
-## WHeeeeeeee, EFI.
|
|
-<% efiargs=""; efigraft=""; efiarch32=None; efiarch64=None %>
|
|
-%if exists("boot/efi/EFI/*/gcdia32.efi"):
|
|
- <% efiarch32 = 'IA32' %>
|
|
-%endif
|
|
-%if exists("boot/efi/EFI/*/gcdx64.efi"):
|
|
- <% efiarch64 = 'X64' %>
|
|
-%endif
|
|
-%if (efiarch32 or efiarch64) and basearch != 'i386':
|
|
- <%
|
|
- efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
|
|
- images = [("images/efiboot.img", "-isohybrid-gpt-basdat")]
|
|
- if domacboot:
|
|
- images.append(("images/macboot.img", "-isohybrid-gpt-hfsplus"))
|
|
- %>
|
|
- %for img, hybrid in images:
|
|
- <%
|
|
- efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot {1}".format(img, hybrid)
|
|
- 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
|
|
+replace @VERSION@ '${product.version}' ${BOOTDIR}/grub/grub.cfg
|
|
+replace @PRODUCT@ '${product.name}' ${BOOTDIR}/grub/grub.cfg
|
|
+replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/grub/grub.cfg
|
|
+
|
|
+install ${configdir}/efibootimg ${BOOTDIR}/../
|
|
+
|
|
+mkdir EFI
|
|
+mkdir EFI/BOOT
|
|
+mkdir EFI/BOOT/fonts
|
|
+mkdir EFI/BOOT/locale
|
|
+install ${configdir}/EFI/BOOT/BOOT.cfg EFI/BOOT/
|
|
+install ${configdir}/EFI/BOOT/grub.cfg EFI/BOOT/
|
|
+install ${configdir}/EFI/BOOT/grub.efi EFI/BOOT/
|
|
+install ${configdir}/EFI/BOOT/kernel.* EFI/BOOT/
|
|
+install ${configdir}/EFI/BOOT/splash.xpm.gz EFI/BOOT/
|
|
+install ${configdir}/EFI/BOOT/fonts/unicode.pf2 EFI/BOOT/fonts/
|
|
+install ${configdir}/EFI/BOOT/locale/zh_CN.mo EFI/BOOT/locale/
|
|
|
|
# Create optional product.img and updates.img
|
|
-<% filegraft=""; images=["product", "updates"]; compressargs=""; %>
|
|
-%if basearch == 'i386':
|
|
- # Limit the amount of memory xz uses on i386
|
|
- <% compressargs="--xz -9 --memlimit-compress=3700MiB" %>
|
|
-%endif
|
|
+<% filegraft=""; images=["product", "updates"] %>
|
|
%for img in images:
|
|
%if exists("%s/%s/" % (LORAXDIR, img)):
|
|
- installimg ${compressargs} ${LORAXDIR}/${img}/ isoft/sw64/${img}.img
|
|
- treeinfo images-${basearch} ${img}.img isoft/sw64/${img}.img
|
|
- <% filegraft += " images/{0}.img={1}/isoft/sw64/{0}.img".format(img, outroot) %>
|
|
+ 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
|
|
|
|
@@ -121,15 +108,10 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
|
|
%endfor
|
|
|
|
## make boot.iso
|
|
+mkdir images
|
|
runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
|
- -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
|
|
- -b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \
|
|
+ -b ${ISOLINUXDIR}/isolinux.bin -c ${ISOLINUXDIR}/boot.cat \
|
|
-boot-load-size 4 -boot-info-table -no-emul-boot \
|
|
- ${efiargs} -R -J -V '${isolabel}' \
|
|
- -graft-points \
|
|
- .discinfo=${outroot}/.discinfo \
|
|
- ${STAGE2IMG}=${outroot}/${STAGE2IMG} \
|
|
- ${BOOTDIR}=${outroot}/${BOOTDIR} \
|
|
- ${KERNELDIR}=${outroot}/${KERNELDIR} \
|
|
- ${efigraft} ${filegraft}
|
|
+ -R -J -V '${isolabel}' \
|
|
+ ${filegraft} ${outroot}
|
|
treeinfo images-${basearch} boot.iso images/boot.iso
|
|
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
|
|
index 1b85052..c37c0e0 100644
|
|
--- a/src/pylorax/__init__.py
|
|
+++ b/src/pylorax/__init__.py
|
|
@@ -67,7 +67,7 @@ class ArchData(DataHolder):
|
|
lib64_arches = ("x86_64", "ppc64le", "s390x", "ia64", "aarch64")
|
|
bcj_arch = dict(i386="x86", x86_64="x86",
|
|
ppc64le="powerpc",
|
|
- arm="arm", armhfp="arm", sw_64="sw64")
|
|
+ arm="arm", armhfp="arm")
|
|
|
|
def __init__(self, buildarch):
|
|
super(ArchData, self).__init__()
|
|
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
|
|
index 9335735..5fbb579 100644
|
|
--- a/src/pylorax/treebuilder.py
|
|
+++ b/src/pylorax/treebuilder.py
|
|
@@ -246,7 +246,7 @@ class RuntimeBuilder(object):
|
|
|
|
# Catch problems with the rootfs being too small and clearly log them
|
|
try:
|
|
- imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "LiveOS/rootfs.img"),
|
|
+ imgutils.mkrootfsimg(self.vars.root, joinpaths(workdir, "rootfs.img"),
|
|
"Anaconda", size=size)
|
|
except CalledProcessError as e:
|
|
if e.stdout and "No space left on device" in e.stdout:
|
|
--
|
|
2.33.0
|
|
|