diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-18 10:55:51 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-18 11:12:37 +0200 |
| commit | 706c58b9b9fa74c63180f490a1f48652d0408944 (patch) | |
| tree | e6b95ff57512dfc2af153805286041c332a53f52 /Private/Drivers/SampleDriver | |
| parent | 41cc598c501ee190385c041b2149eae228b24741 (diff) | |
MHR-3: Start working on drivers now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Drivers/SampleDriver')
| -rw-r--r-- | Private/Drivers/SampleDriver/DriverRsrc.rsrc | 25 | ||||
| -rw-r--r-- | Private/Drivers/SampleDriver/SampleDriver.c | 9 | ||||
| -rw-r--r-- | Private/Drivers/SampleDriver/makefile | 62 |
3 files changed, 96 insertions, 0 deletions
diff --git a/Private/Drivers/SampleDriver/DriverRsrc.rsrc b/Private/Drivers/SampleDriver/DriverRsrc.rsrc new file mode 100644 index 00000000..f37e2796 --- /dev/null +++ b/Private/Drivers/SampleDriver/DriverRsrc.rsrc @@ -0,0 +1,25 @@ +1 ICON "../../Root/Boot/Icons/driver-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 driver." + VALUE "FileVersion", "1.00" + VALUE "InternalName", "SampleDriver" + VALUE "LegalCopyright", "Copyright Mahrouss-Logic, 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/Private/Drivers/SampleDriver/SampleDriver.c b/Private/Drivers/SampleDriver/SampleDriver.c new file mode 100644 index 00000000..79b19bf3 --- /dev/null +++ b/Private/Drivers/SampleDriver/SampleDriver.c @@ -0,0 +1,9 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +int __ImageStart(void) { + return 0; +} diff --git a/Private/Drivers/SampleDriver/makefile b/Private/Drivers/SampleDriver/makefile new file mode 100644 index 00000000..7d58b611 --- /dev/null +++ b/Private/Drivers/SampleDriver/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 SampleDriver.exe + cp SampleDriver.exe ../../Root/Boot/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) + +.PHONY: clean +clean: + $(REM) $(REM_FLAG) $(OBJ) SampleDriver.exe + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "clean: Clean driver." + @echo "compile-amd64: Build driver." |
