summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/amd64-efi.make
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:13 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:45 +0100
commit610f91d87152cbe48d3054fcf437d8239da6ef35 (patch)
treea386f7047ab73d088169ab2371ddc6ffe8020f1c /dev/Kernel/amd64-efi.make
parent509fcca5986651c8ba712fb395f8498f2dea4109 (diff)
IMP: :boom: Breaking changes some checks are needed to be done.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/amd64-efi.make')
-rw-r--r--dev/Kernel/amd64-efi.make85
1 files changed, 85 insertions, 0 deletions
diff --git a/dev/Kernel/amd64-efi.make b/dev/Kernel/amd64-efi.make
new file mode 100644
index 00000000..52b1ff5f
--- /dev/null
+++ b/dev/Kernel/amd64-efi.make
@@ -0,0 +1,85 @@
+##################################################
+# (c) TQ B.V, all rights reserved.
+# This is the minoskrnl's makefile.
+##################################################
+
+CC = x86_64-w64-mingw32-g++
+LD = x86_64-w64-mingw32-ld
+CCFLAGS = -fshort-wchar -c -D__ZKA_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
+ -std=c++20 -D__ZKA_SUPPORT_NX__ -O0 -I../Vendor -D__FSKIT_INCLUDES_NEFS__ \
+ -D__MINOSKRNL__ -D__HAVE_ZKA_APIS__ -D__FREESTANDING__ -D__ZKA__ -I./ -I../ -I../zba
+
+ASM = nasm
+
+DISK_DRV =
+
+ifneq ($(ATA_PIO_SUPPORT), )
+DISK_DRV = -D__ATA_PIO__
+endif
+
+ifneq ($(ATA_DMA_SUPPORT), )
+DISK_DRV = -D__ATA_DMA__
+endif
+
+ifneq ($(AHCI_SUPPORT), )
+DISK_DRV = -D__AHCI__
+endif
+
+ifneq ($(DEBUG_SUPPORT), )
+DEBUG_MACRO = -D__DEBUG__
+endif
+
+COPY = cp
+
+# Add assembler, linker, and object files variables.
+ASMFLAGS = -f win64
+
+# Kernel subsystem is 17 and entrypoint is hal_init_platform
+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.
+KERNEL_IMG = minoskrnl.exe
+
+.PHONY: error
+error:
+ @echo "=== ERROR ==="
+ @echo "=> Use a specific target."
+
+MOVEALL=./MoveAll.X64.sh
+WINDRES=x86_64-w64-mingw32-windres
+
+.PHONY: newos-amd64-epm
+newos-amd64-epm: clean
+ $(WINDRES) KernelRsrc.rsrc -O coff -o KernelRsrc.obj
+ $(CC) $(CCFLAGS) $(DISK_DRV) $(DEBUG_MACRO) $(wildcard src/*.cc) \
+ $(wildcard src/FS/*.cc) $(wildcard HALKit/AMD64/Storage/*.cc) \
+ $(wildcard HALKit/AMD64/PCI/*.cc) $(wildcard src/Network/*.cc) $(wildcard src/Storage/*.cc) \
+ $(wildcard HALKit/AMD64/*.cc) $(wildcard src/WS/*.cc) \
+ $(wildcard HALKit/AMD64/*.s)
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalCommonAPI.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalBoot.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtils.asm
+ $(MOVEALL)
+
+OBJCOPY=x86_64-w64-mingw32-objcopy
+
+.PHONY: link-amd64-epm
+link-amd64-epm:
+ $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL_IMG)
+
+.PHONY: all
+all: newos-amd64-epm link-amd64-epm
+ @echo "Kernel => OK."
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "all: Build Kernel and link it."
+ @echo "link-amd64-epm: Link Kernel for EPM based disks."
+ @echo "newos-amd64-epm: Build Kernel for EPM based disks."
+
+.PHONY: clean
+clean:
+ rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL_IMG)