From 03df43374e5fecc7d0018c6b85ae45474aa71fd9 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Mon, 21 Feb 2022 11:29:42 +0800 Subject: [PATCH] anolis: install multi kernel boot entry Signed-off-by: Liwei Ge --- ...install-kernel-with-version-suffixed.patch | 241 ++++++++++++++++++ lorax-templates-anolis.spec | 7 +- 2 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 1001-install-kernel-with-version-suffixed.patch diff --git a/1001-install-kernel-with-version-suffixed.patch b/1001-install-kernel-with-version-suffixed.patch new file mode 100644 index 0000000..990586e --- /dev/null +++ b/1001-install-kernel-with-version-suffixed.patch @@ -0,0 +1,241 @@ +diff -Nur lorax-templates-anolis-8.3/80-anolis/aarch64.tmpl lorax-templates-anolis-8.3.new/80-anolis/aarch64.tmpl +--- lorax-templates-anolis-8.3/80-anolis/aarch64.tmpl 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/aarch64.tmpl 2022-02-18 17:12:12.111334130 +0800 +@@ -27,8 +27,8 @@ + mkdir ${KERNELDIR} + %for kernel in kernels: + ## normal aarch64 +- installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz +- installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.version} ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.version}.img + %endfor + + #FIXME: this will need adjusted when we have a real bootloader. +diff -Nur lorax-templates-anolis-8.3/80-anolis/config_files/x86/grub2-efi.cfg lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/grub2-efi.cfg +--- lorax-templates-anolis-8.3/80-anolis/config_files/x86/grub2-efi.cfg 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/grub2-efi.cfg 2022-02-18 17:27:01.691905488 +0800 +@@ -21,20 +21,24 @@ + + ### BEGIN /etc/grub.d/10_linux ### + menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { +- linuxefi @KERNELPATH@ @ROOT@ quiet +- initrdefi @INITRDPATH@ ++ linuxefi @ANCKKERNELPATH@ @ROOT@ quiet ++ initrdefi @ANCKINITRDPATH@ ++} ++menuentry 'Install @PRODUCT@ @VERSION@ in compatible mode' --class fedora --class gnu-linux --class gnu --class os { ++ linuxefi @RHCKKERNELPATH@ @ROOT@ quiet ++ initrdefi @RHCKINITRDPATH@ + } + menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { +- linuxefi @KERNELPATH@ @ROOT@ rd.live.check quiet +- initrdefi @INITRDPATH@ ++ linuxefi @ANCKKERNELPATH@ @ROOT@ rd.live.check quiet ++ initrdefi @ANCKINITRDPATH@ + } + submenu 'Troubleshooting -->' { + menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { +- linuxefi @KERNELPATH@ @ROOT@ nomodeset quiet +- initrdefi @INITRDPATH@ ++ linuxefi @ANCKKERNELPATH@ @ROOT@ nomodeset quiet ++ initrdefi @ANCKINITRDPATH@ + } + menuentry 'Rescue a @PRODUCT@ system' --class fedora --class gnu-linux --class gnu --class os { +- linuxefi @KERNELPATH@ @ROOT@ rescue quiet +- initrdefi @INITRDPATH@ ++ linuxefi @ANCKKERNELPATH@ @ROOT@ rescue quiet ++ initrdefi @ANCKINITRDPATH@ + } + } +diff -Nur lorax-templates-anolis-8.3/80-anolis/config_files/x86/grub.conf lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/grub.conf +--- lorax-templates-anolis-8.3/80-anolis/config_files/x86/grub.conf 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/grub.conf 2022-02-18 17:27:33.024031278 +0800 +@@ -5,9 +5,13 @@ + hiddenmenu + title Install @PRODUCT@ @VERSION@ + findiso +- kernel @KERNELPATH@ @ROOT@ quiet +- initrd @INITRDPATH@ ++ kernel @ANCKKERNELPATH@ @ROOT@ quiet ++ initrd @ANCKINITRDPATH@ ++title Install @PRODUCT@ @VERSION@ in compitable mode ++ findiso ++ kernel @RHCKKERNELPATH@ @ROOT@ quiet ++ initrd @RHCKINITRDPATH@ + title Test this media & install @PRODUCT@ @VERSION@ + findiso +- kernel @KERNELPATH@ @ROOT@ rd.live.check quiet +- initrd @INITRDPATH@ ++ kernel @ANCKKERNELPATH@ @ROOT@ rd.live.check quiet ++ initrd @ANCKINITRDPATH@ +diff -Nur lorax-templates-anolis-8.3/80-anolis/config_files/x86/isolinux.cfg lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/isolinux.cfg +--- lorax-templates-anolis-8.3/80-anolis/config_files/x86/isolinux.cfg 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/config_files/x86/isolinux.cfg 2022-02-18 17:28:59.604378874 +0800 +@@ -60,14 +60,19 @@ + + label linux + menu label ^Install @PRODUCT@ @VERSION@ +- kernel vmlinuz +- append initrd=initrd.img @ROOT@ quiet ++ kernel vmlinuz-@ANCK@ ++ append initrd=initrd-@ANCK@.img @ROOT@ quiet ++ ++label linux ++ menu label ^Install @PRODUCT@ @VERSION@ in compatible mode ++ kernel vmlinuz-@RHCK@ ++ append initrd=initrd-@RHCK@.img @ROOT@ quiet + + label check + menu label Test this ^media & install @PRODUCT@ @VERSION@ + menu default +- kernel vmlinuz +- append initrd=initrd.img @ROOT@ rd.live.check quiet ++ kernel vmlinuz-@ANCK@ ++ append initrd=initrd-@ANCK@.img @ROOT@ rd.live.check quiet + + menu separator # insert an empty line + +@@ -82,8 +87,8 @@ + Try this option out if you're having trouble installing + @PRODUCT@ @VERSION@. + endtext +- kernel vmlinuz +- append initrd=initrd.img @ROOT@ nomodeset quiet ++ kernel vmlinuz-@ANCK@ ++ append initrd=initrd-@ANCK@.img @ROOT@ nomodeset quiet + + label rescue + menu indent count 5 +@@ -92,8 +97,8 @@ + If the system will not boot, this lets you access files + and edit config files to try to get it booting again. + endtext +- kernel vmlinuz +- append initrd=initrd.img @ROOT@ rescue quiet ++ kernel vmlinuz-@ANCK@ ++ append initrd=initrd-@ANCK@.img @ROOT@ rescue quiet + + label memtest + menu label Run a ^memory test +diff -Nur lorax-templates-anolis-8.3/80-anolis/efi.tmpl lorax-templates-anolis-8.3.new/80-anolis/efi.tmpl +--- lorax-templates-anolis-8.3/80-anolis/efi.tmpl 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/efi.tmpl 2022-02-21 10:21:42.264812328 +0800 +@@ -1,4 +1,4 @@ +-<%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel"/> ++<%page args="kernels, configdir, KERNELDIR, efiarch32, efiarch64, isolabel"/> + <% + EFIBOOTDIR="EFI/BOOT" + APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" +@@ -20,13 +20,13 @@ + install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/ + + ## actually make the EFI images +-${make_efiboot("images/efiboot.img")} ++${make_efiboot("images/efiboot.img", kernels=kernels)} + %if domacboot: + ${make_efiboot("images/macboot.img", imgtype="apple")} + %endif + + ## This is kinda gross, but then... so's EFI. +-<%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')"> ++<%def name="make_efiboot(kernels, img, include_kernel=False, disk=False, imgtype='default')"> + <% + kdir = EFIBOOTDIR if include_kernel else KERNELDIR + eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) +@@ -34,16 +34,25 @@ + if disk: args += " --disk" + if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version) + %> ++ ++ %for kernel in kernels: ++ + %if include_kernel: +- copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR} +- copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} ++ copy ${KERNELDIR}/vmlinuz-${kernel.version} ${EFIBOOTDIR} ++ copy ${KERNELDIR}/initrd-${kernel.version}.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} ++ %if kernel.version.startswith("4.19.91-"): ++ replace @ANCKKERNELNAME@ vmlinuz-${kernel.version} ${eficonf} ++ replace @ANCKKERNELPATH@ /${kdir}/vmlinuz-${kernel.version} ${eficonf} ++ replace @ANCKINITRDPATH@ /${kdir}/initrd-${kernel.version}.img ${eficonf} ++ %else: ++ replace @RHCKKERNELNAME@ vmlinuz-${kernel.version} ${eficonf} ++ replace @RHCKKERNELPATH@ /${kdir}/vmlinuz-${kernel.version} ${eficonf} ++ replace @RHCKINITRDPATH@ /${kdir}/initrd-${kernel.version}.img ${eficonf} ++ %endif + replace @ISOLABEL@ '${isolabel}' ${eficonf} + %if disk: + replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf} +@@ -55,7 +64,9 @@ + %endif + runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} + %if include_kernel: +- remove ${EFIBOOTDIR}/vmlinuz +- remove ${EFIBOOTDIR}/initrd.img ++ remove ${EFIBOOTDIR}/vmlinuz-${kernel.version} ++ remove ${EFIBOOTDIR}/initrd-${kernel.version}.img + %endif ++ ++ %endfor + +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 2022-02-21 11:27:42.519442134 +0800 +@@ -15,7 +15,13 @@ + ## kernel and firmware + ## NOTE: Without explicitly including kernel-modules-extra dnf will choose kernel-debuginfo-* + ## to satify a gfs2-utils kmod requirement +-installpkg kernel kernel-modules kernel-modules-extra ++%if product.version == "7" and basearch == "x86_64": ++ installpkg kernel-3.10.0 kernel-modules-3.10.0 kernel-modules-extra-3.10.0 ++%else: ++ installpkg kernel-4.18.0 kernel-modules-4.18.0 kernel-modules-extra-4.18.0 ++%endif ++installpkg kernel-4.19.91 kernel-modules-4.19.91 kernel-modules-extra-4.19.91 ++ + installpkg grubby + %if basearch != "s390x": + ## skip the firmware for sound, video, and scanners, none of which will +diff -Nur lorax-templates-anolis-8.3/80-anolis/x86.tmpl lorax-templates-anolis-8.3.new/80-anolis/x86.tmpl +--- lorax-templates-anolis-8.3/80-anolis/x86.tmpl 2020-07-08 06:26:52.000000000 +0800 ++++ lorax-templates-anolis-8.3.new/80-anolis/x86.tmpl 2022-02-21 10:23:07.944976279 +0800 +@@ -58,13 +58,18 @@ + installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/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} ${KERNELDIR}/vmlinuz-${kernel.version} ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.version}.img + %endif ++ %if kernel.version.startswith("4.19.91-"): ++ replace @ANCK@ ${kernel.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++ %else: ++ replace @RHCK@ ${kernel.version} ${BOOTDIR}/grub.conf ${BOOTDIR}/isolinux.cfg ${BOOTDIR}/*.msg ++ %endif ++ hardlink ${KERNELDIR}/vmlinuz-${kernel.version} ${BOOTDIR} ++ hardlink ${KERNELDIR}/initrd-${kernel.version}.img ${BOOTDIR} + %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 +@@ -93,7 +98,7 @@ + treeinfo images-${basearch} ${img|basename} ${img} + %endfor + <% efihybrid = "--uefi --mac" if domacboot else "--uefi" %> +- <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> ++ <%include file="efi.tmpl" args="kernels=kernels, configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> + %endif + + # Create optional product.img and updates.img diff --git a/lorax-templates-anolis.spec b/lorax-templates-anolis.spec index dbc2768..9363458 100644 --- a/lorax-templates-anolis.spec +++ b/lorax-templates-anolis.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 Name: lorax-templates-anolis Version: 8.3 Release: 4.%{anolis_release}%{?dist} @@ -10,6 +10,7 @@ BuildArch: noarch Source0: lorax-templates-anolis-8.3-4.tar.gz Patch1000: 1000-lorax-templates-anolis-add-loongarch64-support.patch +Patch1001: 1001-install-kernel-with-version-suffixed.patch # Where are these supposed to end up? %define templatedir %{_datadir}/lorax/templates.d/80-anolis @@ -21,6 +22,7 @@ placed in %{templatedir} %prep %setup %patch1000 -p1 +%patch1001 -p1 %build # nothing to build @@ -35,6 +37,9 @@ cp -a 80-anolis/* $RPM_BUILD_ROOT/%{templatedir} %{templatedir}/* %changelog +* Mon Feb 21 2022 Liwei Ge - 8.3-4.4 +- Install multi kernel boot entry + * Wed Dec 1 2021 Liwei Ge - 8.3-4.3 - Remove grub2-tools-efi from loongarch64 -- Gitee