diff --git a/1000-lorax-templates-anolis-add-loongarch64-support.patch b/1000-lorax-templates-anolis-add-loongarch64-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..6aebf3f8012113460237e5a2658b482fc40ed203 --- /dev/null +++ b/1000-lorax-templates-anolis-add-loongarch64-support.patch @@ -0,0 +1,237 @@ +diff -Nur lorax-templates-anolis-8.3/80-anolis/config_files/loongarch64/boot.cfg lorax-templates-anolis-8.3.new/80-anolis/config_files/loongarch64/boot.cfg +--- lorax-templates-anolis-8.3/80-anolis/config_files/loongarch64/boot.cfg 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/config_files/loongarch64/boot.cfg 2021-09-24 13:03:44.578351034 +0800 +@@ -0,0 +1,13 @@ ++timeout 5 ++showmenu 1 ++default 0 ++ ++title Install @PRODUCT@ @VERSION@ (USB) ++ kernel (usb0,0)@KERNELPATH@ ++ initrd (usb0,0)@INITRDPATH@ ++ args @ROOT@ rhgb ++ ++title Install @PRODUCT@ @VERSION@ (SATA-CD) ++ kernel (cd0,0)@KERNELPATH@ ++ initrd (cd0,0)@INITRDPATH@ ++ args @ROOT@ rhgb +diff -Nur lorax-templates-anolis-8.3/80-anolis/config_files/loongarch64/grub2-efi.cfg lorax-templates-anolis-8.3.new/80-anolis/config_files/loongarch64/grub2-efi.cfg +--- lorax-templates-anolis-8.3/80-anolis/config_files/loongarch64/grub2-efi.cfg 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/config_files/loongarch64/grub2-efi.cfg 2021-09-24 13:04:10.666378894 +0800 +@@ -0,0 +1,27 @@ ++ ++set default="0" ++ ++function load_video { ++ insmod efi_gop ++ insmod efi_uga ++ insmod video_bochs ++ insmod video_cirrus ++ insmod all_video ++} ++ ++load_video ++set gfxpayload=keep ++insmod gzio ++insmod part_gpt ++insmod ext2 ++ ++set timeout=60 ++### END /etc/grub.d/00_header ### ++ ++search --no-floppy --set=root -l '@ISOLABEL@' ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ quiet ++ initrd @INITRDPATH@ ++} +diff -Nur lorax-templates-anolis-8.3/80-anolis/loongarch64.tmpl lorax-templates-anolis-8.3.new/80-anolis/loongarch64.tmpl +--- lorax-templates-anolis-8.3/80-anolis/loongarch64.tmpl 1970-01-01 08:00:00.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/loongarch64.tmpl 2021-09-24 12:36:57.509636995 +0800 +@@ -0,0 +1,145 @@ ++<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/> ++<% ++configdir="tmp/config_files/loongarch64" ++PXEBOOTDIR="images/pxeboot" ++KERNELDIR=PXEBOOTDIR ++STAGE2IMG="images/install.img" ++LORAXDIR="usr/share/lorax/" ++ ++from os.path import basename ++%> ++ ++## 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 = "" ++%> ++ ++mkdir images ++install ${runtime_img} ${STAGE2IMG} ++treeinfo stage2 mainimage ${STAGE2IMG} ++ ++## install kernels ++mkdir ${KERNELDIR} ++%for kernel in kernels: ++ ## normal loongarch64 ++ 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/*/grubloongarch64.efi"): ++ <% ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = ["images/efiboot.img"] ++ EFIBOOTDIR="EFI/BOOT" ++ %> ++ %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"/> ++ ++ mkdir ${EFIBOOTDIR} ++ mkdir ${EFIBOOTDIR}/fonts/ ++ ++ install boot/efi/EFI/*/grubloongarch64.efi ${EFIBOOTDIR}/BOOTLOONGARCH.EFI ++ install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/ ++ ++ ## actually make the EFI images ++ ${make_efiboot("images/efiboot.img")} ++ ++ <%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')"> ++ <% ++ kdir = EFIBOOTDIR if include_kernel else KERNELDIR ++ eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) ++ args = "--label=ANACONDA --debug" ++ if disk: args += " --disk" ++ %> ++ %if include_kernel: ++ copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR} ++ copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} ++ %endif ++ install ${configdir}/grub2-efi.cfg ${eficonf} ++ replace @PRODUCT@ '${product.name}' ${eficonf} ++ replace @VERSION@ ${product.version} ${eficonf} ++ replace @KERNELNAME@ vmlinuz ${eficonf} ++ replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} ++ replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} ++ replace @ISOLABEL@ '${isolabel}' ${eficonf} ++ %if disk: ++ replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf} ++ %else: ++ replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf} ++ %endif ++ runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} ++ %if include_kernel: ++ remove ${EFIBOOTDIR}/vmlinuz ++ remove ${EFIBOOTDIR}/initrd.img ++ %endif ++ ++ ++ ## Loongson PMON boot.cfg ++ <% ++ pmonbootdir = "boot" ++ kdir = KERNELDIR ++ bootconf = "%s/boot.cfg" % (pmonbootdir,) ++ args = "--label=ANACONDA --debug" ++ if disk: args += " --disk" ++ %> ++ ++ ##pmon bios ++ mkdir ${pmonbootdir} ++ install ${configdir}/boot.cfg ${bootconf} ++ ++ replace @PRODUCT@ '${product.name}' ${bootconf} ++ replace @VERSION@ ${product.version} ${bootconf} ++ replace @KERNELPATH@ /${kdir}/vmlinuz ${bootconf} ++ replace @INITRDPATH@ /${kdir}/initrd.img ${bootconf} ++ replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${bootconf} ++%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 ++ ++# 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/*/gcdaa64.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 +diff -Nur lorax-templates-anolis-8.3/80-anolis/runtime-install.tmpl lorax-templates-anolis-8.3.new/80-anolis/runtime-install.tmpl +--- lorax-templates-anolis-8.3/80-anolis/runtime-install.tmpl 2020-12-26 00:16:14.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/runtime-install.tmpl 2021-09-24 12:20:44.557600106 +0800 +@@ -7,7 +7,10 @@ + + ## Other available payloads + installpkg dnf +-installpkg rpm-ostree ostree ++%if basearch != "loongarch64": ++ installpkg rpm-ostree ++%endif ++installpkg ostree + ## speed up compression on multicore systems + installpkg pigz + installpkg anolis-repos +@@ -54,6 +57,13 @@ + installpkg lsscsi s390utils-base s390utils-cmsfs-fuse + installpkg s390utils-hmcdrvfs + %endif ++%if basearch == "loongarch64": ++ installpkg grub2-efi-loongarch64-cdboot grubby grub2-tools-minimal ++ installpkg grub2-common grub2-tools-extra grubby-deprecated grub2-tools grub2-efi-loongarch64 ++ installpkg efibootmgr ++ installpkg avahi-libs avahi-glib ++%endif ++ + + ## yay, plymouth + installpkg plymouth +@@ -116,7 +126,9 @@ + %endif + installpkg net-tools + installpkg nmap-ncat +-installpkg prefixdevname ++%if basearch != "loongarch64": ++ installpkg prefixdevname ++%endif + + ## hardware utilities/libraries + installpkg pciutils usbutils ipmitool diff --git a/lorax-templates-anolis.spec b/lorax-templates-anolis.spec index 4127df05c1508f286e683d06edda908feeb6e086..dbc276807ad542392a1f90aa9009c19057983480 100644 --- a/lorax-templates-anolis.spec +++ b/lorax-templates-anolis.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 3 Name: lorax-templates-anolis Version: 8.3 Release: 4.%{anolis_release}%{?dist} @@ -9,6 +9,8 @@ URL: https://github.com/weldr/lorax BuildArch: noarch Source0: lorax-templates-anolis-8.3-4.tar.gz +Patch1000: 1000-lorax-templates-anolis-add-loongarch64-support.patch + # Where are these supposed to end up? %define templatedir %{_datadir}/lorax/templates.d/80-anolis @@ -18,6 +20,7 @@ placed in %{templatedir} %prep %setup +%patch1000 -p1 %build # nothing to build @@ -32,5 +35,11 @@ cp -a 80-anolis/* $RPM_BUILD_ROOT/%{templatedir} %{templatedir}/* %changelog +* Wed Dec 1 2021 Liwei Ge - 8.3-4.3 +- Remove grub2-tools-efi from loongarch64 + +* Fri Sep 24 2021 Liwei Ge - 8.3-4.2 +- Add loongarch64 support + * Fri Dec 25 2020 Jacob Wang - 8.3-4.1 - Initial version for Anolis OS