Skip to content

Commit

Permalink
OvmfPkg: Update LINUX_LOADER to allow unaligned user images
Browse files Browse the repository at this point in the history
Required in some distros, e.g. SliTaz. In that example bootx64.efi is the
kernel plus an extra loader which fetches its params from a text file.
That image has section alignment 0x20, whereas the default (0x7)
PcdImageProtectionPolicy enforces section alignment of EFI_PAGE_SIZE=0x1000
for all images.

In OpenDuet and OpenCore native loader the Pcd is already set to 0x03,
to not enforce this for user images (to allow legacy Apple images) - so
this distro I believe would already load via Duet; but this change is
required for it to load in AUDK OVMF.
  • Loading branch information
mikebeaton committed Mar 14, 2024
1 parent 11bfa6a commit 13f99fa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions OvmfPkg/IntelTdx/IntelTdxX64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@
# Allow execution of EfiReservedMemoryType, EfiConventionalMemory, EfiBootServicesData and EfiLoaderData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF40
gEfiMdePkgTokenSpaceGuid.PcdImageLoaderAllowMisalignedOffset|TRUE
gEfiMdePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000003
!else
# Allow execution of EfiConventionalMemory and EfiBootServicesData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF45
Expand Down
1 change: 1 addition & 0 deletions OvmfPkg/OvmfPkgIa32.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@
# Allow execution of EfiReservedMemoryType, EfiConventionalMemory, EfiBootServicesData and EfiLoaderData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF40
gEfiMdePkgTokenSpaceGuid.PcdImageLoaderAllowMisalignedOffset|TRUE
gEfiMdePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000003
!elseif $(WINDOWS_10_IA32) == TRUE
# Allow execution of EfiReservedMemoryType, EfiConventionalMemory, EfiBootServicesData and EfiRuntimeServicesData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF04
Expand Down
1 change: 1 addition & 0 deletions OvmfPkg/OvmfPkgIa32X64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@
# Allow execution of EfiReservedMemoryType, EfiConventionalMemory, EfiBootServicesData and EfiLoaderData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF40
gEfiMdePkgTokenSpaceGuid.PcdImageLoaderAllowMisalignedOffset|TRUE
gEfiMdePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000003
!endif

################################################################################
Expand Down
1 change: 1 addition & 0 deletions OvmfPkg/OvmfPkgX64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@
# Allow execution of EfiReservedMemoryType, EfiConventionalMemory, EfiBootServicesData and EfiLoaderData memory regions.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xFFFFFFFFFFFFFF40
gEfiMdePkgTokenSpaceGuid.PcdImageLoaderAllowMisalignedOffset|TRUE
gEfiMdePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000003
!endif

################################################################################
Expand Down

0 comments on commit 13f99fa

Please sign in to comment.