render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame SOURCES/0016-OvmfPkg-allow-exclusion-of-the-shell-from-the-firmwa.patch

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