Skip to content

Feature/mod multi merge master 240#10

Merged
FREEWING-JP merged 42 commits intofeature/mod_multifrom
feature/mod_multi_merge_master_240
Mar 31, 2024
Merged

Feature/mod multi merge master 240#10
FREEWING-JP merged 42 commits intofeature/mod_multifrom
feature/mod_multi_merge_master_240

Conversation

@FREEWING-JP
Copy link
Copy Markdown
Owner

No description provided.

Clang can cross-compile to PE and is easier to setup than MinGW.
Remove some integer divisions because they emit function calls.
Use -O, because -O2 causes Undefined OpCode in QEMU / UEFI Shell.

Remove -mno-red-zone which triggers -Wunused-command-line-argument.

Set architecture in PE file manually:
EFI uses IMAGE_FILE_MACHINE_ARMTHUMB_MIXED = 0x01C2,
while the default is IMAGE_FILE_MACHINE_ARMNT = 0x01C4.
The exact command may vary by OS, this is for Arch Linux.
Apparently Boot20## are sometimes reserved for firmware even if
they seem to be free. Boot00## is the normal place to be.
Loading the image might take some minimal time. Optimize experience.
Hide cursor as well but restore it in ReadKey.
Metabolix and others added 11 commits December 31, 2023 18:20
Shim expects a filename or nothing in the load options.

To avoid an error message during boot, do several things:

When creating the NVRAM entry, use empty load options. The current
string ("HackBGRT\0") was just a decoration, and it's luckily ignored
by shim because the length is odd.

When creating the entry with BCDEdit, manually fix the load options.
The load options in BCDEdit entries start with "WINDOWS\0" followed
by UINT32 version, as seen in ReactOS struct BL_WINDOWS_LOAD_OPTIONS.
The version is 1, but BCDEdit seems to be happy with a higher number.
By setting this version to 'X' (0x58), the string becomes a valid
UCS-2 file name. Update the installer so that the HackBGRT loader is
installed with this weird file name.

The reason why the load options cannot be deleted completely is that
BCDEdit will recreate the entry on next boot if it doesn't find the
entry it just tried to create.

See: rhboot/shim#621
See: https://github.com/reactos/reactos/blob/v0.4.7/boot/environ/include/bl.h#L911
@FREEWING-JP FREEWING-JP self-assigned this Mar 20, 2024
@FREEWING-JP FREEWING-JP force-pushed the feature/mod_multi_merge_master_240 branch from 5f2088e to 63ff638 Compare March 20, 2024 14:02
@FREEWING-JP FREEWING-JP merged commit 773d6f5 into feature/mod_multi Mar 31, 2024
@FREEWING-JP FREEWING-JP deleted the feature/mod_multi_merge_master_240 branch March 31, 2024 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants