add NTLITE_DRIVE and NTLITE_NTPATH so i can work on my pc and my laptop, fix dynamic driver loading
This commit is contained in:
1 parent
4b57738fe3
commit
cbb9ff469c
9 files changed
+15
-16
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@ setlocal enabledelayedexpansion
|
||||
|
||||
set ROOT=%~dp0.
|
||||
set SRC=%ROOT%\code
|
||||
set DEST=G:\
|
||||
set DEST=%NTLITE_DRIVE%
|
||||
|
||||
if exist "obj" rd /s /q "obj"
|
||||
if exist "bin" rd /s /q "bin"
|
||||
|
||||
+6
-8
@@ -107,21 +107,19 @@ static void InitializeDrivers(BOOT_INFO* bootInfo, const HAL_API* hal) {
|
||||
|
||||
// Load the driver
|
||||
size_t len = strlen(runtimeKeys[i]);
|
||||
|
||||
// Assemble the path
|
||||
// "drivers\" is 8 chars; +1 for the NUL terminator already in len.
|
||||
size_t pathLen = 8 + len + 1; // len already includes the NUL from strlen+1 above
|
||||
char *path = MmAllocatePool(pathLen);
|
||||
char* path = MmAllocatePool(len + 10);
|
||||
if (!path) {
|
||||
DbgPrint("InitializeDrivers: OOM building driver path\n");
|
||||
DbgPrint("KernelMain: Failed to allocate memory for driver path. How?\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
// memcpy manouvers
|
||||
memcpy(path, "drivers\\", 8);
|
||||
memcpy(path + 8, runtimeKeys[i], len); // len includes the NUL
|
||||
memcpy(path + 8, runtimeKeys[i], len + 1);
|
||||
|
||||
s = IoOpenFile(path, &f);
|
||||
if (s != STATUS_SUCCESS) {
|
||||
DbgPrint("InitializeDrivers: Failed to open runtime driver: %s\n", runtimeKeys[i]);
|
||||
DbgPrint("InitializeDrivers: Failed to open runtime driver: %s (%s)\n", runtimeKeys[i], path);
|
||||
continue; // Skip this driver but keep going with others
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@ It boots into a shell.
|
||||
|
||||
## how 2 build
|
||||
|
||||
* open env variables
|
||||
* set `NTLITE_DRIVE` as your thumbdrive (ex. `G:`)
|
||||
* set `NTLITE_NTPATH` as your thumbdrive (ex. `\\.\PhysicalDrive7`)
|
||||
* open vs x64 build tools
|
||||
* cd into this directory
|
||||
* `build.bat`
|
||||
* open `run.bat`/`rund.bat`/`runa.bat`/`runad.bat`
|
||||
* replace `\\.\PhysicalDrive7` with your thumbdrive partition
|
||||
* `run.bat`/`rund.bat`/`runa.bat`/`runad.bat`
|
||||
* `run.bat`(ide)/`rund.bat`(ide, debug)/`runa.bat`(ahci)/`runad.bat`(ahci, debug)
|
||||
* enjoy
|
||||
|
||||
## how it looks when built
|
||||
|
||||
@@ -1 +1 @@
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M.fd -drive format=raw,file=\\.\PhysicalDrive7 -serial stdio
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M.fd -drive format=raw,file=%NTLITE_NTPATH% -serial stdio
|
||||
@@ -1 +1 @@
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M_d.fd -device ahci,id=ahci -drive format=raw,file=\\.\PhysicalDrive7,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 -serial stdio
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M_d.fd -device ahci,id=ahci -drive format=raw,file=%NTLITE_NTPATH%,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 -serial stdio
|
||||
@@ -1 +1 @@
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M_d.fd -device ahci,id=ahci -drive format=raw,file=\\.\PhysicalDrive7,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 -m 4G -serial stdio -d in_asm,cpu_reset,int -D qemu.log -no-reboot -no-shutdown
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M_d.fd -device ahci,id=ahci -drive format=raw,file=%NTLITE_NTPATH%,if=none,id=disk0 -device ide-hd,bus=ahci.0,drive=disk0 -m 4G -serial stdio -d in_asm,cpu_reset,int -D qemu.log -no-reboot -no-shutdown
|
||||
@@ -1 +1 @@
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M.fd -drive format=raw,file=\\.\PhysicalDrive7 -m 4G -serial stdio -d in_asm,cpu_reset,int -D qemu.log -no-reboot -no-shutdown
|
||||
@start qemu-system-x86_64 -drive if=pflash,format=raw,readonly=on,file=OVMF\OVMF_CODE_4M.fd -drive if=pflash,format=raw,file=OVMF\OVMF_VARS_4M.fd -drive format=raw,file=%NTLITE_NTPATH% -m 4G -serial stdio -d in_asm,cpu_reset,int -D qemu.log -no-reboot -no-shutdown
|
||||
Reference in new issue
Block a user