From a01ba7acb4786a6354349408b3bcc4c2d007b274 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 14 Apr 2025 09:42:28 +0200 Subject: bootloader, netboot: integrate EFI_SIMPLE_NETWORK_PROTOCOL for HTTP-based kernel fetching - Added BootNet module to support network boot using EFI_SIMPLE_NETWORK_PROTOCOL - Replaced ModuleMain with BootloaderMain as unified entry point - Implemented EFI protocol discovery, startup, and logging for netboot - Updated linker scripts, GDB configs, and build targets accordingly - Laid groundwork for full HTTP/TCP/IP bootloader logic - Improved kernel handoff logic and memory allocation fallback handling Signed-off-by: Amlal El Mahrouss --- dev/kernel/KernelKit/DeviceMgr.h | 4 ++-- dev/kernel/KernelKit/FileMgr.h | 2 +- dev/kernel/KernelKit/ProcessScheduler.h | 16 ++++++++-------- dev/kernel/KernelKit/Timer.h | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'dev/kernel/KernelKit') diff --git a/dev/kernel/KernelKit/DeviceMgr.h b/dev/kernel/KernelKit/DeviceMgr.h index fcafa7a5..9cfc54dd 100644 --- a/dev/kernel/KernelKit/DeviceMgr.h +++ b/dev/kernel/KernelKit/DeviceMgr.h @@ -52,13 +52,13 @@ namespace Kernel IDeviceObject(const IDeviceObject&) = default; public: - virtual IDeviceObject& operator<<(T Data) + virtual IDeviceObject& operator<<(T Data) { fOut(this, Data); return *this; } - virtual IDeviceObject& operator>>(T Data) + virtual IDeviceObject& operator>>(T Data) { fIn(this, Data); return *this; diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h index b4da6d5b..03e74ee8 100644 --- a/dev/kernel/KernelKit/FileMgr.h +++ b/dev/kernel/KernelKit/FileMgr.h @@ -347,7 +347,7 @@ namespace Kernel const Encoding* restrict_type) : fFile(Class::GetMounted()->Open(path, restrict_type)) { - SizeT kRestrictCount = kRestrictMax; + SizeT kRestrictCount = kRestrictMax; const FileRestrictKind kRestrictList[] = { { .fRestrict = kRestrictR, diff --git a/dev/kernel/KernelKit/ProcessScheduler.h b/dev/kernel/KernelKit/ProcessScheduler.h index db6f9aed..cff2ce6b 100644 --- a/dev/kernel/KernelKit/ProcessScheduler.h +++ b/dev/kernel/KernelKit/ProcessScheduler.h @@ -181,7 +181,7 @@ namespace Kernel AffinityKind Affinity{AffinityKind::kStandard}; ProcessStatusKind Status{ProcessStatusKind::kFinished}; UInt8* StackReserve{nullptr}; - ProcessImage Image{}; + ProcessImage Image{}; SizeT StackSize{kSchedMaxStackSz}; IDylibObject* DylibDelegate{nullptr}; SizeT MemoryCursor{0UL}; @@ -205,9 +205,9 @@ namespace Kernel UIntPtr SignalID; }; - ProcessSignal ProcessSignal; + ProcessSignal ProcessSignal; ProcessMemoryHeapList* ProcessMemoryHeap{nullptr}; - ProcessTeam* ProcessParentTeam; + ProcessTeam* ProcessParentTeam; VoidPtr VMRegister{0UL}; @@ -303,13 +303,13 @@ namespace Kernel Array& AsArray(); Ref& AsRef(); - ProcessID& Id() noexcept; + ProcessID& Id() noexcept; public: Array mProcessList; Ref mCurrentProcess; - ProcessID mTeamId{0}; - ProcessID mProcessCount{0}; + ProcessID mTeamId{0}; + ProcessID mProcessCount{0}; }; typedef Array UserThreadArray; @@ -337,8 +337,8 @@ namespace Kernel ProcessTeam& CurrentTeam(); public: - ProcessID Spawn(const Char* name, VoidPtr code, VoidPtr image); - Void Remove(ProcessID process_id); + ProcessID Spawn(const Char* name, VoidPtr code, VoidPtr image); + Void Remove(ProcessID process_id); Bool IsUser() override; Bool IsKernel() override; diff --git a/dev/kernel/KernelKit/Timer.h b/dev/kernel/KernelKit/Timer.h index 6c9195aa..fa26bc66 100644 --- a/dev/kernel/KernelKit/Timer.h +++ b/dev/kernel/KernelKit/Timer.h @@ -44,7 +44,7 @@ namespace Kernel private: UIntPtr* fDigitalTimer{nullptr}; - Int64 fWaitFor{0}; + Int64 fWaitFor{0}; }; class HardwareTimer final : public TimerInterface @@ -61,7 +61,7 @@ namespace Kernel private: UIntPtr* fDigitalTimer{nullptr}; - Int64 fWaitFor{0}; + Int64 fWaitFor{0}; }; inline Int64 rtl_ms(Int64 time) -- cgit v1.2.3 From 4f7562afaee939467299efdb6b7fac159f6cbd27 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 15 Apr 2025 08:43:30 +0200 Subject: fix, kernel, boot, mod: Fixing issues regarding the boot flow and the kernel. Signed-off-by: Amlal El Mahrouss --- .github/workflows/kernel-ahci.yml | 2 +- .github/workflows/kernel-pio.yml | 2 +- README.md | 2 +- dev/boot/amd64-ci.make | 2 +- dev/boot/amd64-desktop.make | 4 +- dev/boot/modules/BootNet/BootNet.cc | 25 +++--- dev/boot/modules/BootNet/amd64.json | 1 - dev/boot/modules/SysChk/SysChk.cc | 2 + dev/boot/modules/SysChk/amd64-ahci.json | 1 - dev/boot/modules/SysChk/amd64-pio.json | 1 - dev/boot/src/BootThread.cc | 2 +- dev/boot/src/HEL/AMD64/BootEFI.cc | 88 +++++++++------------- dev/kernel/CompilerKit/Version.h | 4 +- dev/kernel/FirmwareKit/EFI/API.h | 2 +- dev/kernel/HALKit/AMD64/HalKernelMain.cc | 3 +- dev/kernel/HALKit/AMD64/HalTimerAMD64.cc | 2 +- dev/kernel/KernelKit/Timer.h | 2 +- dev/kernel/amd64-desktop.make | 2 +- dev/user/user.json | 1 - modules_ahci_x64.sh | 11 +++ modules_pio_x64.sh | 11 +++ .../CoreFoundation.fwrk/CoreFoundation.json | 1 - public/frameworks/DiskImage.fwrk/DiskImage.json | 1 - public/frameworks/KernelTest.fwrk/KernelTest.json | 1 - setup_amd64.sh | 20 ----- setup_x64.sh | 14 ++++ 26 files changed, 99 insertions(+), 108 deletions(-) create mode 100755 modules_ahci_x64.sh create mode 100755 modules_pio_x64.sh delete mode 100755 setup_amd64.sh create mode 100755 setup_x64.sh (limited to 'dev/kernel/KernelKit') diff --git a/.github/workflows/kernel-ahci.yml b/.github/workflows/kernel-ahci.yml index 51cb54a3..a76865c0 100644 --- a/.github/workflows/kernel-ahci.yml +++ b/.github/workflows/kernel-ahci.yml @@ -16,5 +16,5 @@ jobs: - name: Install Packages run: sudo apt update && sudo apt install mingw-w64 qemu-utils nasm - name: Build NeKernel (AHCI) - run: ./setup_amd64.sh && cd dev/kernel && export AHCI_SUPPORT=1 && make -f amd64-ci.make all + run: ./setup_x64.sh && cd dev/kernel && export AHCI_SUPPORT=1 && make -f amd64-ci.make all diff --git a/.github/workflows/kernel-pio.yml b/.github/workflows/kernel-pio.yml index 57f6faee..e6a205b3 100644 --- a/.github/workflows/kernel-pio.yml +++ b/.github/workflows/kernel-pio.yml @@ -16,5 +16,5 @@ jobs: - name: Install Packages run: sudo apt update && sudo apt install mingw-w64 qemu-utils nasm - name: Build NeKernel (ATA PIO) - run: ./setup_amd64.sh && cd dev/kernel && export ATA_PIO_SUPPORT=1 && make -f amd64-ci.make all + run: ./setup_x64.sh && cd dev/kernel && export ATA_PIO_SUPPORT=1 && make -f amd64-ci.make all diff --git a/README.md b/README.md index 041257c7..f26df2ba 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ A documentation regarding building, and developing for NeKernel is available her ```sh git clone git@github.com:amlel-el-mahrouss/nekernel.git cd nekernel -./setup_amd64.sh +./setup_x64.sh ./debug_ata_x64.sh # Generic ATA PIO target ``` diff --git a/dev/boot/amd64-ci.make b/dev/boot/amd64-ci.make index 9ee61eed..62ab9af1 100644 --- a/dev/boot/amd64-ci.make +++ b/dev/boot/amd64-ci.make @@ -88,7 +88,7 @@ all: compile-amd64 .PHONY: disk disk: - dd if=/dev/zero of=$(BOOT) bs=30M count=100 + dd if=/dev/zero of=$(BOOT) bs=7M count=100 mformat -i $(BOOT) -F -v "NeKernel" diff --git a/dev/boot/amd64-desktop.make b/dev/boot/amd64-desktop.make index 3ed2ba3f..21a99941 100644 --- a/dev/boot/amd64-desktop.make +++ b/dev/boot/amd64-desktop.make @@ -96,7 +96,7 @@ all: compile-amd64 .PHONY: disk disk: - dd if=/dev/zero of=$(BOOT) bs=30M count=100 + dd if=/dev/zero of=$(BOOT) bs=7M count=100 mformat -i $(BOOT) -F -v "NEKERNEL-ESP" @@ -128,7 +128,7 @@ run-efi-amd64-ata-dma: .PHONY: run-efi-amd64-ata run-efi-amd64-ata: run-efi-amd64-ata-dma -# img_2 is the rescue disk. img is the bootable disk, as provided by the Zeta specs. +# img_2 is the rescue disk. img is the bootable disk, as provided by the NeKernel specs. .PHONY: epm-img epm-img: qemu-img create -f raw $(IMG) 4G diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc index 28d96cb2..050148c4 100644 --- a/dev/boot/modules/BootNet/BootNet.cc +++ b/dev/boot/modules/BootNet/BootNet.cc @@ -15,18 +15,19 @@ STATIC EfiGUID kEfiSimpleProtoGUID = EFI_SIMPLE_NETWORK_PROTOCOL_GUID; STATIC EFI_SIMPLE_NETWORK_PROTOCOL* kEfiProtocol = nullptr; -STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER&); +STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER); EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) { - fw_init_efi((EfiSystemTable*)handover->f_FirmwareCustomTables[0]); + Boot::BootTextWriter writer; + writer.Write("BootNet: Init EFI...\r"); - Boot::BootTextWriter writer; + fw_init_efi((EfiSystemTable*)handover->f_FirmwareCustomTables[1]); if (BS->LocateProtocol(&kEfiSimpleProtoGUID, nullptr, (VoidPtr*)&kEfiProtocol) != kEfiOk) { - writer.Write("[BOOT] BootNet: Not supported by firmware.\r"); + writer.Write("BootNet: Not supported by firmware.\r"); return kEfiFail; } @@ -34,13 +35,13 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) SetMem(&inet, 0, sizeof(BOOTNET_INTERNET_HEADER)); - writer.Write("[BOOT] BootNet: Downloading kernel...\r"); + writer.Write("BootNet: Downloading kernel...\r"); bootnet_read_ip_packet(inet); if (inet.Length < 1) { - writer.Write("[BOOT] BootNet: No executable attached to the packet, aborting.\r"); + writer.Write("BootNet: No executable attached to the packet, aborting.\r"); return kEfiFail; } @@ -50,7 +51,7 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) if (thread.IsValid()) { - writer.Write("[BOOT] BootNet: Running kernel...\r"); + writer.Write("BootNet: Running kernel...\r"); return thread.Start(handover, YES); } @@ -62,11 +63,11 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) if (inet.Length != kROMSize) { - writer.Write("[BOOT] BootNet: Not within 512K.\r"); + writer.Write("BootNet: Not within 512K.\r"); return kEfiFail; } - writer.Write("[BOOT] BootNet: Programming the flash is not available as of right now.\r"); + writer.Write("BootNet: Programming the flash is not available as of right now.\r"); /// TODO: Program new firmware to EEPROM (if crc and size matches) @@ -77,11 +78,7 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) return kEfiFail; } -STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER& inet) +STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER inet) { - kEfiProtocol->Start(kEfiProtocol); - NE_UNUSED(inet); - - kEfiProtocol->Stop(kEfiProtocol); } \ No newline at end of file diff --git a/dev/boot/modules/BootNet/amd64.json b/dev/boot/modules/BootNet/amd64.json index 7b87b533..7e5fd018 100644 --- a/dev/boot/modules/BootNet/amd64.json +++ b/dev/boot/modules/BootNet/amd64.json @@ -7,7 +7,6 @@ "compiler_flags": [ "-nostdlib", "-std=c++20", - "-fPIC", "-fno-rtti", "-fno-exceptions", "-Wl,--subsystem=17,--image-base,0x4000000,-e,BootNetModuleMain" diff --git a/dev/boot/modules/SysChk/SysChk.cc b/dev/boot/modules/SysChk/SysChk.cc index 3086cdc6..dec4e11a 100644 --- a/dev/boot/modules/SysChk/SysChk.cc +++ b/dev/boot/modules/SysChk/SysChk.cc @@ -28,6 +28,8 @@ EXTERN_C Int32 SysChkModuleMain(Kernel::HEL::BootInfoHeader* handover) { + NE_UNUSED(handover); + #ifdef __ATA_PIO__ Boot::BDiskFormatFactory partition_factory; diff --git a/dev/boot/modules/SysChk/amd64-ahci.json b/dev/boot/modules/SysChk/amd64-ahci.json index 98e570f4..1377c23b 100644 --- a/dev/boot/modules/SysChk/amd64-ahci.json +++ b/dev/boot/modules/SysChk/amd64-ahci.json @@ -7,7 +7,6 @@ "compiler_flags": [ "-nostdlib", "-std=c++20", - "-fPIC", "-fno-rtti", "-fno-exceptions", "-Wl,--subsystem=17,--image-base,0x4000000,-e,SysChkModuleMain" diff --git a/dev/boot/modules/SysChk/amd64-pio.json b/dev/boot/modules/SysChk/amd64-pio.json index 2b159e38..879f651f 100644 --- a/dev/boot/modules/SysChk/amd64-pio.json +++ b/dev/boot/modules/SysChk/amd64-pio.json @@ -7,7 +7,6 @@ "compiler_flags": [ "-nostdlib", "-std=c++20", - "-fPIC", "-fno-rtti", "-fno-exceptions", "-Wl,--subsystem=17,--image-base,0x4000000,-e,SysChkModuleMain" diff --git a/dev/boot/src/BootThread.cc b/dev/boot/src/BootThread.cc index ce691f96..3f399d66 100644 --- a/dev/boot/src/BootThread.cc +++ b/dev/boot/src/BootThread.cc @@ -216,4 +216,4 @@ namespace Boot { return fStartAddress != nullptr; } -} // namespace Boot +} // namespace Boot \ No newline at end of file diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc index a818fcd6..795e43cf 100644 --- a/dev/boot/src/HEL/AMD64/BootEFI.cc +++ b/dev/boot/src/HEL/AMD64/BootEFI.cc @@ -82,18 +82,25 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, { fw_init_efi(sys_table); ///! Init the EFI library. + fb_init(); + HEL::BootInfoHeader* handover_hdr = new HEL::BootInfoHeader(); - UInt32 map_key = 0; + UInt32 map_key = 0; + UInt32 size_struct_ptr = sizeof(EfiMemoryDescriptor); + EfiMemoryDescriptor* struct_ptr = nullptr; + UInt32 sz_desc = sizeof(EfiMemoryDescriptor); + UInt32 rev_desc = 0; + + Boot::BootTextWriter writer; + + writer.Write("BootZ: NeKernel Loader.\r"); -#ifdef ZBA_USE_FB if (!boot_init_fb()) { - Boot::BootTextWriter writer; writer.Write("BootZ: Invalid Framebuffer, can't boot NeKernel.\r"); - - CANT_REACH(); + Boot::Stop(); } for (SizeT index_vt = 0; index_vt < sys_table->NumberOfTableEntries; @@ -123,7 +130,6 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, handover_hdr->f_GOP.f_PixelPerLine = kGop->Mode->Info->PixelsPerScanLine; handover_hdr->f_GOP.f_PixelFormat = kGop->Mode->Info->PixelFormat; handover_hdr->f_GOP.f_Size = kGop->Mode->FrameBufferSize; -#endif // ZBA_USE_FB // ------------------------------------------- // // Grab MP services, extended to runtime. // @@ -138,14 +144,10 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, kHandoverHeader = handover_hdr; - fb_init(); - FB::fb_clear_video(); FBDrawBitMapInRegion(zka_disk, NE_DISK_WIDTH, NE_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_DISK_HEIGHT) / 2); - fb_clear(); - UInt32 cnt_enabled = 0; UInt32 cnt_disabled = 0; @@ -161,13 +163,13 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, // Fill handover header now. - Boot::BootTextWriter writer; - handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */ handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */ Int32 trials = 5 * 10000000; + writer.Write("BootZ: Allocating sufficent memory, trying with 4GB...\r"); + while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize, &handover_hdr->f_BitMapStart) != kEfiOk) { --trials; @@ -212,22 +214,16 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, if (syschk_thread->Start(handover_hdr, NO) != kEfiOk) { - fb_init(); - FB::fb_clear_video(); - 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); - - fb_clear(); } } - // ------------------------------------------ // - // null these fields, to avoid being reused later. - // ------------------------------------------ // + BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc); + + struct_ptr = new EfiMemoryDescriptor[sz_desc]; - handover_hdr->f_FirmwareCustomTables[0] = nullptr; - handover_hdr->f_FirmwareCustomTables[1] = nullptr; + BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc); handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor); @@ -263,11 +259,13 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, ver = KERNEL_VERSION_BCD; ST->RuntimeServices->SetVariable(L"/props/kern_ver", kEfiGlobalNamespaceVarGUID, nullptr, &sz_ver, &ver); - writer.Write("BootZ: Kernel Version Updated: ").Write(ver).Write("\r"); + writer.Write("BootZ: Kernel Version has been updated: ").Write(ver).Write("\r"); } writer.Write("BootZ: Kernel Version: ").Write(ver).Write("\r"); + // Fallback to bootnet, if not PXE. + Boot::BootFileReader reader_kernel(kernel_path, image_handle); reader_kernel.ReadAll(0); @@ -280,46 +278,32 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, if (reader_kernel.Blob()) { + // ------------------------------------------ // + // null these fields, to avoid being reused later. + // ------------------------------------------ // + + handover_hdr->f_FirmwareCustomTables[0] = nullptr; + handover_hdr->f_FirmwareCustomTables[1] = nullptr; + kernel_thread = new Boot::BootThread(reader_kernel.Blob()); kernel_thread->SetName("BootZ: Kernel"); handover_hdr->f_KernelImage = reader_kernel.Blob(); handover_hdr->f_KernelSz = reader_kernel.Size(); - } - else - { - 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); - Boot::Stop(); - } + Boot::ExitBootServices(map_key, image_handle); - // Fallback to bootnet, if not PXE. + return kernel_thread->Start(handover_hdr, NO); + } Boot::BootFileReader reader_netboot(L"net.efi", image_handle); reader_netboot.ReadAll(0); - Boot::BootThread* netboot_thread = nullptr; - - // ---------------------------------------------------- // - // Finally load the OS kernel. - // ---------------------------------------------------- // - - Boot::ExitBootServices(map_key, image_handle); - - if (kernel_thread->Start(handover_hdr, YES) != kEfiOk) - { - // ------------------------------------------ // - // If we fail into booting the kernel, then run BootNet. - // ------------------------------------------ // + if (!reader_netboot.Blob()) + return kEfiFail; - if (reader_netboot.Blob()) - { - netboot_thread = new Boot::BootThread(reader_netboot.Blob()); - netboot_thread->SetName("BootZ: BootNet"); - netboot_thread->Start(handover_hdr, YES); - } - } + Boot::BootThread* netboot_thread = new Boot::BootThread(reader_netboot.Blob()); + netboot_thread->SetName("BootZ: BootNet"); - CANT_REACH(); + return netboot_thread->Start(handover_hdr, NO); } diff --git a/dev/kernel/CompilerKit/Version.h b/dev/kernel/CompilerKit/Version.h index 0d53b5ed..0f4f863d 100644 --- a/dev/kernel/CompilerKit/Version.h +++ b/dev/kernel/CompilerKit/Version.h @@ -6,5 +6,5 @@ #define BOOTLOADER_VERSION "1104.2025.110" #define KERNEL_VERSION "1104.2025.110" -#define BOOTLOADER_VERSION_BCD 0x11042025110 -#define KERNEL_VERSION_BCD 0x11042025110 +#define BOOTLOADER_VERSION_BCD 0x20250415 +#define KERNEL_VERSION_BCD 0x20250415 diff --git a/dev/kernel/FirmwareKit/EFI/API.h b/dev/kernel/FirmwareKit/EFI/API.h index 9140d131..f3b03bb5 100644 --- a/dev/kernel/FirmwareKit/EFI/API.h +++ b/dev/kernel/FirmwareKit/EFI/API.h @@ -48,7 +48,7 @@ namespace Boot @brief Exit EFI API to let the OS load correctly. Bascially frees everything we have in the EFI side. */ - inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept + inline Void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept { if (!ST) return; diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc index 7ce1b0d8..9ede8ebd 100644 --- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc +++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc @@ -13,6 +13,7 @@ #include #include #include +#include EXTERN_C Kernel::VoidPtr kInterruptVectorTable[]; EXTERN_C Kernel::VoidPtr mp_user_switch_proc; @@ -84,8 +85,6 @@ EXTERN_C void hal_init_platform( gdt_reg.Base = reinterpret_cast(kGDTArray); gdt_reg.Limit = (sizeof(Kernel::HAL::Detail::NE_GDT_ENTRY) * kGDTEntriesCount) - 1; - FB::fb_clear_video(); - //! GDT will load hal_read_init after it successfully loads the segments. Kernel::HAL::GDTLoader gdt_loader; gdt_loader.Load(gdt_reg); diff --git a/dev/kernel/HALKit/AMD64/HalTimerAMD64.cc b/dev/kernel/HALKit/AMD64/HalTimerAMD64.cc index 01be2be5..72de8eb0 100644 --- a/dev/kernel/HALKit/AMD64/HalTimerAMD64.cc +++ b/dev/kernel/HALKit/AMD64/HalTimerAMD64.cc @@ -45,7 +45,7 @@ namespace Kernel::Detail using namespace Kernel; -HardwareTimer::HardwareTimer(Int64 ms) +HardwareTimer::HardwareTimer(UInt64 ms) : fWaitFor(ms) { auto power = PowerFactoryInterface(kHandoverHeader->f_HardwareTables.f_VendorPtr); diff --git a/dev/kernel/KernelKit/Timer.h b/dev/kernel/KernelKit/Timer.h index fa26bc66..b6d23e6b 100644 --- a/dev/kernel/KernelKit/Timer.h +++ b/dev/kernel/KernelKit/Timer.h @@ -50,7 +50,7 @@ namespace Kernel class HardwareTimer final : public TimerInterface { public: - explicit HardwareTimer(Int64 seconds); + explicit HardwareTimer(UInt64 seconds); ~HardwareTimer() override; public: diff --git a/dev/kernel/amd64-desktop.make b/dev/kernel/amd64-desktop.make index 8541d5a0..905a6c91 100644 --- a/dev/kernel/amd64-desktop.make +++ b/dev/kernel/amd64-desktop.make @@ -33,7 +33,7 @@ COPY = cp ASMFLAGS = -f win64 # Kernel subsystem is 17 and entrypoint is hal_init_platform -LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x10000000 +LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x4000000 LDOBJ = obj/*.obj # This file is the Kernel, responsible of task, memory, driver, sci, disk and device management. diff --git a/dev/user/user.json b/dev/user/user.json index 481280f8..9581d4d4 100644 --- a/dev/user/user.json +++ b/dev/user/user.json @@ -5,7 +5,6 @@ "sources_path": ["src/*.cc", "src/*.o"], "output_name": "user.sys", "compiler_flags": [ - "-fPIC", "-ffreestanding", "-shared", "-fno-rtti", diff --git a/modules_ahci_x64.sh b/modules_ahci_x64.sh new file mode 100755 index 00000000..44e3ecf5 --- /dev/null +++ b/modules_ahci_x64.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# LOG HISTORY: +# 03/25/25: Add 'disk' build step. +# 04/05/25: Improve and fix script. + +cd dev/boot/modules/SysChk +btb amd64-ahci.json +cd ../ +cd BootNet +btb amd64.json \ No newline at end of file diff --git a/modules_pio_x64.sh b/modules_pio_x64.sh new file mode 100755 index 00000000..2b501047 --- /dev/null +++ b/modules_pio_x64.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# LOG HISTORY: +# 03/25/25: Add 'disk' build step. +# 04/05/25: Improve and fix script. + +cd dev/boot/modules/SysChk +btb amd64-pio.json +cd ../ +cd BootNet +btb amd64.json \ No newline at end of file diff --git a/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json b/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json index e8ee3245..a208f57a 100644 --- a/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json +++ b/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json @@ -5,7 +5,6 @@ "sources_path": ["src/*.cc"], "output_name": "./dist/libCoreFoundation.dylib", "compiler_flags": [ - "-fPIC", "-ffreestanding", "-shared", "-fno-rtti", diff --git a/public/frameworks/DiskImage.fwrk/DiskImage.json b/public/frameworks/DiskImage.fwrk/DiskImage.json index 0b97dafb..aaff409c 100644 --- a/public/frameworks/DiskImage.fwrk/DiskImage.json +++ b/public/frameworks/DiskImage.fwrk/DiskImage.json @@ -5,7 +5,6 @@ "sources_path": ["src/*.cc"], "output_name": "./dist/libDiskImage.dylib", "compiler_flags": [ - "-fPIC", "-ffreestanding", "-shared", "-fno-rtti", diff --git a/public/frameworks/KernelTest.fwrk/KernelTest.json b/public/frameworks/KernelTest.fwrk/KernelTest.json index 93207890..aa70db30 100644 --- a/public/frameworks/KernelTest.fwrk/KernelTest.json +++ b/public/frameworks/KernelTest.fwrk/KernelTest.json @@ -5,7 +5,6 @@ "sources_path": ["src/*.cc"], "output_name": "./dist/libKernelTest.dylib", "compiler_flags": [ - "-fPIC", "-ffreestanding", "-shared", "-fno-rtti", diff --git a/setup_amd64.sh b/setup_amd64.sh deleted file mode 100755 index 717f7840..00000000 --- a/setup_amd64.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# LOG HISTORY: -# 03/25/25: Add 'disk' build step. -# 04/05/25: Improve and fix script. - -cd dev/boot/modules/SysChk -btb amd64.json -cd ../ -cd BootNet -btb amd64.json -cd ../../../ -cd user -btb user.json -cd ../boot -make -f amd64-desktop.make efi -make -f amd64-desktop.make disk -make -f amd64-desktop.make epm-img -cd ../../dev/kernel/HALKit/AMD64 -./make_ap_blob.sh diff --git a/setup_x64.sh b/setup_x64.sh new file mode 100755 index 00000000..35111b88 --- /dev/null +++ b/setup_x64.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# LOG HISTORY: +# 03/25/25: Add 'disk' build step. +# 04/05/25: Improve and fix script. + +cd dev/user +btb user.json +cd ../boot +make -f amd64-desktop.make efi +make -f amd64-desktop.make disk +make -f amd64-desktop.make epm-img +cd ../../dev/kernel/HALKit/AMD64 +./make_ap_blob.sh -- cgit v1.2.3