Blame 0008-OvmfPkg-allow-exclusion-of-the-shell-from-the-firmwa.patch

Gerd Hoffmann ced5d8
From 2d7c77e17a3461d53521b42221e468fb234d5893 Mon Sep 17 00:00:00 2001
Paolo Bonzini 348500
From: Laszlo Ersek <lersek@redhat.com>
Paolo Bonzini 348500
Date: Tue, 4 Nov 2014 23:02:53 +0100
Gerd Hoffmann ced5d8
Subject: [PATCH 08/21] OvmfPkg: allow exclusion of the shell from the firmware
Gerd Hoffmann ced5d8
 image (RH only)
59c3cd
59c3cd
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
59c3cd
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
59c3cd
59c3cd
- No manual / explicit code change is necessary, because the newly
59c3cd
  inherited OvmfPkg/AmdSev platform already has its own BUILD_SHELL
59c3cd
  build-time macro (feature test flag), with default value FALSE -- from
59c3cd
  upstream commit b261a30c900a ("OvmfPkg/AmdSev: add Grub Firmware Volume
59c3cd
  Package", 2020-12-14).
59c3cd
59c3cd
- Contextual differences from new upstream commits 2d8ca4f90eae ("OvmfPkg:
59c3cd
  enable HttpDynamicCommand", 2020-10-01) and 5ab6a0e1c8e9 ("OvmfPkg:
59c3cd
  introduce VirtioFsDxe", 2020-12-21) have been auto-resolved by
59c3cd
  git-cherry-pick.
59c3cd
59c3cd
- Remove obsolete commit message tags related to downstream patch
59c3cd
  management: Message-id, Patchwork-id, O-Subject, Acked-by
59c3cd
  (RHBZ#1846481).
59c3cd
59c3cd
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
59c3cd
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
59c3cd
59c3cd
- context difference from upstream commit ec41733cfd10 ("OvmfPkg: add the
59c3cd
  'initrd' dynamic shell command", 2020-03-04) correctly auto-resolved
59c3cd
59c3cd
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
59c3cd
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
59c3cd
59c3cd
- no change
59c3cd
59c3cd
Notes about the RHEL-8.0/20180508-ee3198e672e2 ->
59c3cd
RHEL-8.1/20190308-89910a39dcfd rebase:
59c3cd
59c3cd
- update the patch against the following upstream commits:
59c3cd
  - 4b888334d234 ("OvmfPkg: Remove EdkShellBinPkg in FDF", 2018-11-19)
59c3cd
  - 277a3958d93a ("OvmfPkg: Don't include TftpDynamicCommand in XCODE5
59c3cd
                  tool chain", 2018-11-27)
59c3cd
59c3cd
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
59c3cd
RHEL-8.0/20180508-ee3198e672e2 rebase:
59c3cd
59c3cd
- reorder the rebase changelog in the commit message so that it reads like
59c3cd
  a blog: place more recent entries near the top
59c3cd
- no changes to the patch body
59c3cd
59c3cd
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
59c3cd
59c3cd
- no change
59c3cd
59c3cd
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
59c3cd
59c3cd
- no changes
59c3cd
59c3cd
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
59c3cd
59c3cd
- no changes
59c3cd
59c3cd
Bugzilla: 1147592
Gerd Hoffmann b0c3af
Paolo Bonzini 348500
When '-D EXCLUDE_SHELL_FROM_FD' is passed to 'build', exclude the shell
Paolo Bonzini 348500
binary from the firmware image.
Paolo Bonzini 348500
Paolo Bonzini 348500
Peter Jones advised us that firmware vendors for physical systems disable
Paolo Bonzini 348500
the memory-mapped, firmware image-contained UEFI shell in
Paolo Bonzini 348500
SecureBoot-enabled builds. The reason being that the memory-mapped shell
Paolo Bonzini 348500
can always load, it may have direct access to various hardware in the
Paolo Bonzini 348500
system, and it can run UEFI shell scripts (which cannot be signed at all).
Paolo Bonzini 348500
Paolo Bonzini 348500
Intended use of the new build option:
Paolo Bonzini 348500
Paolo Bonzini 348500
- In-tree builds: don't pass '-D EXCLUDE_SHELL_FROM_FD'. The resultant
Paolo Bonzini 348500
  firmware image will contain a shell binary, independently of SecureBoot
Paolo Bonzini 348500
  enablement, which is flexible for interactive development. (Ie. no
Paolo Bonzini 348500
  change for in-tree builds.)
Paolo Bonzini 348500
Paolo Bonzini 348500
- RPM builds: pass both '-D SECURE_BOOT_ENABLE' and
Paolo Bonzini 348500
  '-D EXCLUDE_SHELL_FROM_FD'. The resultant RPM will provide:
Paolo Bonzini 348500
Paolo Bonzini 348500
  - OVMF_CODE.fd: SecureBoot-enabled firmware, without builtin UEFI shell,
Paolo Bonzini 348500
Paolo Bonzini 348500
  - OVMF_VARS.fd: variable store template matching OVMF_CODE.fd,
Paolo Bonzini 348500
Paolo Bonzini 348500
  - UefiShell.iso: a bootable ISO image with the shell on it as default
Paolo Bonzini 348500
    boot loader. The shell binary will load when SecureBoot is turned off,
Paolo Bonzini 348500
    and won't load when SecureBoot is turned on (because it is not
Paolo Bonzini 348500
    signed).
Paolo Bonzini 348500
Paolo Bonzini 348500
    UefiShell.iso is the reason we're not excluding the shell from the DSC
Paolo Bonzini 348500
    files as well, only the FDF files -- when '-D EXCLUDE_SHELL_FROM_FD'
Paolo Bonzini 348500
    is specified, the shell binary needs to be built the same, only it
Paolo Bonzini 348500
    will be included in UefiShell.iso.
Paolo Bonzini 348500
Paolo Bonzini 348500
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Paolo Bonzini 348500
(cherry picked from commit 9c391def70366cabae08e6008814299c3372fafd)
Paolo Bonzini 348500
(cherry picked from commit d9dd9ee42937b2611fe37183cc9ec7f62d946933)
59c3cd
(cherry picked from commit 23df46ebbe7b09451d3a05034acd4d3a25e7177b)
59c3cd
(cherry picked from commit f0303f71d576c51b01c4ff961b429d0e0e707245)
59c3cd
(cherry picked from commit bbd64eb8658e9a33eab4227d9f4e51ad78d9f687)
59c3cd
(cherry picked from commit 8628ef1b8d675ebec39d83834abbe3c8c8c42cf4)
59c3cd
(cherry picked from commit 229c88dc3ded9baeaca8b87767dc5c41c05afd6e)
59c3cd
(cherry picked from commit c2812d7189dee06c780f05a5880eb421c359a687)
Gerd Hoffmann b0c3af
---
Gerd Hoffmann b0c3af
 OvmfPkg/OvmfPkgIa32.fdf    | 2 ++
59c3cd
 OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
59c3cd
 OvmfPkg/OvmfPkgX64.fdf     | 2 ++
59c3cd
 3 files changed, 6 insertions(+)
Gerd Hoffmann b0c3af
Gerd Hoffmann b0c3af
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
Gerd Hoffmann ced5d8
index a6b2142ccd0c..b5bc8407e7d7 100644
Gerd Hoffmann b0c3af
--- a/OvmfPkg/OvmfPkgIa32.fdf
Gerd Hoffmann b0c3af
+++ b/OvmfPkg/OvmfPkgIa32.fdf
Gerd Hoffmann ced5d8
@@ -283,12 +283,14 @@ [FV.DXEFV]
Paolo Bonzini 348500
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
59c3cd
 INF  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
Gerd Hoffmann b0c3af
 
Gerd Hoffmann b0c3af
+!ifndef $(EXCLUDE_SHELL_FROM_FD)
b846ca
 !if $(TOOL_CHAIN_TAG) != "XCODE5"
Paolo Bonzini 7ae6f1
 INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
59c3cd
 INF  ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
fdb3e7
 INF  OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
Gerd Hoffmann b0c3af
 !endif
b846ca
 INF  ShellPkg/Application/Shell/Shell.inf
Gerd Hoffmann b0c3af
+!endif
Gerd Hoffmann b0c3af
 
Daniel P. Berrangé e6c2de
 INF MdeModulePkg/Logo/LogoDxe.inf
59c3cd
 
Gerd Hoffmann b0c3af
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
Gerd Hoffmann ced5d8
index 49266dd46768..f4fa19bb013c 100644
Gerd Hoffmann b0c3af
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
Gerd Hoffmann b0c3af
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
Gerd Hoffmann ced5d8
@@ -287,12 +287,14 @@ [FV.DXEFV]
Paolo Bonzini 348500
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
59c3cd
 INF  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
Gerd Hoffmann b0c3af
 
Gerd Hoffmann b0c3af
+!ifndef $(EXCLUDE_SHELL_FROM_FD)
b846ca
 !if $(TOOL_CHAIN_TAG) != "XCODE5"
Paolo Bonzini 7ae6f1
 INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
59c3cd
 INF  ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
fdb3e7
 INF  OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
Gerd Hoffmann b0c3af
 !endif
b846ca
 INF  ShellPkg/Application/Shell/Shell.inf
Gerd Hoffmann b0c3af
+!endif
Gerd Hoffmann b0c3af
 
Daniel P. Berrangé e6c2de
 INF MdeModulePkg/Logo/LogoDxe.inf
59c3cd
 
Gerd Hoffmann b0c3af
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
Gerd Hoffmann ced5d8
index ba7f26d01dc4..dfd17804c2a2 100644
Gerd Hoffmann b0c3af
--- a/OvmfPkg/OvmfPkgX64.fdf
Gerd Hoffmann b0c3af
+++ b/OvmfPkg/OvmfPkgX64.fdf
Gerd Hoffmann ced5d8
@@ -309,12 +309,14 @@ [FV.DXEFV]
Paolo Bonzini 348500
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
59c3cd
 INF  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
Gerd Hoffmann b0c3af
 
Gerd Hoffmann b0c3af
+!ifndef $(EXCLUDE_SHELL_FROM_FD)
b846ca
 !if $(TOOL_CHAIN_TAG) != "XCODE5"
Paolo Bonzini 7ae6f1
 INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
59c3cd
 INF  ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
fdb3e7
 INF  OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
Gerd Hoffmann b0c3af
 !endif
b846ca
 INF  ShellPkg/Application/Shell/Shell.inf
Gerd Hoffmann b0c3af
+!endif
Gerd Hoffmann b0c3af
 
Daniel P. Berrangé e6c2de
 INF MdeModulePkg/Logo/LogoDxe.inf
59c3cd
 
59c3cd
-- 
Gerd Hoffmann ced5d8
2.35.1
59c3cd