From nobody Fri May 17 11:28:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1660245071; cv=none; d=zohomail.com; s=zohoarc; b=FTaUwid1Q1erNw/NK1rFju6GWuvQtAXrkE368G9hzotg6StTUAA3iNrGKalwVbo8+im97tU3HTr+h02Y673ae/yL9TAwa4DLcePgECS+jcMJecrixuBeKwj9iAEyr7tQ6b5GhD/7Xaml9VnDe84gTwryhScdXM2AyZ9OfglPO3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660245071; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; b=QbrxlEeuUkm/96mmkH4y+mLuAknaX8nuZD5NVf+YpYO9pmeu+DF6T5L+khjQUB1uOUm/36pSsU9/lu08KyC6nG2c3CUox3Q/4Q6XlGJZmk3F58QvlEf4ExVlBGwz8/rO0HlB6LtQGQOb3vODVhAB8iWyZub8x7in9Tx3w0l2oa4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1660245071346103.04163810321393; Thu, 11 Aug 2022 12:11:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385111.620643 (Exim 4.92) (envelope-from ) id 1oMDZf-00048N-51; Thu, 11 Aug 2022 19:10:31 +0000 Received: by outflank-mailman (output) from mailman id 385111.620643; Thu, 11 Aug 2022 19:10:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZf-00048G-2H; Thu, 11 Aug 2022 19:10:31 +0000 Received: by outflank-mailman (input) for mailman id 385111; Thu, 11 Aug 2022 19:10:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZd-0003so-S0 for xen-devel@lists.xenproject.org; Thu, 11 Aug 2022 19:10:29 +0000 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 428ad19f-19a9-11ed-924f-1f966e50362f; Thu, 11 Aug 2022 21:10:27 +0200 (CEST) Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 418093FB95 for ; Thu, 11 Aug 2022 19:10:27 +0000 (UTC) Received: by mail-vs1-f70.google.com with SMTP id 124-20020a670882000000b00388cd45f433so1751644vsi.8 for ; Thu, 11 Aug 2022 12:10:27 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:4e1:83a2:2ee9:2118:a2dc:3dd6]) by smtp.gmail.com with ESMTPSA id g7-20020a67ea07000000b00384b60a5160sm120094vso.12.2022.08.11.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 12:10:25 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 428ad19f-19a9-11ed-924f-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660245027; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JvfFDGvxb4Ky1UyLUiF1YIdF6mYNxCfwhk09hK6SY0yqMo+lOG0wljB0qxkLwTbCr kN5pKEOKE7+SX6uV8DBhdG9NHglkuaA2DbrJz+xvo7c/3Fc4NQKyvJRpsdo3zPj0HB wkG4yuiAg9c7FIbasgkYcycoIa2ZNQ8R2ftotSkAsetEQHqWBMRL7vDUhTvqXu1Uqc KZisrNZtloq1YoHnwOT3ugj91M43/isBjwETWksWupBWqUzCZd0V9cUF7rx/D7Eael +gGAVMSlKbDp2BIWdLS0EtyTh/GEj525rOvo9hJWysEmM7DSnmfoWbjlwlqsdia4F9 T/5S41C+PmIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; b=jKCPbq3j42olQQl1h+ZtjyPXp3hGhzpBkDDuTx6Dxg19YgL6lW66s7yHUvg9FV/cUK Fh8wpt5OXb5br6cWD1iyLCxxATCKl83cfi3o3a5aLlTme9z8AMj02xdQ+kgAcm5qI6UR aAXL9wueLrx98qGHx0cNeM3XL8SAtxnWcLC+eWXnMqEyhbrE/Mzm2oVTb9sgil4M5JHK 2dpSUUzSJkGnxc+h531ZZNyGxrU3XRV2yafDRm7zoNqRiaV0nIRCiWUbMPV64TA1RTUf s+TYYIzgmZRtBMJUOuTR0sM41qK6Pa8l4z9eELLU5xquyh++P5LQlXcmjTTAWzKFA5et az4A== X-Gm-Message-State: ACgBeo2Rwr3DbQ/3PTZ9oJ3YKg7T50PWeumlJ8lsIBjtpt2kf7lJKM8u z23LkvoVUEnz5ptLn92rjrhUbssE7VV9zAwAOaBxoO2+iVLvSAnvsiypa7Cj+SjXDxf39u6NX0l v9PrNp9W8jSZbrar/LPVldO7MYfYa+pf2pwfeqXq1K6iB X-Received: by 2002:a05:6102:35c:b0:381:5d05:4eed with SMTP id e28-20020a056102035c00b003815d054eedmr291718vsa.74.1660245026117; Thu, 11 Aug 2022 12:10:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fIp/rY8D97jEgLS//TfrCICxkbup/p/NhqJDS1P8SHF2f6jQwj5g6tmRAkZjERWUPn7iSzQ== X-Received: by 2002:a05:6102:35c:b0:381:5d05:4eed with SMTP id e28-20020a056102035c00b003815d054eedmr291705vsa.74.1660245025851; Thu, 11 Aug 2022 12:10:25 -0700 (PDT) From: Mauricio Faria de Oliveira To: xen-devel@lists.xenproject.org, grub-devel@gnu.org Cc: Daniel Kiper , =?UTF-8?q?Peter=20Gro=C3=9Fe?= Subject: [PATCH 1/2] templates/linux_xen: Properly load multiple initrd files Date: Thu, 11 Aug 2022 16:10:13 -0300 Message-Id: <20220811191014.139882-2-mfo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811191014.139882-1-mfo@canonical.com> References: <20220811191014.139882-1-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @canonical.com) X-ZM-MESSAGEID: 1660245073224100001 The linux_xen template can put multiple initrd files in the same multiboot[2] module[2] command, which is against specs. This causes ONLY the _first_ initrd file to be loaded; other files just have filenames in a "cmdline" string of the first initrd file and are NOT loaded. Fix this by inserting a module[2] command per initrd file. Before: # touch /boot/xen /boot/microcode.cpio # grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' multiboot /boot/xen ... module /boot/vmlinuz-5.4.0-122-generic ... module --nounzip /boot/microcode.cpio /boot/initrd.img-5.4.0= -122-generic After: # touch /boot/xen /boot/microcode.cpio # grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' multiboot /boot/xen ... module /boot/vmlinuz-5.4.0-122-generic ... module --nounzip /boot/microcode.cpio module --nounzip /boot/initrd.img-5.4.0-122-generic Cause: The code was copied from the linux template, which is *apparently* equivalent.. but its initrd command grub_cmd_initrd() *supports* multiple files (see grub_initrd_init()), while module/module2 in grub_cmd_module() *does not* (see grub_multiboot[2]_add_module()). See commit e86f6aafb8de ("grub-mkconfig/20_linux_xen: Support multiple earl= y initrd images"): 'This is basically a copy of a698240d "grub-mkconfig/10_linux: Support multiple early initrd images" ...' Specs: Both multiboot and multiboot2 specifications mention support for 'multiple boot modules' (struct/tag used for kernel/initrd files): "Boot loaders don=E2=80=99t have to support multiple boot modules, but they are strongly encouraged to" [1,2] However, there is a 1:1 relationship between boot modules and files, more or less clearly; note the usage of singular/plural "module(s)". (Multiboot2, clearly: "One tag appears per module".) Multiboot [1]: "the =E2=80=98mods=E2=80=99 fields indicate ... what boot modules were loaded ..., and where they can be found. =E2=80=98mods_count=E2=80=99 contains the number of modules loaded" "The first two fields contain the start and end addresses of the boot module itself." Multiboot2 [2]: "This tag indicates ... what boot module was loaded ..., and where it can be found." "The =E2=80=98mod_start=E2=80=99 and =E2=80=98mod_end=E2=80=99 contain = the start and end physical addresses of the boot module itself." "One tag appears per module. This tag type may appear multiple times." And both clearly mention the 'string' field of a boot module, which is to be used by the operating system, not boot loader: "The =E2=80=98string=E2=80=99 field provides an arbitrary string to be associated with that particular boot module ... its exact use is specific to the operating system." Links: [1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html 3.3 Boot information format [2] https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html 3.6.6 Modules Fixes: e86f6aafb8de ("grub-mkconfig/20_linux_xen: Support multiple early in= itrd images") Signed-off-by: Mauricio Faria de Oliveira Acked-by: Juergen Gross --- util/grub.d/20_linux_xen.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 4382303c17f0..50c62562b730 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -162,12 +162,12 @@ EOF message=3D"$(gettext_printf "Loading initial ramdisk ...")" initrd_path=3D for i in ${initrd}; do - initrd_path=3D"${initrd_path} ${rel_dirname}/${i}" - done - sed "s/^/$submenu_indentation/" << EOF + initrd_path=3D"${rel_dirname}/${i}" + sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' ${module_loader} --nounzip $(echo $initrd_path) EOF + done fi if test -n "${xenpolicy}" ; then message=3D"$(gettext_printf "Loading XSM policy ...")" --=20 2.34.1 From nobody Fri May 17 11:28:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1660245058; cv=none; d=zohomail.com; s=zohoarc; b=WqRZPmO8CqElFUfCXW0qmVdM3Bn2brabHnYbmAaAxm5cB1P0CSgHz8qihAjF8znUH5RemU+6fMlJQCMZlTm6nB7EBcs6KhOwc9d7UIyEgG8eHnd1Lfqp4bUq/m58PLXveXHe3YwEdJyjxQcMcZyuJBNI/6lpylB4yvJRnsdVNNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660245058; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bku1QWFjoN5ugmM4WYD4XEpuzkdpLBaIxy3t9egl2dU=; b=KnZ5LPx2Hg3Y5zSgKQAlM7jnSL4VGew/Uv+N+tbvFJ0l8AfhgHZ4E5JxyJkXQ2IHjSLWrfzW2j/H6QvljQkqcfiV9s0zdFBx0APJUAMSS2xyix6gq9WbwJbmzb6DWjV0UE0fVSqANUMdrtrdnIAWkGOOzuHaWj11boiYWap2fFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1660245058630769.5491550593824; Thu, 11 Aug 2022 12:10:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385112.620654 (Exim 4.92) (envelope-from ) id 1oMDZh-0004O3-CP; Thu, 11 Aug 2022 19:10:33 +0000 Received: by outflank-mailman (output) from mailman id 385112.620654; Thu, 11 Aug 2022 19:10:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZh-0004Nw-9g; Thu, 11 Aug 2022 19:10:33 +0000 Received: by outflank-mailman (input) for mailman id 385112; Thu, 11 Aug 2022 19:10:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZf-00047D-Ik for xen-devel@lists.xenproject.org; Thu, 11 Aug 2022 19:10:31 +0000 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 43e533a2-19a9-11ed-bd2e-47488cf2e6aa; Thu, 11 Aug 2022 21:10:30 +0200 (CEST) Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9AC7D3FB9A for ; Thu, 11 Aug 2022 19:10:29 +0000 (UTC) Received: by mail-vk1-f199.google.com with SMTP id m198-20020a1f26cf000000b0037d0bb08ff0so542100vkm.22 for ; Thu, 11 Aug 2022 12:10:29 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:4e1:83a2:2ee9:2118:a2dc:3dd6]) by smtp.gmail.com with ESMTPSA id g7-20020a67ea07000000b00384b60a5160sm120094vso.12.2022.08.11.12.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 12:10:27 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 43e533a2-19a9-11ed-bd2e-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660245029; bh=Bku1QWFjoN5ugmM4WYD4XEpuzkdpLBaIxy3t9egl2dU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=veFCjXNrgHwp7PlSgIkzJ1re+NvzmQA+5bK55VyPrRJu1741Kv9qZA4nWt48kicLO xQrPFEYlXl+eblhmvpll7gZvsTjN+dUG8gELao8HH9V73nhzXtD47buRKu+O9Ww6yl otyi14ZjS5VXKq+vhPeQNJ2FVCN4Q3wVsqwV9o8zAn7c7nlZU/hdo1vEDp9e9VeY8p gi1AXSaOtPkhhO6F0e16UAXTa4THhlicoDpTnYx/NH5H/a0HI80ruPIzDLqP7qQhHO uAawwc29Q2L7FgDb/xfeSqbLxcdHX2812vvfAfAqrYgKCltXVezny8eiRbYoU97/KC zuY5JIfq7Gt0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Bku1QWFjoN5ugmM4WYD4XEpuzkdpLBaIxy3t9egl2dU=; b=1xSo7VDmVqEHrBrcmQ4vyC1sDz6eQiOEkQNE9+7sqTgBC+nGqyMm3Nj43GkULVI+9m NrngfdNJ/7y5qdnxWqsSpHf45XIIBZBCB2QJ6uQ8bBQQ44xZIcIHSheh2k48Zk9yEQnl fKa6kh4TPz89azFCk4OdWqtg8gM8BgrVrWUZWpRR9wUChJPYoF1eKXpnaDONNV+nbrIF sh9PqXCcVHHKJ0TXraPCbXpv+RSLm3dNoD/QD+Kg1VunUeEWcJ/PAXzlH63cZuTs1AhD gKT3iiX3tdx809dNHYpy9InQXtx5m4U/YE9gnplrGQ0yg0mx7t98NutnVywO0KRUNWxD Llrg== X-Gm-Message-State: ACgBeo0C2soPpIpHb+PeHYTWvFtJmf3Bo1szUUGv8sTGNsa409zTv6CI L5GFaaPfplOZ+ECtqyZL7J6DRUPfMKO/r7Q1SnrOn4uDaIhqjElMoDDfjmlNSEC3WSbRTdt+vaI GWiHJdVttwLxPBGp3dLKr/tCfE06NTdRXsJtT1ox2vFmd X-Received: by 2002:a05:6102:238d:b0:388:b4aa:9f37 with SMTP id v13-20020a056102238d00b00388b4aa9f37mr343526vsr.31.1660245028264; Thu, 11 Aug 2022 12:10:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7sJF0r7Bab4TEClDzx3QZJkVijmAqmhpwSOj/n3f6ue0JTLlUNFDAzWPlrmv2No7ACNyKt7g== X-Received: by 2002:a05:6102:238d:b0:388:b4aa:9f37 with SMTP id v13-20020a056102238d00b00388b4aa9f37mr343511vsr.31.1660245027975; Thu, 11 Aug 2022 12:10:27 -0700 (PDT) From: Mauricio Faria de Oliveira To: xen-devel@lists.xenproject.org, grub-devel@gnu.org Cc: Daniel Kiper , =?UTF-8?q?Peter=20Gro=C3=9Fe?= Subject: [PATCH 2/2] templates/linux_xen: Properly order the multiple initrd files Date: Thu, 11 Aug 2022 16:10:14 -0300 Message-Id: <20220811191014.139882-3-mfo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811191014.139882-1-mfo@canonical.com> References: <20220811191014.139882-1-mfo@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @canonical.com) X-ZM-MESSAGEID: 1660245059634100001 Content-Type: text/plain; charset="utf-8" The linux_xen template orders the "early" initrd file(s) _first_ (i.e., before the "real" initrd files) and that seems reasonable, as microcode updates usually come first. However, this usually breaks Linux boot with initrd under Xen because Xen assumes the real initrd is the first multiboot[2] module after the kernel, passing its address over to Linux in Xen's start_info struct. So, if a microcode-only initrd (i.e., without init/userspace) is found by grub-mkconfig, it ends up considered as a normal initrd by the Linux kernel, which cannot do anything with it (as it has no other files) and panic()s unable to mount root if it depends on a initrd to do that (e.g., root=3DUUID=3D...). ... Well, since Xen doesn't actually use the provided microcode by default / unless the 'ucode=3D' option is enabled, this isn't used in the general case (and breaks). Additionally, if an user enables the 'ucode=3D' option, that either specifies which module is to be used for microcode, or scans all modules (regardless of being first) for that. Thus, for Xen: - it is *not required* to have microcode first, - but it is *required* to have real initrd first So, fix it by ordering the real initrd before early initrd(s). After: # touch /boot/xen /boot/microcode.cpio # grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' multiboot /boot/xen ... module /boot/vmlinuz-5.4.0-122-generic ... module --nounzip /boot/initrd.img-5.4.0-122-generic module --nounzip /boot/microcode.cpio ... Corner case specific to Xen implementation details: It is actually _possible_ to have a microcode initrd first, but that requires a non-default option (so can't rely on it), and it turns out to be inconsistent with its counterpart (really shouldn't rely on it, as it may get confusing; below). 'ucode=3D1' does manually specify the first module is microcode _AND_ clears its bit in the module bitmap. The next module is now the 'new first', and gets passed to Linux as initrd. Good. 'ucode=3Dscan' checks all modules for microcode, but does _NOT_ clear a bit if it finds one (reasonable, as it can find that prepended in a "real" initrd anyway, which needs to be used). The first module still gets passed to Linux as initrd. Bad. Fixes: e86f6aafb8de ("grub-mkconfig/20_linux_xen: Support multiple early in= itrd images") Signed-off-by: Mauricio Faria de Oliveira Acked-by: Juergen Gross --- util/grub.d/20_linux_xen.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 50c62562b730..626aed40cbfd 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -307,7 +307,10 @@ for current_xen in ${reverse_sorted_xen_list}; do =20 initrd=3D if test -n "${initrd_early}" || test -n "${initrd_real}"; then - initrd=3D"${initrd_early} ${initrd_real}" + # Xen assumes the real initrd is the first module after the kernel. + # Additional (later) initrds can also be used for microcode update, + # with Xen option 'ucode=3D (non-default anyway). + initrd=3D"${initrd_real} ${initrd_early}" =20 initrd_display=3D for i in ${initrd}; do --=20 2.34.1