2738 Commits

Author SHA1 Message Date
Mikhail Krichanov
709984a981 Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202502 tag. 2025-04-07 13:54:15 +03:00
Mike Beaton
9cdba17a1a IntrinsicLib: Move from CryptoPkg to MdePkg 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
ba561ef7ff Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202405 tag. 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
0d9d6f987b Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202311. 2025-04-07 12:32:50 +03:00
Mikhail Krichanov
992385e15e SecurePE: Defined new PcdImageProtectionPolicy. 2025-04-07 12:30:28 +03:00
Mikhail Krichanov
48b806f46f UE: Support UE generation and consumption. 2025-04-07 12:24:28 +03:00
Mikhail Krichanov
4ac2e8a4d0 OvmfPkg: Increased SECFV_SIZE at FVMAIN_COMPACT's expense to fix CLANGPDB compilation. 2025-04-07 12:24:28 +03:00
Mikhail Krichanov
e46d356fc9 MdePkg/UefiImageLib: Support multi-format and multi-source architecture
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:24:27 +03:00
Mikhail Krichanov
63b9e567e5 Build: Replaced GCC5 toolchain with GCC. 2025-04-07 12:24:27 +03:00
Mikhail Krichanov
20dd836214 MdeModulePkg/Core/Dxe: Integrate CPU Architectural producer
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3223

In the current design, memory protection is not available till CpuDxe
is loaded. To resolve this, introduce CpuArchLib to move the
CPU Architectural initialization to DxeCore.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:23:28 +03:00
Mikhail Krichanov
7193c4e313 BaseTools: Introduce new HII section design 2025-04-07 12:18:23 +03:00
Marvin Häuser
f7146c7ae7 Remove hacks related to former lack of XCODE5 .hii support 2025-04-07 12:18:23 +03:00
Mikhail Krichanov
bc87d7b430 Drop support for the TE format 2025-04-07 12:18:22 +03:00
Mikhail Krichanov
4d4dcbe71f BaseTools: Removed GCC48/49 toolchains, refactored tools_def.template. 2025-04-07 12:13:58 +03:00
Mikhail Krichanov
5d894921a3 BaseTools: Replaced GenFw with ImageTool and MicroTool. 2025-04-07 12:13:57 +03:00
Mikhail Krichanov
09a0c067d0 SecurePE: Replaced old PE loader with Secure one. 2025-04-07 12:12:35 +03:00
Vitaly Cheptsov
94327aacda OvmfPkg/DxePciLibI440FxQ34: Add UefiBootServicesTableLib dependency
In case PlatformBootManagerLib does not have PciLib dependency,
we need to explicitly depend on UefiBootServicesTableLib.
Otherwise UefiBootServicesTableLib may not be constructed before
DxePciLibI440FxQ35, which uses a constructor-less PcdLib that directly
accesses gBS.

This can be viewed as a bug in the current implementation of BaseTools,
namely GetModuleLibInstances. This function drops all constructor-less
dependencies from the dependency resolution list to avoid dependency
cycles, which at the same time causes issues like above.

To properly fix the issue one should go over each library with
constructors and for each its dependency without constructors add all
the secondary dependencies that do have constructors. While doable,
it may cause considerable performance issues and is thus not done
in this patch.

Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2025-04-07 12:02:07 +03:00
Goldfish64
e3d661a533 OvmfPkg/SioBusDxe: Add PS/2 mouse support
SioBusDxe by default does not create a device for PS/2 mice, this patch adds that device.
2025-04-07 12:02:07 +03:00
Oliver Smith-Denny
30547859f2 OvmfPkg: OvmfIA32X64: Add Custom Stack Cookie Checking
To provide an example and test the code within edk2, this
adds stack cookie checking to OvmfIA32X64, doing no checking
for SEC and PEI_CORE modules, static cookies for PEIMs, and
dynamic cookies for all other module types.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2025-02-07 02:23:11 +00:00
Oliver Smith-Denny
6d741357c2 OvmfPkg: Add RDRAND Support To QEMU
In order to use dynamic stack cookies, we need RDRAND support
from QEMU, so this updates the QEMU launching code for OvmfPkg
to include RDRAND support.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2025-02-07 02:23:11 +00:00
Oliver Smith-Denny
efbf5ed08c MdePkg: Move StackCheckLibStaticInit to StackCheckLib
This commit oves StackCheckLib from a NULL lib to an instance of
StackCheckLib. This requires every entry point to add a library
dependency on StackCheckLib. It also requires every SEC module
to have a dependency on StackCheckLib because there is no
standard SEC entry point.

It allows for greater flexibility for a platform to apply stack
cookies and simplifies DSC logic.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-02-07 02:23:11 +00:00
Mike Maslenkin
755d4b9397 OvmfPkg: fix warning about uninitialized variable
GenericQemuLoadImageLib.c: In function 'QemuLoadKernelImage':
GenericQemuLoadImageLib.c:323:5: error: 'CommandLine' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
     UnicodeSPrintAsciiFormat (
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
       KernelLoadedImage->LoadOptions,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       KernelLoadedImage->LoadOptionsSize,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%a%a",
       ~~~~~~~
       (CommandLineSize == 0) ?  "" : CommandLine,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (InitrdSize == 0)      ?  "" : " initrd=initrd"
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       );
       ~
