Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OvmfPkg: Update LINUX_LOADER PcdImageProtectionPolicy to allow unaligned user images #62

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

mikebeaton
Copy link
Contributor

@mikebeaton mikebeaton commented Mar 13, 2024

Required in some current distros, e.g. SliTaz https://slitaz.org/

$ objdump -p -h ~/Public/bootx64.efi 

/Users/mjsbeaton/Public/bootx64.efi:	file format coff-x86-64
Characteristics 0x206
	executable
	line numbers stripped
	debugging information removed

.
.
.
SectionAlignment        00000020
.
.
.
NumberOfRvaAndSizes     00000006

.
.
.

Sections:
Idx Name          Size     VMA              Type
  0 .setup        000035e0 0000000000000200 TEXT
  1 .reloc        00000020 00000000000037e0 DATA
  2 .text         003cf010 0000000000003800 TEXT
  3 .bss          00000000 00000000003d2810 BSS
$ 

bootx64.zip

@mikebeaton mikebeaton requested a review from mhaeuser March 13, 2024 18:11
@mikebeaton
Copy link
Contributor Author

mikebeaton commented Mar 13, 2024

BTW this is not shim, nor even a standard build of the kernel. It is a lightweight distro which I was using to test HttpBoot, in fact. The bootx64.efi is the kernel, plus an extra loader which fetches its params from a text file. This image has section alignment 0x20, whereas the Pcd enforces (EFI_PAGE_SIZE=) 0x1000 for all images, by default. In OpenDuet and OpenCore native loader, we already have the Pcd changed, to not enforce that for user images (comments suggest this is to allow legacy Apple images) - so this distro I believe would already load via Duet; but it won't currently load in AUDK OVMF, even with LINUX_LOADER defined - hence this requested/suggested change.

@mikebeaton mikebeaton requested review from MikhailKrichanov and removed request for mhaeuser March 13, 2024 19:07
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.
@mikebeaton mikebeaton merged commit 13f99fa into master Mar 14, 2024
41 checks passed
@mikebeaton mikebeaton deleted the linux_loader_too branch March 14, 2024 07:55
mikebeaton pushed a commit to mikebeaton/audk that referenced this pull request Apr 16, 2024
Azure should install code coverage tool (lcov), it didn't
exist on Fedora and Ubuntu by default.

Update docker setting, pick below solution between 47addc9 and 3b3eb8f
3b3eb8f Fixes and improvements to dev containers (acidanthera#69)
54e5bd1 Enable GTK on Fedora QEMU (acidanthera#63)
f1c7a20 Fedora: install code coverage tools for GCC (acidanthera#62)
2ce82af Ubuntu-22: Add initial Ubuntu-22 image (acidanthera#61)
14d2aba Add Fedora 37 image with gcc12 (acidanthera#60)
5b8a008 Add dotnet runtime to fedora build (acidanthera#57)
f5c874a Fix platform build file name for EDK2 change (acidanthera#58)
48540ad Ubuntu-20: Fix dev image entrypoint (acidanthera#55)
98e849d Fedora-35: Add Powershell to build image (acidanthera#52)

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Oliver Steffen <osteffen@redhat.com>
Cc: Chris Fernald <chfernal@microsoft.com>
Signed-off-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
Reviewed-by: Chris Fernald <chfernal@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants