diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 04:57:17 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 04:57:17 +0100 |
| commit | 4966ca284132e4e52a9bee6f582527aa7f784ef6 (patch) | |
| tree | 023fc0c5a3e6b1daae91ce22ec01852a8074f2ff /dev/boot/src/HEL/AMD64 | |
| parent | a3da0eaaf7569948f83c65ff7997c4d1fc868603 (diff) | |
bootz: consolidate EFI namespace into Boot, finalize NetBoot fallback
Collapse the EFI namespace into Boot to unify BootZ's interface for firmware
handling. This simplifies calls to functions like Stop(), ThrowError(),
and ExitBootServices(), and improves consistency across boot modules.
Also rename SysChk/Module.cc to SysChk/SysChk.cc for naming consistency
with other modules.
Improve NetBoot fallback path in BootEFI:
- Ensure netboot.sys is read before ExitBootServices() to avoid allocation
issues after exiting firmware services.
- Reuse reader and thread objects if kernel boot fails.
- Update both AMD64 and ARM64 paths to follow the same logic.
Update all call sites to use Boot:: instead of EFI::.
Fixes: broken error handling and memory reads after ExitBootServices()
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/boot/src/HEL/AMD64')
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootEFI.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc index 4744892f..a6af4235 100644 --- a/dev/boot/src/HEL/AMD64/BootEFI.cc +++ b/dev/boot/src/HEL/AMD64/BootEFI.cc @@ -307,10 +307,15 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, fb_init(); FBDrawBitMapInRegion(zka_no_disk, NE_NO_DISK_WIDTH, NE_NO_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_NO_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_NO_DISK_HEIGHT) / 2); - EFI::Stop(); + Boot::Stop(); } - EFI::ExitBootServices(map_key, image_handle); + Boot::BootFileReader reader_netboot(L"netboot.sys", image_handle); + reader_netboot.ReadAll(0); + + Boot::BootThread* netboot_thread = nullptr; + + Boot::ExitBootServices(map_key, image_handle); // ---------------------------------------------------- // // Finally load the OS kernel. @@ -318,13 +323,8 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, if (kernel_thread->Start(handover_hdr, YES) != kEfiOk) { - Boot::BootFileReader reader_netboot(L"netboot.sys", image_handle); - reader_netboot.ReadAll(0); - - Boot::BootThread* netboot_thread = nullptr; - // ------------------------------------------ // - // If we succeed in reading the blob, then execute it. (That is NetBoot) + // If we fail into booting the kernel, then run NetBoot. // ------------------------------------------ // if (reader_netboot.Blob()) @@ -334,6 +334,6 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, netboot_thread->Start(handover_hdr, YES); } } - + CANT_REACH(); } |
