From 30bcb0416e8acaf3fb7b224e18534e7f64df26af Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Sun, 16 Jun 2024 12:56:02 +0200 Subject: MHR-31: Work in progress ARM64 port of the kernel. - This is a very capable kernel, it has HAL capabilities. - We're going to make a timer to implmenent our scheduler. - We're going to support flash memoru and SD cards, alongside a SIM driver. Signed-off-by: Amlal EL Mahrouss --- Kernel/amd64-efi.make | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ Kernel/arm64-cb.make | 73 ++++++++++++++++++++++++++++++++++++++++++ Kernel/makefile | 87 --------------------------------------------------- 3 files changed, 159 insertions(+), 87 deletions(-) create mode 100644 Kernel/amd64-efi.make create mode 100644 Kernel/arm64-cb.make delete mode 100644 Kernel/makefile (limited to 'Kernel') diff --git a/Kernel/amd64-efi.make b/Kernel/amd64-efi.make new file mode 100644 index 00000000..7e076a8d --- /dev/null +++ b/Kernel/amd64-efi.make @@ -0,0 +1,86 @@ +################################################## +# (C) Zeta Electronics Corporation, all rights reserved. +# This is the microkernel makefile. +################################################## + +CC = x86_64-w64-mingw32-gcc +LD = x86_64-w64-mingw32-ld +CCFLAGS = -c -fPIC -ffreestanding -D__NEWOS_AMD64__ -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 + +DISKDRIVER = + +ifneq ($(ATA_PIO_SUPPORT), ) +DISKDRIVER = -D__ATA_PIO__ +endif + +ifneq ($(ATA_DMA_SUPPORT), ) +DISKDRIVER = -D__ATA_DMA__ +endif + +ifneq ($(AHCI_SUPPORT), ) +DISKDRIVER = -D__AHCI__ +endif + +ifneq ($(DEBUG_SUPPORT), ) +DEBUG = -D__DEBUG__ +endif + +COPY = cp + +# Add assembler, linker, and object files variables. +ASMFLAGS = -f win64 + +# NewOS subsystem is 17 and entrypoint is __ImageStart +LDFLAGS = -e __ImageStart --subsystem=17 +LDOBJ = Objects/*.obj + +# This file is the kernel, responsible of task management and memory. +KERNEL = newoskrnl.exe + +.PHONY: error +error: + @echo "=== ERROR ===" + @echo "=> Use a specific target." + +MOVEALL=./MoveAll.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) $(DISKDRIVER) $(DEBUG) $(wildcard Sources/*.cxx) \ + $(wildcard Sources/FS/*.cxx) $(wildcard HALKit/AMD64/Storage/*.cxx) \ + $(wildcard HALKit/AMD64/PCI/*.cxx) $(wildcard Sources/Network/*.cxx) $(wildcard Sources/Storage/*.cxx) \ + $(wildcard HALKit/AMD64/*.cxx) $(wildcard HALKit/AMD64/*.cpp) \ + $(wildcard HALKit/AMD64/*.s) + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalSMPCoreManager.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalNewBoot.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm + $(MOVEALL) + +OBJCOPY=x86_64-w64-mingw32-objcopy + +.PHONY: link-amd64-epm +link-amd64-epm: + $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) + +.PHONY: all +all: newos-amd64-epm link-amd64-epm + qemu-img create -f raw newoskrnl.rom 512K + dd if=newoskrnl.exe of=newoskrnl.rom bs=1 seek=0 conv=notrunc + @echo "NewOSKrnl => OK." + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "all: Build kernel and link it." + @echo "link-amd64-epm: Link kernel. (EPM AMD64)" + @echo "newos-amd64-epm: Build kernel. (EPM AMD64)" + +.PHONY: clean +clean: + rm -f $(LDOBJ) $(KERNEL) diff --git a/Kernel/arm64-cb.make b/Kernel/arm64-cb.make new file mode 100644 index 00000000..3b24bcdb --- /dev/null +++ b/Kernel/arm64-cb.make @@ -0,0 +1,73 @@ +################################################## +# (C) Zeta Electronics Corporation, all rights reserved. +# This is the microkernel makefile. +################################################## + +CC = arm-none-eabi-gcc.exe +LD = arm-none-eabi-ld.exe +CCFLAGS = -c -fPIC -ffreestanding -D__NEWOS_ARM64__ -fno-rtti -fno-exceptions -I../ -I./ \ + -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ + +ASM = arm-none-eabi-as.exe + +DISKDRIVER = -D__FLASH_MEM__ + +ifneq ($(SDCARD_SUPPORT), ) +DISKDRIVER = -D__SDCARD__ +endif + +ifneq ($(DEBUG_SUPPORT), ) +DEBUG = -D__DEBUG__ +endif + +COPY = cp + +# Add assembler, linker, and object files variables. +ASMFLAGS = -f elf64 + +# NewOS subsystem is 17 and entrypoint is __ImageStart +LDFLAGS = -e __ImageStart +LDOBJ = Objects/*.obj + +# This file is the kernel, responsible of task management and memory. +KERNEL = newoskrnl.exe + +.PHONY: error +error: + @echo "=== ERROR ===" + @echo "=> Use a specific target." + +MOVEALL=./MoveAll.sh + +.PHONY: newos-arm64-epm +newos-arm64-epm: clean + $(CC) $(CCFLAGS) $(DISKDRIVER) $(DEBUG) $(wildcard Sources/*.cxx) \ + $(wildcard Sources/FS/*.cxx) $(wildcard HALKit/ARM64/Storage/*.cxx) \ + $(wildcard HALKit/ARM64/PCI/*.cxx) $(wildcard Sources/Network/*.cxx) $(wildcard Sources/Storage/*.cxx) \ + $(wildcard HALKit/ARM64/*.cxx) $(wildcard HALKit/ARM64/*.cpp) \ + $(wildcard HALKit/ARM64/*.s) + + $(MOVEALL) + +OBJCOPY=x86_64-w64-mingw32-objcopy + +.PHONY: link-arm64-epm +link-arm64-epm: + $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) + +.PHONY: all +all: newos-arm64-epm link-arm64-epm + qemu-img create -f raw newoskrnl.rom 512K + dd if=newoskrnl.exe of=newoskrnl.rom bs=1 seek=0 conv=notrunc + @echo "NewOSKrnl => OK." + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "all: Build kernel and link it." + @echo "link-arm64-epm: Link kernel. (EPM AMD64)" + @echo "newos-arm64-epm: Build kernel. (EPM AMD64)" + +.PHONY: clean +clean: + rm -f $(LDOBJ) $(KERNEL) diff --git a/Kernel/makefile b/Kernel/makefile deleted file mode 100644 index 1f749323..00000000 --- a/Kernel/makefile +++ /dev/null @@ -1,87 +0,0 @@ -################################################## -# (C) Zeta Electronics Corporation, all rights reserved. -# This is the microkernel makefile. -################################################## - -CC = x86_64-w64-mingw32-gcc -LD = x86_64-w64-mingw32-ld -CCFLAGS = -c -fPIC -ffreestanding -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \ - -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./ \ - -DBLEND2D_NO_STDCXX -DBLEND2D_NO_TLS -DBLEND2D_EMBED - -ASM = nasm - -DISKDRIVER = -D__ATA_PIO__ - -ifneq ($(ATA_PIO_SUPPORT), ) -DISKDRIVER = -D__ATA_PIO__ -endif - -ifneq ($(ATA_DMA_SUPPORT), ) -DISKDRIVER = -D__ATA_DMA__ -endif - -ifneq ($(AHCI_SUPPORT), ) -DISKDRIVER = -D__AHCI__ -endif - -ifneq ($(DEBUG_SUPPORT), ) -DEBUG = -D__DEBUG__ -endif - -COPY = cp - -# Add assembler, linker, and object files variables. -ASMFLAGS = -f win64 - -# NewOS subsystem is 17 and entrypoint is __ImageStart -LDFLAGS = -e __ImageStart --subsystem=17 -LDOBJ = Objects/*.obj - -# This file is the kernel, responsible of task management and memory. -KERNEL = newoskrnl.exe - -.PHONY: error -error: - @echo "=== ERROR ===" - @echo "=> Use a specific target." - -MOVEALL=./MoveAll.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) $(DISKDRIVER) $(DEBUG) $(wildcard Sources/*.cxx) \ - $(wildcard Sources/FS/*.cxx) $(wildcard HALKit/AMD64/Storage/*.cxx) \ - $(wildcard HALKit/AMD64/PCI/*.cxx) $(wildcard Sources/Network/*.cxx) $(wildcard Sources/Storage/*.cxx) \ - $(wildcard HALKit/AMD64/*.cxx) $(wildcard HALKit/AMD64/*.cpp) \ - $(wildcard HALKit/AMD64/*.s) - $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm - $(ASM) $(ASMFLAGS) HALKit/AMD64/HalSMPCoreManager.asm - $(ASM) $(ASMFLAGS) HALKit/AMD64/HalNewBoot.asm - $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm - $(MOVEALL) - -OBJCOPY=x86_64-w64-mingw32-objcopy - -.PHONY: link-amd64-epm -link-amd64-epm: - $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) - -.PHONY: all -all: newos-amd64-epm link-amd64-epm - qemu-img create -f raw newoskrnl.rom 512K - dd if=newoskrnl.exe of=newoskrnl.rom bs=1 seek=0 conv=notrunc - @echo "NewOSKrnl => OK." - -.PHONY: help -help: - @echo "=== HELP ===" - @echo "all: Build kernel and link it." - @echo "link-amd64-epm: Link kernel. (EPM AMD64)" - @echo "newos-amd64-epm: Build kernel. (EPM AMD64)" - -.PHONY: clean -clean: - rm -f $(LDOBJ) $(KERNEL) -- cgit v1.2.3