summaryrefslogtreecommitdiffhomepage
path: root/Private/makefile
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-04-22 08:37:14 +0000
committerAmlal <amlalelmahrouss@icloud.com>2024-04-22 08:37:14 +0000
commit09e1c9738bc5dce28a6e181ebc585f0dea01f109 (patch)
tree2df231f8601402147514572120f762c69bf5c84a /Private/makefile
parent41cc598c501ee190385c041b2149eae228b24741 (diff)
parent76c0c6b21532aee82df5bd62cd886bc63d933899 (diff)
Merged in MHR-5 (pull request #1)
MHR-5
Diffstat (limited to 'Private/makefile')
-rw-r--r--Private/makefile31
1 files changed, 20 insertions, 11 deletions
diff --git a/Private/makefile b/Private/makefile
index 412739ca..128ccc55 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -1,33 +1,35 @@
##################################################
-# (C) Mahrouss Logic, all rights reserved.
+# (C) Mahrouss Logic, all rights reserved.
# This is the microkernel makefile.
##################################################
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
+CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
ASM = nasm
ifneq ($(ATA_PIO_SUPPORT), )
-DISKDRIVER = -D__ATA_PIO__
+DISKDRIVER = -D__ATA_PIO__
endif
ifneq ($(ATA_DMA_SUPPORT), )
-DISKDRIVER = -D__ATA_DMA__
+DISKDRIVER = -D__ATA_DMA__
endif
ifneq ($(AHCI_SUPPORT), )
-DISKDRIVER = -D__AHCI__
+DISKDRIVER = -D__AHCI__
endif
ifneq ($(DEBUG_SUPPORT), )
-DEBUG = -D__DEBUG__
+DEBUG = -D__DEBUG__
endif
+COPY = cp
+
# Add assembler, linker, and object files variables.
ASMFLAGS = -f win64
LDFLAGS = -e Main --subsystem=17
-LDOBJ = $(wildcard Objects/*.obj)
+LDOBJ = Objects/*.obj
# This file is the kernel, responsible of task management, memory, drivers and more.
KERNEL = NewKernel.exe
@@ -37,7 +39,7 @@ SCRIPT = --script=Linker/Platforms/PC.lds
.PHONY: error
error:
- @echo "Use a specific target."
+ @echo "=> Use a specific target."
MOVEALL=./MoveAll.sh
WINDRES=x86_64-w64-mingw32-windres
@@ -52,12 +54,19 @@ newos-amd64-epm: clean
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm
$(MOVEALL)
-OBJCOPY=x86_64-w64-mingw32-objcopy
+OBJCOPY=x86_64-w64-mingw32-objcopy
+
+KERNEL_OBJ=kernel.bin
+DD=dd
+IMG_CREATE=qemu-img
+MAX_KERNEL_SIZE=1024K
.PHONY: link-amd64-epm
link-amd64-epm:
- $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL)
- cp $(KERNEL) Root/Boot
+ $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL_OBJ)
+ $(IMG_CREATE) create -f raw $(KERNEL) $(MAX_KERNEL_SIZE)
+ $(DD) if=$(KERNEL_OBJ) of=$(KERNEL) bs=1 seek=0 conv=notrunc
+ $(COPY) $(KERNEL) Root/Boot
.PHONY: all
all: newos-amd64-epm link-amd64-epm