Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nYMrt-00035j-04 for mharc-grub-devel@gnu.org; Sun, 27 Mar 2022 02:59:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYMrr-00035a-LT for grub-devel@gnu.org; Sun, 27 Mar 2022 02:59:15 -0400 Received: from [2a00:1450:4864:20::12a] (port=40773 helo=mail-lf1-x12a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYMrp-0006AM-RU for grub-devel@gnu.org; Sun, 27 Mar 2022 02:59:15 -0400 Received: by mail-lf1-x12a.google.com with SMTP id t25so19850999lfg.7 for ; Sat, 26 Mar 2022 23:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=CfEuHZxiWUlvQq82B7UyXX4vu82Vk/81Wdykt67gln4=; b=cSvA6c0/Bq6Fury2IxjmkduDLsxfnWLVSLT3ai01/KG07X2RQywkBp3ElGtVqVVtnm apGjY43sK4BLQOLxpA9kwAWWCfCpqSCFpBC/WXsdFTgI5CDmtM9QXRIbJ3pqPMjcaZ6j Guv+7H6Hq1SzxvcYMNPWRXLqxGIlG8po3EviJqCotykAU/R9YHP9temrnsXvnisFHftH Mg9HxWJZP8KdXv1w79MXSsKH0QLTPgolatJ0C4bixX6ZZNcruxhP+LKddiVIYuAjNRjq BaUXSZ2xCQ/owE4GrXsx9stcRlnYiO6FDW/N7aVSICzr/Kh+Qi7FQJ9sNSsB5MF0mR2L Y8Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=CfEuHZxiWUlvQq82B7UyXX4vu82Vk/81Wdykt67gln4=; b=qY9QKZEksko/xc78LY653fvPP+PmBzflkuyYkqiBJTcMkfYi7JA8yvL/EOKJZAvUMH z++MDj9PxcIazHY2OXrJZ0tECo5d5En0W/YYNVoLILaP/H8J+pT8zyGJoEDXXuJBzwUG c92w35U6rN56LUenxsC3GhXdePoKgoBrFDZqTFwBWYK5kfh3+AhFG9833JHVRX7BgKmb 189x4SnagNm2K7rr7n11LukiQb0OjmqDDsb6LDUSieDcIjM1r5spYjwi4lks4VLjDO/C TAgW5HeRldMZvqbACQN048cuQ05XVmJteO7sGjHdrJZoPNUMbYevIotL1hyNVlAIUS55 eV+A== X-Gm-Message-State: AOAM5312uf9TijFyb+Dkt+gXCX1j8xb8h6hnFhUNPY54MTkzLhznIeXy vrPkLsuMBt1HVO5rZaiA5su0JL6xENk= X-Google-Smtp-Source: ABdhPJx179pIDodw6fmHSWc+yHJQb85J9tHvbUm12rHNDUvDGSiAb1gvF8K8FNZI04521yoPz0wP9A== X-Received: by 2002:a05:6512:108b:b0:44a:7147:9861 with SMTP id j11-20020a056512108b00b0044a71479861mr9254335lfg.228.1648364351448; Sat, 26 Mar 2022 23:59:11 -0700 (PDT) Received: from dj3ntoo (229.sub-72-104-162.myvzw.com. [72.104.162.229]) by smtp.gmail.com with ESMTPSA id g36-20020a0565123ba400b0044a2a1ccd99sm1278527lfv.20.2022.03.26.23.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 23:59:11 -0700 (PDT) Date: Sun, 27 Mar 2022 01:59:06 -0500 From: Oskari Pirhonen To: grub-devel@gnu.org Subject: Re: [PATCH] util/grub.d/10_linux: Improve initramfs detection Message-ID: Mail-Followup-To: grub-devel@gnu.org References: <20220324171125.eisebh3aarqjhlph@tomti.i.net-space.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xu32tM3RJ7zCvQsf" Content-Disposition: inline In-Reply-To: <20220324171125.eisebh3aarqjhlph@tomti.i.net-space.pl> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::12a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=xxc3ncoredxx@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Mar 2022 06:59:15 -0000 --xu32tM3RJ7zCvQsf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 24, 2022 at 06:11:25PM +0100, Daniel Kiper wrote: > On Wed, Mar 16, 2022 at 11:21:51PM -0500, Oskari Pirhonen wrote: > > Prefer using a *.old initramfs for *.old kernels if it exists. Otherwise > > look for an initramfs without the suffix. > > > > Also add detection for initramfs of the form *.img.old. For example, > > Gentoo's sys-kernel/genkernel installs it as initramfs-*.img and moves > > any existing one to initramfs-*.img.old. > > > > Signed-off-by: Oskari Pirhonen > > --- > > util/grub.d/10_linux.in | 41 ++++++++++++++++++++++++++++------------- >=20 > You should update the util/grub.d/20_linux_xen.in too. Good point. >=20 > > 1 file changed, 28 insertions(+), 13 deletions(-) > > > > diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in > > index ca068038e..4a666c317 100644 > > --- a/util/grub.d/10_linux.in > > +++ b/util/grub.d/10_linux.in > > @@ -215,19 +215,34 @@ while [ "x$list" !=3D "x" ] ; do > > done > > > > initrd_real=3D > > - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${v= ersion}.gz" \ > > - "initrd-${version}" "initramfs-${version}.img" \ > > - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ > > - "initrd-${alt_version}" "initramfs-${alt_version}.img" \ > > - "initramfs-genkernel-${version}" \ > > - "initramfs-genkernel-${alt_version}" \ > > - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ > > - "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do > > - if test -e "${dirname}/${i}" ; then > > - initrd_real=3D"${i}" > > - break > > - fi > > - done > > + # Prefer to match *.old kernel with *.old initramfs if it exists > > + if [ "${alt_version}" !=3D "${version}" ]; then > > + for i in "initrd.img-${version}" "initrd-${version}.img" \ > > + "initrd-${alt_version}.img.old" "initrd-${version}.gz" \ > > + "initrd-${alt_version}.gz.old" "initrd-${version}" \ >=20 > Why do you change order of images in comparison to the original above? > I think it should be more or less *${version} *${alt_version}.img.old > *${alt_version}.gz.old *${alt_version} and so on... I reordered it slightly, but tried to keep it the same in spirit. I can rework this though and submit a v2 including 20_linux_xen in it too. >=20 > > + "initramfs-${version}.img" "initramfs-${alt_version}.img.old= " \ > > + "initramfs-genkernel-${version}" \ > > + "initramfs-genkernel-${GENKERNEL_ARCH}-${version}"; do > > + if test -e "${dirname}/${i}" ; then > > + initrd_real=3D"${i}" > > + break > > + fi > > + done > > + fi > > + > > + # alt_version =3D=3D version or *.old initramfs not found > > + # use alt_version to handle both cases at once > > + if [ -z "${initrd_real}" ]; then > > + for i in "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ > > + "initrd-${alt_version}.gz" "initrd-${alt_version}" \ > > + "initramfs-${alt_version}.img" "initramfs-genkernel-${alt_ve= rsion}" \ > > + "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do > > + if test -e "${dirname}/${i}" ; then > > + initrd_real=3D"${i}" > > + break > > + fi > > + done > > + fi >=20 > Daniel - Oskari --xu32tM3RJ7zCvQsf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQfOU+JeXjo4uxN6vCp8he9GGIfEQUCYkALMwAKCRCp8he9GGIf EcOnAQDSNHWh0cujSRmIo5LZuKrj+wVZayw5LeCtZPBka9E7uwD/fBXpFTvPwGJa daEabgphgxZhVg17x6SGu+yLJt9L9QQ= =a+Nt -----END PGP SIGNATURE----- --xu32tM3RJ7zCvQsf--