From 43981bf8ecacb5f95070fa4ff502941d9e3251b4 Mon Sep 17 00:00:00 2001 From: Amlal Date: Wed, 24 Jul 2024 20:48:25 +0200 Subject: [MHR-36]: Removed HAL directory, replaced with Samples directory. Signed-off-by: Amlal --- DDK/KernelAlloc.c | 10 ++- Drivers/.gitkeep | 0 Drivers/Hello/CheckStack.c | 18 ----- Drivers/Hello/DriverRsrc.rsrc | 25 ------- Drivers/Hello/Main.c | 131 --------------------------------- Drivers/Hello/compile_flags.txt | 3 - Drivers/Hello/x86_64.mk | 51 ------------- Drivers/SampleDriver/CheckStck.c | 11 --- Drivers/SampleDriver/DriverRsrc.rsrc | 25 ------- Drivers/SampleDriver/Main.c | 20 ----- Drivers/SampleDriver/compile_flags.txt | 3 - Drivers/SampleDriver/x86_64.mk | 51 ------------- Drivers/VideoDrv/CheckStck.c | 11 --- Drivers/VideoDrv/DriverRsrc.rsrc | 25 ------- Drivers/VideoDrv/Main.cxx | 22 ------ Drivers/VideoDrv/compile_flags.txt | 3 - Drivers/VideoDrv/x86_64.make | 51 ------------- Kernel/riscv64-cb.make | 0 Samples/.gitkeep | 0 Samples/SampleHAL/CheckStck.c | 11 +++ Samples/SampleHAL/DriverRsrc.rsrc | 25 +++++++ Samples/SampleHAL/Main.c | 20 +++++ Samples/SampleHAL/compile_flags.txt | 3 + Samples/SampleHAL/x86_64.mk | 51 +++++++++++++ 24 files changed, 119 insertions(+), 451 deletions(-) delete mode 100644 Drivers/.gitkeep delete mode 100644 Drivers/Hello/CheckStack.c delete mode 100644 Drivers/Hello/DriverRsrc.rsrc delete mode 100644 Drivers/Hello/Main.c delete mode 100644 Drivers/Hello/compile_flags.txt delete mode 100644 Drivers/Hello/x86_64.mk delete mode 100644 Drivers/SampleDriver/CheckStck.c delete mode 100644 Drivers/SampleDriver/DriverRsrc.rsrc delete mode 100644 Drivers/SampleDriver/Main.c delete mode 100644 Drivers/SampleDriver/compile_flags.txt delete mode 100644 Drivers/SampleDriver/x86_64.mk delete mode 100644 Drivers/VideoDrv/CheckStck.c delete mode 100644 Drivers/VideoDrv/DriverRsrc.rsrc delete mode 100644 Drivers/VideoDrv/Main.cxx delete mode 100644 Drivers/VideoDrv/compile_flags.txt delete mode 100644 Drivers/VideoDrv/x86_64.make create mode 100644 Kernel/riscv64-cb.make create mode 100644 Samples/.gitkeep create mode 100644 Samples/SampleHAL/CheckStck.c create mode 100644 Samples/SampleHAL/DriverRsrc.rsrc create mode 100644 Samples/SampleHAL/Main.c create mode 100644 Samples/SampleHAL/compile_flags.txt create mode 100644 Samples/SampleHAL/x86_64.mk diff --git a/DDK/KernelAlloc.c b/DDK/KernelAlloc.c index 6f31ae1c..17e49d6a 100644 --- a/DDK/KernelAlloc.c +++ b/DDK/KernelAlloc.c @@ -8,16 +8,24 @@ #include +/** + \brief Allocates a new heap on the kernel's side. + \param sz the size of the heap block. + \return the newly allocated pointer. +*/ DK_EXTERN void* kernelAlloc(size_t sz) { if (!sz) ++sz; void* ptr = kernelCall("NewHeap", 1, &sz, sizeof(size_t)); - kernelCall("ProtectHeap", 1, ptr, sz); return ptr; } +/** + \brief Frees a pointer from the heap. + \param ptr the pointer to free. +*/ DK_EXTERN void kernelFree(void* ptr) { if (!ptr) return; diff --git a/Drivers/.gitkeep b/Drivers/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Drivers/Hello/CheckStack.c b/Drivers/Hello/CheckStack.c deleted file mode 100644 index c1af3218..00000000 --- a/Drivers/Hello/CheckStack.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -#include -#include -#include - -///! @brief Raised when we get out of bounds. Abort here. -void ___chkstk_ms(void) -{ - kernelPrintStr("Hello: KeStop needs to be raised...\r"); - - char* in = "__chkstk_ms on " __FILE__; - kernelCall("KeStop", 0, in, kernelStringLength(in)); -} diff --git a/Drivers/Hello/DriverRsrc.rsrc b/Drivers/Hello/DriverRsrc.rsrc deleted file mode 100644 index 9a90f62b..00000000 --- a/Drivers/Hello/DriverRsrc.rsrc +++ /dev/null @@ -1,25 +0,0 @@ -1 ICON "../../Icons/main.ico" - -1 VERSIONINFO -FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904E4" - BEGIN - VALUE "CompanyName", "ZKA Technologies" - VALUE "FileDescription", "New OS Zeroconf driver." - VALUE "FileVersion", "1.00" - VALUE "InternalName", "Bonjour." - VALUE "LegalCopyright", "Copyright ZKA Technologies, all rights reserved." - VALUE "OriginalFilename", "Bonjour.exe" - VALUE "ProductName", "Bonjour." - VALUE "ProductVersion", "1.00" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1252 - END -END diff --git a/Drivers/Hello/Main.c b/Drivers/Hello/Main.c deleted file mode 100644 index 10feda48..00000000 --- a/Drivers/Hello/Main.c +++ /dev/null @@ -1,131 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -#include -#include -#include - -struct HelloMasterConfigHeader; -struct HelloMasterConfigHeaderInput; - -struct HelloMasterConfigHeaderInput -{ - size_t fSizeOfOutput; - struct HelloMasterConfigHeader* fOutput; -}; - -/// @file Hello.c -/// @brief Zero configuration protocol, a much more better protocol for zero configuration. - -#define cHMCHMaxDataLength (1024) - -typedef struct HelloMasterConfigHeader -{ - int64_t fMagic; - int64_t fVersion; - int64_t fSourceAddress; - size_t fDataLength; - wchar_t fUTF16Data[cHMCHMaxDataLength]; -} __attribute__((packed)) HelloMasterConfigHeader; - -#define cHMCHDeviceLen 255 - -static kernelDeviceRef cDev = nil; -static char* cDeviceUUID = nil; // 3ed40738-c7d6-4b59-afdf-3c104b05fbf -static HelloMasterConfigHeader* cHeader = nil; - -/// @brief Link to master device to attribute DHCP lease. -static void __hello_link_device(void* a0) -{ - kernelPrintStr("Hello: linking...\r"); - - if (!cDev) - { - // open raw network device. - cDev = kernelOpenDevice("BROADCAST:\\"); - } - - cDev->write("+LINK", kernelStringLength("+LINK")); - cDev->wait(); - - cDev->write((void*)cDeviceUUID, kernelStringLength(cDeviceUUID)); - cDev->wait(); - - if (cHeader) - { - kernelFree(cHeader); - cHeader = nil; - } - - cHeader = cDev->read(nil, sizeof(HelloMasterConfigHeader)); -} - -static void __hello_get_hmch(void* a0) -{ - if (a0 == nil) - return; - - kernelPrintStr("Hello: returning header...\r"); - - struct HelloMasterConfigHeaderInput* in = a0; - in->fOutput = cHeader; - in->fSizeOfOutput = sizeof(in->fOutput); -} - -static void __hello_unlink_device(void* a0) -{ - kernelPrintStr("Hello: unlinking...\r"); - - if (cDev) - { - cDev->write("+UNLINK", kernelStringLength("+UNLINK")); - cDev->wait(); - - /// here is my uuid and my config header. Please disconnect me. - cDev->write((void*)cDeviceUUID, kernelStringLength(cDeviceUUID)); - cDev->write(cHeader, sizeof(cHeader)); - - cDev->wait(); - - kernelCloseDevice(cDev); - cDev = nil; - } - - if (cDeviceUUID) - { - kernelFree((void*)cDeviceUUID); - cDeviceUUID = nil; - } - - cDev = nil; -} - -int __at_enter(void) -{ - kernelPrintStr("Hello: starting up Helloconf...\r"); - - cDeviceUUID = kernelAlloc(sizeof(char) * cHMCHDeviceLen); - - kernelAddSyscall(0, __hello_link_device); - kernelAddSyscall(1, __hello_unlink_device); - kernelAddSyscall(2, __hello_get_hmch); - - return 0; -} - -int __at_exit(void) -{ - kernelPrintStr("Hello: starting up Helloconf...\r"); - - // first unlink. - __hello_unlink_device(nil); - - // then unregister syscalls. - kernelAddSyscall(0, nil); - kernelAddSyscall(1, nil); - - return 0; -} diff --git a/Drivers/Hello/compile_flags.txt b/Drivers/Hello/compile_flags.txt deleted file mode 100644 index 10bdb71e..00000000 --- a/Drivers/Hello/compile_flags.txt +++ /dev/null @@ -1,3 +0,0 @@ --I../../ --I../../Kernel --std=c++20 diff --git a/Drivers/Hello/x86_64.mk b/Drivers/Hello/x86_64.mk deleted file mode 100644 index 4ddb7e5b..00000000 --- a/Drivers/Hello/x86_64.mk +++ /dev/null @@ -1,51 +0,0 @@ -################################################## -# (C) ZKA Technologies, all rights reserved. -# This is the sample driver makefile. -################################################## - -CC_GNU=x86_64-w64-mingw32-gcc -LD_GNU=x86_64-w64-mingw32-ld - -WINDRES=x86_64-w64-mingw32-windres - -ADD_FILE=touch -COPY=cp -HTTP_GET=wget - -LD_FLAGS=-e __at_enter --subsystem=17 - -OBJ=*.o - -REM=rm -REM_FLAG=-f - -FLAG_ASM=-f win64 -FLAG_GNU=-fshort-wchar -D__DDK_AMD64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ \ - -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./ - -.PHONY: invalid-recipe -invalid-recipe: - @echo "invalid-recipe: Use make all instead." - -.PHONY: all -all: compile-amd64 - $(LD_GNU) $(OBJ) $(LD_FLAGS) -o Hello.exe - -ifneq ($(DEBUG_SUPPORT), ) -DEBUG = -D__DEBUG__ -endif - -.PHONY: compile-amd64 -compile-amd64: - $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o - $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DDK/*.cc) $(wildcard ../../DDK/*.c) $(wildcard ../../DDK/*.S) - -.PHONY: clean -clean: - $(REM) $(REM_FLAG) $(OBJ) Hello.exe - -.PHONY: help -help: - @echo "=== HELP ===" - @echo "clean: Clean driver." - @echo "compile-amd64: Build driver." diff --git a/Drivers/SampleDriver/CheckStck.c b/Drivers/SampleDriver/CheckStck.c deleted file mode 100644 index 54b6bc5d..00000000 --- a/Drivers/SampleDriver/CheckStck.c +++ /dev/null @@ -1,11 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -///! @brief Use this to check your stack, if using MinGW/MSVC/CodeTools. -void ___chkstk_ms(void) -{ - (void)0; -} diff --git a/Drivers/SampleDriver/DriverRsrc.rsrc b/Drivers/SampleDriver/DriverRsrc.rsrc deleted file mode 100644 index 2161fe29..00000000 --- a/Drivers/SampleDriver/DriverRsrc.rsrc +++ /dev/null @@ -1,25 +0,0 @@ -1 ICON "../../Icons/main.ico" - -1 VERSIONINFO -FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904E4" - BEGIN - VALUE "CompanyName", "ZKA Technologies" - VALUE "FileDescription", "New OS driver." - VALUE "FileVersion", "1.00" - VALUE "InternalName", "SampleDriver" - VALUE "LegalCopyright", "Copyright ZKA Technologies, all rights reserved." - VALUE "OriginalFilename", "SampleDriver.exe" - VALUE "ProductName", "SampleDriver" - VALUE "ProductVersion", "1.00" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1252 - END -END diff --git a/Drivers/SampleDriver/Main.c b/Drivers/SampleDriver/Main.c deleted file mode 100644 index 6b54742f..00000000 --- a/Drivers/SampleDriver/Main.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -#include -#include - -int __ImageStart(void) -{ - kernelPrintStr("SampleDriver: Starting up...\r"); - return 0; -} - -int __ImageEnd(void) -{ - kernelPrintStr("SampleDriver: Shutting down...\r"); - return 0; -} diff --git a/Drivers/SampleDriver/compile_flags.txt b/Drivers/SampleDriver/compile_flags.txt deleted file mode 100644 index 10bdb71e..00000000 --- a/Drivers/SampleDriver/compile_flags.txt +++ /dev/null @@ -1,3 +0,0 @@ --I../../ --I../../Kernel --std=c++20 diff --git a/Drivers/SampleDriver/x86_64.mk b/Drivers/SampleDriver/x86_64.mk deleted file mode 100644 index 736d8edf..00000000 --- a/Drivers/SampleDriver/x86_64.mk +++ /dev/null @@ -1,51 +0,0 @@ -################################################## -# (C) ZKA Technologies, all rights reserved. -# This is the sample driver makefile. -################################################## - -CC_GNU=x86_64-w64-mingw32-gcc -LD_GNU=x86_64-w64-mingw32-ld - -WINDRES=x86_64-w64-mingw32-windres - -ADD_FILE=touch -COPY=cp -HTTP_GET=wget - -LD_FLAGS=-e __at_enter --subsystem=17 - -OBJ=*.o - - -REM=rm -REM_FLAG=-f - -FLAG_ASM=-f win64 -FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./ - -.PHONY: invalid-recipe -invalid-recipe: - @echo "invalid-recipe: Use make all instead." - -.PHONY: all -all: compile-amd64 - $(LD_GNU) $(OBJ) $(LD_FLAGS) -o SampleDriver.exe - -ifneq ($(DEBUG_SUPPORT), ) -DEBUG = -D__DEBUG__ -endif - -.PHONY: compile-amd64 -compile-amd64: - $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o - $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DDK/*.c) $(wildcard ../../DDK/*.S) - -.PHONY: clean -clean: - $(REM) $(REM_FLAG) $(OBJ) SampleDriver.exe - -.PHONY: help -help: - @echo "=== HELP ===" - @echo "clean: Clean driver." - @echo "compile-amd64: Build driver." diff --git a/Drivers/VideoDrv/CheckStck.c b/Drivers/VideoDrv/CheckStck.c deleted file mode 100644 index dd280ae8..00000000 --- a/Drivers/VideoDrv/CheckStck.c +++ /dev/null @@ -1,11 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -///! @brief Use this to check your stack, if using MinGW/MSVC/MPCC. -void ___chkstk_ms(void) -{ - (void)0; -} diff --git a/Drivers/VideoDrv/DriverRsrc.rsrc b/Drivers/VideoDrv/DriverRsrc.rsrc deleted file mode 100644 index 0ed948d1..00000000 --- a/Drivers/VideoDrv/DriverRsrc.rsrc +++ /dev/null @@ -1,25 +0,0 @@ -1 ICON "../../Icons/main.ico" - -1 VERSIONINFO -FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0 -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904E4" - BEGIN - VALUE "CompanyName", "ZKA Technologies" - VALUE "FileDescription", "CG HW video driver." - VALUE "FileVersion", "1.00" - VALUE "InternalName", "SampleDriver" - VALUE "LegalCopyright", "2024 Copyright ZKA Technologies, all rights reserved." - VALUE "OriginalFilename", "VideoDrv.exe" - VALUE "ProductName", "VideoDrv" - VALUE "ProductVersion", "1.00" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1252 - END -END diff --git a/Drivers/VideoDrv/Main.cxx b/Drivers/VideoDrv/Main.cxx deleted file mode 100644 index 25c13b8e..00000000 --- a/Drivers/VideoDrv/Main.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - -------------------------------------------- */ - -#include -#include - -#include - -DK_EXTERN int __at_enter(void) -{ - kernelPrintStr("VideoDrv: Starting GPU...\r"); - return 0; -} - -DK_EXTERN int __at_exit(void) -{ - kernelPrintStr("VideoDrv: Shutting GPU...\r"); - return 0; -} diff --git a/Drivers/VideoDrv/compile_flags.txt b/Drivers/VideoDrv/compile_flags.txt deleted file mode 100644 index 10bdb71e..00000000 --- a/Drivers/VideoDrv/compile_flags.txt +++ /dev/null @@ -1,3 +0,0 @@ --I../../ --I../../Kernel --std=c++20 diff --git a/Drivers/VideoDrv/x86_64.make b/Drivers/VideoDrv/x86_64.make deleted file mode 100644 index b455c557..00000000 --- a/Drivers/VideoDrv/x86_64.make +++ /dev/null @@ -1,51 +0,0 @@ -################################################## -# (C) ZKA Technologies, all rights reserved. -# This is the sample driver makefile. -################################################## - -CC_GNU=x86_64-w64-mingw32-gcc -LD_GNU=x86_64-w64-mingw32-ld - -WINDRES=x86_64-w64-mingw32-windres - -ADD_FILE=touch -COPY=cp -HTTP_GET=wget - -LD_FLAGS=-e __at_enter --subsystem=17 - -OBJ=*.o - - -REM=rm -REM_FLAG=-f - -FLAG_ASM=-f win64 -FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./ - -.PHONY: invalid-recipe -invalid-recipe: - @echo "invalid-recipe: Use make all instead." - -.PHONY: all -all: compile-amd64 - $(LD_GNU) $(OBJ) $(LD_FLAGS) -o VideoDrv.exe - -ifneq ($(DEBUG_SUPPORT), ) -DEBUG = -D__DEBUG__ -endif - -.PHONY: compile-amd64 -compile-amd64: - $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o - $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.cxx) $(wildcard *.c) $(wildcard ../../DDK/*.c) $(wildcard ../../DDK/*.S) - -.PHONY: clean -clean: - $(REM) $(REM_FLAG) $(OBJ) VideoDrv.exe - -.PHONY: help -help: - @echo "=== HELP ===" - @echo "clean: Clean driver." - @echo "compile-amd64: Build driver." diff --git a/Kernel/riscv64-cb.make b/Kernel/riscv64-cb.make new file mode 100644 index 00000000..e69de29b diff --git a/Samples/.gitkeep b/Samples/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Samples/SampleHAL/CheckStck.c b/Samples/SampleHAL/CheckStck.c new file mode 100644 index 00000000..54b6bc5d --- /dev/null +++ b/Samples/SampleHAL/CheckStck.c @@ -0,0 +1,11 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies + +------------------------------------------- */ + +///! @brief Use this to check your stack, if using MinGW/MSVC/CodeTools. +void ___chkstk_ms(void) +{ + (void)0; +} diff --git a/Samples/SampleHAL/DriverRsrc.rsrc b/Samples/SampleHAL/DriverRsrc.rsrc new file mode 100644 index 00000000..c478f7b6 --- /dev/null +++ b/Samples/SampleHAL/DriverRsrc.rsrc @@ -0,0 +1,25 @@ +1 ICON "../../Icons/main.ico" + +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "ZKA Technologies" + VALUE "FileDescription", "ZKA HAL." + VALUE "FileVersion", "1.00" + VALUE "InternalName", "SampleHAL" + VALUE "LegalCopyright", "Copyright ZKA Technologies, all rights reserved." + VALUE "OriginalFilename", "SampleHAL.exe" + VALUE "ProductName", "SampleHAL" + VALUE "ProductVersion", "1.00" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END diff --git a/Samples/SampleHAL/Main.c b/Samples/SampleHAL/Main.c new file mode 100644 index 00000000..6b54742f --- /dev/null +++ b/Samples/SampleHAL/Main.c @@ -0,0 +1,20 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies + +------------------------------------------- */ + +#include +#include + +int __ImageStart(void) +{ + kernelPrintStr("SampleDriver: Starting up...\r"); + return 0; +} + +int __ImageEnd(void) +{ + kernelPrintStr("SampleDriver: Shutting down...\r"); + return 0; +} diff --git a/Samples/SampleHAL/compile_flags.txt b/Samples/SampleHAL/compile_flags.txt new file mode 100644 index 00000000..10bdb71e --- /dev/null +++ b/Samples/SampleHAL/compile_flags.txt @@ -0,0 +1,3 @@ +-I../../ +-I../../Kernel +-std=c++20 diff --git a/Samples/SampleHAL/x86_64.mk b/Samples/SampleHAL/x86_64.mk new file mode 100644 index 00000000..2fa20d1a --- /dev/null +++ b/Samples/SampleHAL/x86_64.mk @@ -0,0 +1,51 @@ +################################################## +# (C) ZKA Technologies, all rights reserved. +# This is the sample driver makefile. +################################################## + +CC_GNU=x86_64-w64-mingw32-gcc +LD_GNU=x86_64-w64-mingw32-ld + +WINDRES=x86_64-w64-mingw32-windres + +ADD_FILE=touch +COPY=cp +HTTP_GET=wget + +LD_FLAGS=-e __at_enter --subsystem=17 + +OBJ=*.o + + +REM=rm +REM_FLAG=-f + +FLAG_ASM=-f win64 +FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./ + +.PHONY: invalid-recipe +invalid-recipe: + @echo "invalid-recipe: Use make all instead." + +.PHONY: all +all: compile-amd64 + $(LD_GNU) $(OBJ) $(LD_FLAGS) -o SampleHAL.exe + +ifneq ($(DEBUG_SUPPORT), ) +DEBUG = -D__DEBUG__ +endif + +.PHONY: compile-amd64 +compile-amd64: + $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o + $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DDK/*.c) $(wildcard ../../DDK/*.S) + +.PHONY: clean +clean: + $(REM) $(REM_FLAG) $(OBJ) SampleHAL.exe + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "clean: Clean driver." + @echo "compile-amd64: Build driver." -- cgit v1.2.3