summaryrefslogtreecommitdiffhomepage
path: root/Private/Drivers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-20 23:13:11 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-20 23:13:11 +0200
commit155971914073bedfa585a0be4d14a40bd23e3b8f (patch)
treef39af19dc2f1b7f33cac33eff07001b2e791f7db /Private/Drivers
parent7013c094668be2204b1245496236f0cf6afa07c2 (diff)
MHR-9: Driver toolkit, initial commit.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Drivers')
-rw-r--r--Private/Drivers/Bonjour/DriverRsrc.rsrc25
-rw-r--r--Private/Drivers/Bonjour/SampleDriver.c18
-rw-r--r--Private/Drivers/Bonjour/makefile62
-rw-r--r--Private/Drivers/SampleDriver/SampleDriver.c5
-rw-r--r--Private/Drivers/SampleDriver/makefile2
5 files changed, 109 insertions, 3 deletions
diff --git a/Private/Drivers/Bonjour/DriverRsrc.rsrc b/Private/Drivers/Bonjour/DriverRsrc.rsrc
new file mode 100644
index 00000000..62347b80
--- /dev/null
+++ b/Private/Drivers/Bonjour/DriverRsrc.rsrc
@@ -0,0 +1,25 @@
+1 ICON "../../Root/Boot/Icons/bonjour-logo.ico"
+
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080904E4"
+ BEGIN
+ VALUE "CompanyName", "Mahrouss-Logic"
+ VALUE "FileDescription", "NewOS Bonjour driver."
+ VALUE "FileVersion", "1.00"
+ VALUE "InternalName", "Bonjour."
+ VALUE "LegalCopyright", "Copyright Mahrouss-Logic, 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/Private/Drivers/Bonjour/SampleDriver.c b/Private/Drivers/Bonjour/SampleDriver.c
new file mode 100644
index 00000000..8289fcbc
--- /dev/null
+++ b/Private/Drivers/Bonjour/SampleDriver.c
@@ -0,0 +1,18 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <DriverKit/KernelString.h>
+#include <DriverKit/KernelPrint.h>
+
+int __ImageStart(void) {
+ kernelPrintStr("SampleDriver: Starting up...\r\n");
+ return 0;
+}
+
+int __ImageEnd(void) {
+ kernelPrintStr("SampleDriver: Shutting down...\r\n");
+ return 0;
+}
diff --git a/Private/Drivers/Bonjour/makefile b/Private/Drivers/Bonjour/makefile
new file mode 100644
index 00000000..e1cdba67
--- /dev/null
+++ b/Private/Drivers/Bonjour/makefile
@@ -0,0 +1,62 @@
+##################################################
+# (C) Mahrouss Logic, 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
+
+ifeq ($(shell uname), Windows_NT)
+EMU=qemu-system-x86_64w
+else
+EMU=qemu-system-x86_64
+endif
+
+IMG=epm.img
+IMG_2=epm-slave.img
+EMU_FLAGS=-net none -smp 4 -m 4G -M q35 -bios OVMF.fd -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -drive file=fat:rw:CDROM,index=2,format=raw -d int -hdd epm-slave.img
+
+LD_FLAGS=-e __ImageStart --subsystem=17
+
+OBJ=$(wildcard *.o) $(wildcard HEL/AMD64/*.obj)
+
+
+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 Bonjour.exe
+ cp Bonjour.exe ../../Root/Boot/Bonjour.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 ../../DriverKit/*.c) $(wildcard ../../DriverKit/*.s)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) Bonjour.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."
diff --git a/Private/Drivers/SampleDriver/SampleDriver.c b/Private/Drivers/SampleDriver/SampleDriver.c
index 04d40516..8289fcbc 100644
--- a/Private/Drivers/SampleDriver/SampleDriver.c
+++ b/Private/Drivers/SampleDriver/SampleDriver.c
@@ -4,14 +4,15 @@
------------------------------------------- */
+#include <DriverKit/KernelString.h>
#include <DriverKit/KernelPrint.h>
int __ImageStart(void) {
- kernelPrintStr("SampleDriver: Starting up.\n");
+ kernelPrintStr("SampleDriver: Starting up...\r\n");
return 0;
}
int __ImageEnd(void) {
- kernelPrintStr("SampleDriver: Shutting down.\n");
+ kernelPrintStr("SampleDriver: Shutting down...\r\n");
return 0;
}
diff --git a/Private/Drivers/SampleDriver/makefile b/Private/Drivers/SampleDriver/makefile
index 19e88f8f..637be18d 100644
--- a/Private/Drivers/SampleDriver/makefile
+++ b/Private/Drivers/SampleDriver/makefile
@@ -49,7 +49,7 @@ endif
.PHONY: compile-amd64
compile-amd64:
$(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o
- $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DriverKit/*.c)
+ $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DriverKit/*.c) $(wildcard ../../DriverKit/*.s)
.PHONY: clean
clean: