diff --git a/1014-add-loongarch64-support-for-lorax-templates-anolis.patch b/1014-add-loongarch64-support-for-lorax-templates-anolis.patch index 26075dec87c2251a19f9669a4c5fdd5544f0aeee..a252a5ac3319f00132f1a51c4dfe51f78e9d2963 100644 --- a/1014-add-loongarch64-support-for-lorax-templates-anolis.patch +++ b/1014-add-loongarch64-support-for-lorax-templates-anolis.patch @@ -1,19 +1,33 @@ -From e6c244af46b6edc40244bc632b9b34d2bd4301cf Mon Sep 17 00:00:00 2001 +From 7081062530fe640df8faa8e57c5aa32bfac48242 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang -Date: Thu, 7 Dec 2023 07:12:16 +0000 +Date: Tue, 12 Dec 2023 12:30:53 +0000 Subject: [PATCH] add loongarch64 support for lorax-templates-anolis --- - 80-anolis/config_files/loongarch64/boot.cfg | 13 ++ - .../config_files/loongarch64/grub2-efi.cfg | 27 ++++ - 80-anolis/efi.tmpl | 7 +- - 80-anolis/loongarch64.tmpl | 146 ++++++++++++++++++ - 80-anolis/runtime-install.tmpl | 7 + - 5 files changed, 199 insertions(+), 1 deletion(-) + 80-anolis/aarch64.tmpl | 2 +- + 80-anolis/config_files/loongarch64/boot.cfg | 13 ++++ + .../config_files/loongarch64/grub2-efi.cfg | 46 ++++++++++++ + 80-anolis/efi.tmpl | 7 +- + 80-anolis/loongarch64.tmpl | 75 +++++++++++++++++++ + 80-anolis/runtime-install.tmpl | 7 ++ + 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 80-anolis/config_files/loongarch64/boot.cfg create mode 100644 80-anolis/config_files/loongarch64/grub2-efi.cfg create mode 100644 80-anolis/loongarch64.tmpl +diff --git a/80-anolis/aarch64.tmpl b/80-anolis/aarch64.tmpl +index 0b6ee50..0ab3850 100644 +--- a/80-anolis/aarch64.tmpl ++++ b/80-anolis/aarch64.tmpl +@@ -24,7 +24,7 @@ treeinfo stage2 mainimage ${STAGE2IMG} + ## install kernels + mkdir ${KERNELDIR} + %for kernel in kernels: +- ## normal aarch64 ++ ## normal loongarch64 + installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz + installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + %endfor diff --git a/80-anolis/config_files/loongarch64/boot.cfg b/80-anolis/config_files/loongarch64/boot.cfg new file mode 100644 index 0000000..c07d6ea @@ -35,19 +49,24 @@ index 0000000..c07d6ea + args @ROOT@ rhgb diff --git a/80-anolis/config_files/loongarch64/grub2-efi.cfg b/80-anolis/config_files/loongarch64/grub2-efi.cfg new file mode 100644 -index 0000000..250d48b +index 0000000..c8e794f --- /dev/null +++ b/80-anolis/config_files/loongarch64/grub2-efi.cfg -@@ -0,0 +1,27 @@ -+ -+set default="0" +@@ -0,0 +1,46 @@ ++set default="1" + +function load_video { -+ insmod efi_gop -+ insmod efi_uga -+ insmod video_bochs -+ insmod video_cirrus -+ insmod all_video ++ if [ x$feature_all_video_module = xy ]; then ++ insmod all_video ++ else ++ insmod efi_gop ++ insmod efi_uga ++ insmod ieee1275_fb ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++ fi +} + +load_video @@ -62,9 +81,23 @@ index 0000000..250d48b +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@ ++menuentry 'Install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ ro inst.profile=anolis ++ initrd @INITRDPATH@ ++} ++menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ rd.live.check inst.profile=anolis ++ initrd @INITRDPATH@ ++} ++submenu 'Troubleshooting -->' { ++ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ nomodeset inst.profile=anolis ++ initrd @INITRDPATH@ ++ } ++ menuentry 'Rescue a @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ inst.rescue inst.profile=anolis ++ initrd @INITRDPATH@ ++ } +} diff --git a/80-anolis/efi.tmpl b/80-anolis/efi.tmpl index bb1aa4f..5e43ee6 100644 @@ -93,10 +126,10 @@ index bb1aa4f..5e43ee6 100644 ## actually make the EFI images diff --git a/80-anolis/loongarch64.tmpl b/80-anolis/loongarch64.tmpl new file mode 100644 -index 0000000..c1a2988 +index 0000000..a9284e0 --- /dev/null +++ b/80-anolis/loongarch64.tmpl -@@ -0,0 +1,146 @@ +@@ -0,0 +1,75 @@ +<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/> +<% +configdir="tmp/config_files/loongarch64" @@ -133,12 +166,12 @@ index 0000000..c1a2988 +#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"): ++<% efiargs=""; efigraft="";efiarch64=None %> ++%if exists("boot/efi/EFI/*/gcdloongarch64.efi"): + <% ++ efiarch64 = 'LOONGARCH64' + efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) + images = ["images/efiboot.img"] -+ EFIBOOTDIR="EFI/BOOT" + %> + %for img in images: + <% @@ -147,67 +180,7 @@ index 0000000..c1a2988 + %> + treeinfo images-${basearch} ${img|basename} ${img} + %endfor -+ -+ # <%include file="efi.tmpl" args="kernels=kernels, 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/*/grubloongarch64.efi ${EFIBOOTDIR}/BOOTLOONGARCH64.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} ++ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> +%endif + +# Create optional product.img and updates.img @@ -232,17 +205,6 @@ index 0000000..c1a2988 + install ${f} ${f|basename} + <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> +%endfor -+ -+%if exists("boot/efi/EFI/*/grubloongarch64.efi"): -+## make boot.iso -+runcmd mkisofs -o ${outroot}/images/boot.iso \ -+ ${efiargs} -R -J -V '${isolabel}' ${udfargs} \ -+ -graft-points -full-iso9660-filenames \ -+ ${KERNELDIR}=${outroot}/${KERNELDIR} \ -+ ${STAGE2IMG}=${outroot}/${STAGE2IMG} \ -+ ${efigraft} ${filegraft} -+treeinfo images-${basearch} boot.iso images/boot.iso -+%endif diff --git a/80-anolis/runtime-install.tmpl b/80-anolis/runtime-install.tmpl index 474523d..25ef0f8 100644 --- a/80-anolis/runtime-install.tmpl diff --git a/lorax-templates-anolis.spec b/lorax-templates-anolis.spec index 3ddcac6617e4c0f4c21e396bc9ec34349bafc506..b26884eba00c201bb02266a77baf4af5c0f6af18 100644 --- a/lorax-templates-anolis.spec +++ b/lorax-templates-anolis.spec @@ -1,4 +1,4 @@ -%define anolis_release 15 +%define anolis_release 16 Name: lorax-templates-anolis Version: 37.0 @@ -50,6 +50,9 @@ cp -a 80-anolis/* $RPM_BUILD_ROOT/%{templatedir} %{templatedir}/* %changelog +* Tue Dec 12 2023 Wenlong Zhang - 37.0.1-16 +- modify the patch 1014 for loongarch64 + * Wed Dec 6 2023 Wenlong Zhang - 37.0.1-15 - add loongarch64 support for lorax-templates-anolis