cc1: all warnings being treated as errors

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-29 17:20:57 +01:00
Gerd Hoffmann
bba72ffbe1 OvmfPkg/QemuKernelLoaderFsDxe: use SIZE_OF_EFI_FILE_INFO
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-28 23:28:45 +00:00
Gerd Hoffmann
18984b68fe OvmfPkg: make legacy direct kernel loader code nx clean
kernel pages are code not data.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-27 22:59:55 +00:00
Anthony PERARD
8c1e786e50 OvmfPkg/XenPvBlkDxe: Update disk size calculation
The specification wasn't clear and even contradict itself regarding
the calculation of the disk size. This have been clarified by Xen
commit 221f2748e8da ("blkif: reconcile protocol specification with
in-use implementations").

https://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=221f2748e8dabe8361b8cdfcffbeab9102c4c899

The value from the xenstore node "sectors" must be multiplied by 512
to have the size of the disk.

Calculation of LastBlock is now the same for both CD-ROM case and
generic case.

Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
2025-01-27 14:37:53 +00:00
Anthony PERARD
3cf7a644eb OvmfPkg/IndustryStandard/Xen: Update io/blkif.h
Import the latest version of blkif.h header from Xen.

Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
2025-01-27 14:37:53 +00:00
Gerd Hoffmann
1f19c3d6ee OvmfPkg/GenericQemuLoadImageLib: fix cmdline + initrd handling
Commit 459f5ffa24ae ("OvmfPkg/QemuKernelLoaderFsDxe: rework direct
kernel boot filesystem") has a small change in behavior:  In case
there is no data the file is not created and attempts to open file
return EFI_NOT_FOUND.  Old behavior was to add a zero-length file
to the filesystem.

Fix GenericQemuLoadImageLib to handle EFI_NOT_FOUND correctly for
'initrd' and 'cmdline'.

Reported-by: Srikanth Aithal <sraithal@amd.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-24 18:26:37 +00:00
Gerd Hoffmann
b873e8b8e3 OvmfPkg/QemuKernelLoaderFsDxe: root directory name should be ""
UEFI spec says so, fix it.

https://uefi.org/specs/UEFI/2.11/13_Protocols_Media_Access.html#efi-file-info

Reported-by: Laszlo Ersek <laszlo.ersek@posteo.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-24 17:12:07 +00:00
Anthony PERARD
99cbb63652 OvmfPkg/OvmfXen: use PeiPcdLib for PEI_CORE
Commit d64d1e195ceb ("MdeModulePkg: PeiMain: Introduce implementation
of delayed dispatch") introduced a new usage of the TimerLib which
uses a dynamic PCD in OvmfXen platform. But PeiMain has only access to
a NULL version of PcdLib, so OvmfXen can't start.

Introduce PeiPcdLib for PEI_CORE so PeiMain can read dynamic PCDs.

Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
2025-01-24 12:57:59 +00:00
Heinrich Schuchardt
feb8d49834 OvmfPkg/RiscVVirtQemu.dsc: enable VGA support
QEMU enables VIRTIO_VGA by default.

Libvirt falls back from virtio-gpu-pci to virtio-vga if made available by
QEMU.

We need to enable VGA support to get video output for EDK II in
virt-manager.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-23 12:43:11 +00:00
Gerd Hoffmann
35232f165c OvmfPkg: document opt/org.tianocore/EnableLegacyLoader option
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
1549bf11cc OvmfPkg/X86QemuLoadImageLib: make legacy loader configurable.
Add the 'opt/org.tianocore/EnableLegacyLoader' FwCfg option to
enable/disable the insecure legacy linux kernel loader.

For now this is enabled by default.  Probably the default will be
flipped to disabled at some point in the future.

Also print a warning to the screen in case the linux kernel secure
boot verification has failed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
4b507b4966 OvmfPkg/GenericQemuLoadImageLib: support booting via shim
Try load shim first.  In case that succeeded update the command line to
list 'kernel' first so shim will fetch the kernel from the kernel loader
file system.

This allows to use direct kernel boot with distro kernels and secure
boot enabled.  Usually distro kernels can only be verified by distro
shim using the distro keys compiled into the shim binary.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
3da39f2cb6 OvmfPkg/X86QemuLoadImageLib: support booting via shim
Try load shim first.  In case that succeeded update the command line to
list 'kernel' first so shim will fetch the kernel from the kernel loader
file system.

This allows to use direct kernel boot with distro kernels and secure
boot enabled.  Usually distro kernels can only be verified by distro
shim using the distro keys compiled into the shim binary.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
c45051450e OvmfPkg/QemuKernelLoaderFsDxe: don't quit when named blobs are present
Allows to use the qemu kernel loader pseudo file system for other
purposes than loading a linux kernel (or efi binary).  Passing
startup.nsh for EFI shell is one example.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
46ae4e4b95 OvmfPkg/QemuKernelLoaderFsDxe: accept absolute paths
EFI shell looks for "\startup.nsh".
Try "-fw_cfg name=etc/boot/startup.nsh,string='echo hello'" ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
1111e9fe70 OvmfPkg/QemuKernelLoaderFsDxe: drop bogus assert
Triggers when trying to get root directory info.
Reproducer:
 * Use qemu -kernel with something edk2 can not load.
 * When dropped into the efi shell try inspect the file system.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
adf385ecab OvmfPkg/QemuKernelLoaderFsDxe: allow longer file names
QEMU_FW_CFG_FNAME_SIZE is 56. 'etc/boot/' prefix is minus 9.  Add one
for the terminating '\0'.  Effective max size is 48.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
20df7c42bd OvmfPkg/QemuKernelLoaderFsDxe: add support for named blobs
Load all named fw_cfg blobs with "etc/boot/" prefix into the pseudo
filesystem.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
459f5ffa24 OvmfPkg/QemuKernelLoaderFsDxe: rework direct kernel boot filesystem
Split KERNEL_BLOB struct into two:

 * One (KERNEL_BLOB_ITEMS) static array describing how to load (unnamed)
   blobs from fw_cfg.
 * And one (KERNEL_BLOB) dynamically allocated linked list carrying the
   data blobs for the pseudo filesystem.

Also add some debug logging.  Prefix most functions with 'QemuKernel'
for consistency and easier log file grepping.  Add some small helper
functions.

This refactoring prepares for loading blobs in other ways.
No (intentional) change in filesystem protocol behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-21 13:45:46 +01:00
Gerd Hoffmann
f9a0e54953 OvmfPkg/OvmfDisplayPcds.dsc.inc: set SetupConOut too
Setting PcdSetupConOut* to zero turns on autodetection mode
for rows and cols, so the firmware setup application will use
the use complete available screen space.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
df35307196 OvmfPkg/OvmfDisplayPcds.dsc.inc: set SetupVideoResolution too
Set both PcdVideo*Resolution and PcdSetupVideo*Resolution PCDs.

This avoids pointless video mode changes when entering and leaving
the firmware setup application.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
fde034447f OvmfPkg/PlatformDxe: set SetupVideoResolution too
Set both PcdVideo*Resolution and PcdSetupVideo*Resolution PCDs.

This avoids pointless video mode changes when entering and leaving
the firmware setup application.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
b4536e36c4 OvmfPkg/VirtioGpuDxe: set SetupVideoResolution too
Set both PcdVideo*Resolution and PcdSetupVideo*Resolution PCDs.

This avoids pointless video mode changes when entering and leaving
the firmware setup application.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
1d2558af76 OvmfPkg/QemuVideoDxe: set SetupVideoResolution too
Set both PcdVideo*Resolution and PcdSetupVideo*Resolution PCDs.

This avoids pointless video mode changes when entering and leaving
the firmware setup application.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
2b72a70cd1 OvmfPkg/RiscVVirtQemu.dsc: use OvmfDisplayPcds.dsc.inc
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
787450af9c OvmfPkg/OvmfXen.dsc: use OvmfDisplayPcds.dsc.inc
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Gerd Hoffmann
c3427ae439 OvmfPkg: move display pcds to OvmfDisplayPcds.dsc.inc include file
This way we have the display configuration in a single place and
need to change one file only to update all build variants.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-20 11:43:58 +00:00
Mike Beaton
076ef39ba2 OvmfPkg: Use OvmfPkg/Include/*/Shell*.inc throughout
While fixing https://github.com/tianocore/edk2/pull/6092 (the
fact that some OvmfPkg and ArmVirtPkg platforms included residual
NetworkPkg components even when compiled with -D NETWORK_ENABLE=0),
it was noted that OvmfPkg/Include/*/Shell*.inc files which apply
the required fix logic are available and already used in some
OvmfPkg platforms.

This commit applies these files consistently within OvmfPkg.

This has the side effect that some platforms now include one or
more of HttpDynamicCommand, VariablePolicyDynamicCommand and
LinuxInitrdDynamicShellCommand when they previously did not.
This fixes unintentional drift between platforms, and provides
additional shell commands which may be useful in some cases.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-01-16 23:06:40 +00:00
Mike Beaton
9a21320361 OvmfPkg: Include no network components with -D NETWORK_ENABLE=0
This issue showed up when addressing
https://bugzilla.tianocore.org/show_bug.cgi?id=4829
in https://github.com/tianocore/edk2/pull/6087 .

Various OvmfPkg and ArmVirtPkg platforms include some residual NetworkPkg
components when compiled with -D NETWORK_ENABLE=0, even though they use
NetworkPkg includes intended to allow all NetworkPkg components to be
disabled on this flag.

For the OvmfPkg Intel platforms only, commit
d933ec115bdf9be1d8dfe6a818414a14973cc0d3 started
the change of not including these residual NetworkPkg
components, and commit
7f17a155640a2a9e1f7b0f3522628ee2c6f62624 completed it.

This commit rolls these changes out to the remaining OvmfPkg platforms
where they make sense in the same way.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-01-16 23:06:40 +00:00