diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-23 00:59:31 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-23 01:04:00 +0100 |
| commit | 77bf7cab39fef40797e8832aaef91abbdf0098f5 (patch) | |
| tree | 157f6f82188c505f1333abf93aeda63b3373cf04 /Private/NewBoot | |
| parent | 954285b6c9553a047d0789707ad520c84099e74a (diff) | |
Kernel and Bootloader: See below.
Kernel: Add kPefArchPowerPC type.
Kernel: Working on NewFS support for NewKernel.
Kernel: Cleaned-up DriveManager.
Kernel: Use kernel mouse on install mode.
Bootloader: Refactor and cleanup.
FirmwareKit: Fix EPM header.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/NewBoot')
| -rw-r--r-- | Private/NewBoot/CxxRuntime/UnwindCxxKit.cxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/CDROM/INSTALLER/.gitkeep | 0 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootATA.cxx | 12 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx | 4 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx | 8 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 34 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 3 |
7 files changed, 35 insertions, 28 deletions
diff --git a/Private/NewBoot/CxxRuntime/UnwindCxxKit.cxx b/Private/NewBoot/CxxRuntime/UnwindCxxKit.cxx index c6e09fe2..8adfc981 100644 --- a/Private/NewBoot/CxxRuntime/UnwindCxxKit.cxx +++ b/Private/NewBoot/CxxRuntime/UnwindCxxKit.cxx @@ -23,7 +23,7 @@ EXTERN_C void __unwind(void (**finis)(void), int cnt) EXTERN_C Int32 EfiMain(EfiHandlePtr handle, EfiSystemTable* SystemTable) { - SystemTable->ConOut->OutputString(SystemTable->ConOut, L"NewBoot: C++ Runtime Add-in\r\n"); + SystemTable->ConOut->OutputString(SystemTable->ConOut, L"NewBoot.exe: C++ Runtime Add-in\r\n"); return kEfiOk; }
\ No newline at end of file diff --git a/Private/NewBoot/Source/CDROM/INSTALLER/.gitkeep b/Private/NewBoot/Source/CDROM/INSTALLER/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Private/NewBoot/Source/CDROM/INSTALLER/.gitkeep diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx index 1d94c776..110bdf08 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx @@ -72,7 +72,7 @@ ATAInit_Retry: if (statRdy & ATA_SR_ERR) { writer.Write( - L"NewBoot: ATA: Select error, not an IDE based hard-drive.\r\n"); + L"NewBoot.exe: ATA: Select error, not an IDE based hard-drive.\r\n"); return false; } @@ -108,21 +108,21 @@ ATAInit_Retry: /* differentiate ATA, ATAPI, SATA and SATAPI */ if (cl == 0x14 && ch == 0xEB) { - writer.Write(L"NewBoot: PATAPI drive detected.\r\n"); + writer.Write(L"NewBoot.exe: PATAPI drive detected.\r\n"); kATADeviceType = kATADevicePATA_PI; } if (cl == 0x69 && ch == 0x96) { - writer.Write(L"NewBoot: SATAPI drive detected.\r\n"); + writer.Write(L"NewBoot.exe: SATAPI drive detected.\r\n"); kATADeviceType = kATADeviceSATA_PI; } if (cl == 0x0 && ch == 0x0) { - writer.Write(L"NewBoot: PATA drive detected.\r\n"); + writer.Write(L"NewBoot.exe: PATA drive detected.\r\n"); kATADeviceType = kATADevicePATA; } if (cl == 0x3c && ch == 0xc3) { - writer.Write(L"NewBoot: SATA drive detected.\r\n"); + writer.Write(L"NewBoot.exe: SATA drive detected.\r\n"); kATADeviceType = kATADeviceSATA; } @@ -211,7 +211,7 @@ BDeviceATA::BDeviceATA() noexcept { BTextWriter writer; - writer.Write(L"NewBoot: Drive is OnLine.\r\n"); + writer.Write(L"NewBoot.exe: Drive is OnLine.\r\n"); } } /** diff --git a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx index 6d2998f3..d59251e6 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx @@ -27,11 +27,11 @@ Void boot_try_write_partition_map(const Char* namePart, SizeT namePartLength, BTextWriter writer; - writer.Write(L"NewBoot: Reading EPM boot block..\r\n"); + writer.Write(L"NewBoot.exe: Reading EPM boot block...\r\n"); for (SizeT i = 0; i < kEPMMagicLength; i++) { if (buf[i] != kEPMMagic[i]) { - writer.Write(L"NewBoot: Writing EPM boot block..\r\n"); + writer.Write(L"NewBoot.exe: Writing EPM boot block...\r\n"); BootBlockType* bootBlock = (BootBlockType*)buf; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx index b9cc7527..01f4787f 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx @@ -46,12 +46,12 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, EfiHandlePtr ImageHandl EfiGUID guidImg = EfiGUID(EFI_LOADED_IMAGE_PROTOCOL_GUID); if (BS->HandleProtocol(ImageHandle, &guidImg, (void**)&img) != kEfiOk) { - mWriter.Write(L"NewBoot: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); + mWriter.Write(L"NewBoot.exe: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); this->mErrorCode = kNotSupported; } if (BS->HandleProtocol(img->DeviceHandle, &guidEfp, (void**)&efp) != kEfiOk) { - mWriter.Write(L"NewBoot: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); + mWriter.Write(L"NewBoot.exe: Fetch-Protocol: No-Such-Protocol").Write(L"\r\n"); this->mErrorCode = kNotSupported; return; } @@ -59,7 +59,7 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, EfiHandlePtr ImageHandl /// Start doing disk I/O if (efp->OpenVolume(efp, &rootFs) != kEfiOk) { - mWriter.Write(L"NewBoot: Fetch-Protocol: No-Such-Volume").Write(L"\r\n"); + mWriter.Write(L"NewBoot.exe: Fetch-Protocol: No-Such-Volume").Write(L"\r\n"); this->mErrorCode = kNotSupported; return; } @@ -68,7 +68,7 @@ BFileReader::BFileReader(const CharacterTypeUTF16* path, EfiHandlePtr ImageHandl if (rootFs->Open(rootFs, &kernelFile, mPath, kEFIFileRead, kEFIReadOnly) != kEfiOk) { - mWriter.Write(L"NewBoot: Fetch-Protocol: No-Such-Path: ") + mWriter.Write(L"NewBoot.exe: Fetch-Protocol: No-Such-Path: ") .Write(mPath) .Write(L"\r\n"); this->mErrorCode = kNotSupported; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index b4e7b56d..9b7aa034 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -27,21 +27,22 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, InitGOP(); // Quick Toolkit for UI BTextWriter writer; - BDeviceATA ataDrv; - - Char namePart[kEPMNameLength] = { "NewKernel Standard System" }; - - boot_try_write_partition_map(namePart, kEPMNameLength, &ataDrv); - /// Splash screen stuff - writer.Write(L"MahroussLogic (R) NewBoot: ") + writer.Write(L"MahroussLogic (R) NewBoot.exe: ") .Write(BVersionString::Shared()); - writer.Write(L"\r\nNewBoot: Firmware Vendor: ") + writer.Write(L"\r\nNewBoot.exe: Firmware Vendor: ") .Write(SystemTable->FirmwareVendor) .Write(L"\r\n"); + BDeviceATA ataDrv; + + if (ataDrv) { + Char namePart[kEPMNameLength] = { "HCoreSystemPartition" }; + boot_try_write_partition_map(namePart, kEPMNameLength, &ataDrv); + } + /// Read Kernel blob. BFileReader kernelImg(L".HCORE", ImageHandle); @@ -123,7 +124,7 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, BCopyMem(handoverHdrPtr->f_FirmwareVendorName, SystemTable->FirmwareVendor, handoverHdrPtr->f_FirmwareVendorLen); - writer.Write(L"NewBoot: Fetch ACPI's 'RSD PTR'...").Write(L"\r\n"); + writer.Write(L"NewBoot.exe: Fetching ACPI's 'RSD PTR'...").Write(L"\r\n"); for (SizeT indexVT = 0; indexVT < SystemTable->NumberOfTableEntries; ++indexVT) { @@ -138,14 +139,12 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, vendorTable[6] == 'R' && vendorTable[7] == ' ') { handoverHdrPtr->f_HardwareTables.f_VendorTable = (VoidPtr)vendorTable; - writer.Write(L"NewBoot: Found ACPI's 'RSD PTR' table on this machine.").Write(L"\r\n"); + writer.Write(L"NewBoot.exe: Found ACPI's 'RSD PTR' table on this machine.").Write(L"\r\n"); break; } } - EFI::ExitBootServices(MapKey, ImageHandle); - /// TODO: Set this to what we found inside NewFS partition. bool isIniNotFound = true; @@ -154,20 +153,27 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, handoverHdrPtr->f_Version = 0x1011; handoverHdrPtr->f_Bootloader = 0x11; // Installer + writer.Write(L"NewBoot.exe: Installing NewKernel and it's components...\r\n"); + + EFI::ExitBootServices(MapKey, ImageHandle); + Main(handoverHdrPtr); } else { handoverHdrPtr->f_Magic = kHandoverMagic; handoverHdrPtr->f_Version = 0x1011; handoverHdrPtr->f_Bootloader = 0xDD; // System present - Main(handoverHdrPtr); + writer.Write(L"NewBoot.exe: Running NewKernel...\r\n"); + + EFI::ExitBootServices(MapKey, ImageHandle); + } EFI::Stop(); return kEfiOk; } else { - writer.Write(L"NewBoot: Error-Code: HLDR-0003\r\n"); + writer.Write(L"NewBoot.exe: Error-Code: HLDR-0003\r\n"); } EFI::Stop(); diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 639fd114..e4ed6cbe 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -37,6 +37,7 @@ bootloader-amd64: compile-amd64 $(LD_GNU) $(OBJ) $(LD_FLAGS) -o NewBoot.exe $(COPY) NewBoot.exe CDROM/EFI/BOOT/BOOTX64.EFI $(COPY) NewBoot.exe CDROM/EFI/BOOT/NEWBOOT.EFI + $(COPY) ../../NewKernel.exe CDROM/INSTALLER/ .PHONY: compile-amd64 compile-amd64: @@ -56,7 +57,7 @@ download-edk: .PHONY: clean clean: - $(REM) $(REM_FLAG) $(OBJ) NewBoot.exe HCoreKrnl.exe OVMF.fd + $(REM) $(REM_FLAG) $(OBJ) NewBoot.exe NewKernel.exe OVMF.fd .PHONY: help help: |
