redo boot around an explicit system volume and fixed kernel/HAL images, redo volumes and filesystem paths around capabilities instead of drive numbers and kernel CWD state, add a capability/security model with derived and revocable handles and security contexts, add port IPC and rssrv to manage the userspace resource namespace and publish the system volume, move process, dll and path loading to userspace and add process builder syscalls, init now supervises rssrv and the session process, redo the syscall ABI around request structs and four arguments, add a volume manager and proper partition arrival/removal handling so FAT and NTFS mount dynamically, clean up the HAL/DDK boundary so drivers don't depend on HAL internals, save fpu state properly now, the serial driver doesn't hang on a missing port, fix AHCI startup races, fix timeout accounting, fix shared mmap writeback, more smoke tests
This commit is contained in:
1 parent
4add6789ba
commit
f882d339fb
232 files changed
+20934
-8898
No files matched your search
+226
-142
@@ -14,30 +14,33 @@
|
||||
#define USER_HEAP_OBJS_LITERAL "obj\\runtime\\user_heap.obj obj\\runtime\\user_heap_exports.obj"
|
||||
#define NATIVE_RUNTIME_OBJS_LITERAL "obj\\runtime\\native_exception.obj obj\\runtime\\native_start.obj"
|
||||
#define NATIVE_EXE_LIBS_LITERAL "bin\\syscall.lib obj\\libc.obj " USER_HEAP_OBJS_LITERAL " " NATIVE_RUNTIME_OBJS_LITERAL
|
||||
#define NATIVE_INIT_LIBS_LITERAL "bin\\syscall.lib obj\\libc.obj " USER_HEAP_OBJS_LITERAL " obj\\runtime\\native_exception.obj"
|
||||
#define NATIVE_INIT_LIBS_LITERAL "bin\\syscall_s.lib obj\\libc.obj obj\\runtime\\native_exception.obj"
|
||||
#define NATIVE_SERVICE_LIBS_LITERAL "bin\\syscall_s.lib obj\\libc.obj " USER_HEAP_OBJS_LITERAL " obj\\runtime\\native_exception.obj"
|
||||
#define WIN32_EXE_LIBS_LITERAL "bin\\win32.lib bin\\syscall.lib obj\\libc.obj obj\\runtime\\native_start.obj"
|
||||
#define POSIX_EXE_LIBS_LITERAL "bin\\posix.lib bin\\syscall.lib obj\\libc.obj obj\\runtime\\posix_start.obj obj\\runtime\\native_exception.obj"
|
||||
#define NATIVE_EXE_ENTRY_LITERAL "/ENTRY:NtlNativeStart"
|
||||
#define USER_IMAGE_FLAGS_LITERAL "/DYNAMICBASE /HIGHENTROPYVA"
|
||||
#define LWIP_CFLAGS_LITERAL DRIVER_CFLAGS_LITERAL " /Icode\\drivers\\net\\lwip\\include /Icode\\drivers\\net\\lwip\\third_party\\lwip\\src\\include /wd4005 /wd4100 /wd4103 /wd4127 /wd4244 /wd4267 /wd4706"
|
||||
#define LFLAGS_LITERAL "/nologo /NODEFAULTLIB /DEBUG"
|
||||
|
||||
// Partition offsets inside disk.vhd
|
||||
#define VHD_PART1 "disk.vhd@@1M" // ESP / Partition 1 (Offset 1MB)
|
||||
#define VHD_PART2 "disk.vhd@@65M" // Test/Data / Partition 2 (Offset 65MB)
|
||||
#define DEFAULT_VHD_DISK_SIGNATURE 0x4E544C31u
|
||||
|
||||
const char *CommonCflags = COMMON_CFLAGS_LITERAL;
|
||||
const char *KernelCflags = KERNEL_CFLAGS_LITERAL;
|
||||
const char *UserCflags = USER_CFLAGS_LITERAL;
|
||||
const char *BootCflags = BOOT_CFLAGS_LITERAL;
|
||||
const char *LwipCflags = LWIP_CFLAGS_LITERAL;
|
||||
const char *LFLAGS = LFLAGS_LITERAL;
|
||||
const char* CommonCflags = COMMON_CFLAGS_LITERAL;
|
||||
const char* KernelCflags = KERNEL_CFLAGS_LITERAL;
|
||||
const char* UserCflags = USER_CFLAGS_LITERAL;
|
||||
const char* BootCflags = BOOT_CFLAGS_LITERAL;
|
||||
const char* LwipCflags = LWIP_CFLAGS_LITERAL;
|
||||
const char* LFLAGS = LFLAGS_LITERAL;
|
||||
|
||||
typedef struct Driver_Target {
|
||||
const char *name;
|
||||
const char *obj_dir;
|
||||
const char *sources;
|
||||
const char *cflags;
|
||||
const char *libs;
|
||||
const char* name;
|
||||
const char* obj_dir;
|
||||
const char* sources;
|
||||
const char* cflags;
|
||||
const char* libs;
|
||||
} Driver_Target;
|
||||
|
||||
#define DRIVER_TARGET(name_, obj_dir_, sources_) { (name_), (obj_dir_), (sources_), DRIVER_CFLAGS_LITERAL, "" }
|
||||
@@ -63,13 +66,13 @@ static const Driver_Target STANDALONE_DRIVERS[] = {
|
||||
|
||||
// Creates layout.
|
||||
void create_layout() {
|
||||
const char *dirs[] = {
|
||||
const char* dirs[] = {
|
||||
"obj", "bin", "obj\\boot", "obj\\kernel", "obj\\lwip", "obj\\hal",
|
||||
"obj\\syscall", "obj\\runtime", "obj\\win32", "obj\\posix", "obj\\drivers", "obj\\init",
|
||||
"obj\\syscall", "obj\\runtime", "obj\\win32", "obj\\posix", "obj\\drivers", "obj\\init", "obj\\rssrv",
|
||||
"obj\\shell_win32", "obj\\shell_posix", "obj\\shell_native",
|
||||
"obj\\async_apc", "obj\\async_cancel", "obj\\apc_return_smoke", "obj\\edit", "obj\\httpget",
|
||||
"obj\\tcpserve", "obj\\udp", "obj\\resolve", "obj\\ping", "obj\\doom", "obj\\video", "obj\\memtop",
|
||||
"obj\\file_stat_smoke", "obj\\handle_dup_smoke", "obj\\named_queue_lifetime_smoke", "obj\\input_api_smoke", "obj\\input_model_smoke", "obj\\timer_smoke", "obj\\stats_abi_smoke", "obj\\realpath_smoke", "obj\\file_lock_smoke", "obj\\process_protection_smoke", "obj\\socket_addr_smoke", "obj\\syscall_contract_smoke", "obj\\would_block_smoke", "obj\\audio_stream_smoke", "obj\\winmm_waveout_smoke", "obj\\win32_condition_variable_smoke", "obj\\win32_mutex_smoke", "obj\\win32_thread_suspend_smoke", "obj\\win32_module_lookup_smoke", "obj\\cwd_peb_smoke", "obj\\mmap_smoke", "obj\\pcache_smoke", "obj\\pcache_pressure", "obj\\dirty_writeback", "obj\\shared_mmap",
|
||||
"obj\\file_stat_smoke", "obj\\handle_dup_smoke", "obj\\security_smoke", "obj\\port_ipc_smoke", "obj\\resource_service_smoke", "obj\\named_queue_lifetime_smoke", "obj\\input_api_smoke", "obj\\input_model_smoke", "obj\\timer_smoke", "obj\\stats_abi_smoke", "obj\\realpath_smoke", "obj\\file_lock_smoke", "obj\\process_protection_smoke", "obj\\process_exit_multithread_smoke", "obj\\process_builder_smoke", "obj\\socket_addr_smoke", "obj\\syscall_contract_smoke", "obj\\would_block_smoke", "obj\\audio_stream_smoke", "obj\\winmm_waveout_smoke", "obj\\win32_condition_variable_smoke", "obj\\win32_mutex_smoke", "obj\\win32_thread_suspend_smoke", "obj\\win32_module_lookup_smoke", "obj\\cwd_userspace_smoke", "obj\\mmap_smoke", "obj\\pcache_smoke", "obj\\pcache_pressure", "obj\\dirty_writeback", "obj\\shared_mmap",
|
||||
"obj\\pcache_invalidate", "obj\\pcache_mmap_read_reuse", "obj\\pcache_multithread",
|
||||
"obj\\all_tests", "obj\\surface_smoke", "obj\\surface_invalid_rect", "obj\\surface_multithread_present", "obj\\net_irp_smoke", "obj\\module_load_smoke", "obj\\posix_module_smoke", "obj\\exception_dispatcher_smoke", "obj\\native_exception_runtime_smoke", "obj\\native_raise_exception_smoke", "obj\\exception_smoke", "obj\\win32_exception_smoke", "obj\\win32_seh_smoke"
|
||||
};
|
||||
@@ -79,7 +82,7 @@ void create_layout() {
|
||||
}
|
||||
|
||||
// Runs a shell command and waits for it to finish.
|
||||
bool run_sync(const char *cmd_str) {
|
||||
bool run_sync(const char* cmd_str) {
|
||||
Nob_Cmd cmd = {0};
|
||||
nob_cmd_append(&cmd, "cmd.exe", "/c", cmd_str);
|
||||
bool ok = nob_cmd_run_sync(cmd);
|
||||
@@ -88,7 +91,7 @@ bool run_sync(const char *cmd_str) {
|
||||
}
|
||||
|
||||
// Launches a shell command while the build graph continues.
|
||||
Nob_Proc run_async(const char *cmd_str) {
|
||||
Nob_Proc run_async(const char* cmd_str) {
|
||||
Nob_Cmd cmd = {0};
|
||||
nob_cmd_append(&cmd, "cmd.exe", "/c", cmd_str);
|
||||
Nob_Proc proc = nob_cmd_run_async(cmd);
|
||||
@@ -97,20 +100,20 @@ Nob_Proc run_async(const char *cmd_str) {
|
||||
}
|
||||
|
||||
// Deletes stale object files from a target directory before compiling into it.
|
||||
bool clean_object_directory(const char *obj_dir) {
|
||||
const char *cmd = nob_temp_sprintf("if exist %s\\*.obj del /q %s\\*.obj", obj_dir, obj_dir);
|
||||
bool clean_object_directory(const char* obj_dir) {
|
||||
const char* cmd = nob_temp_sprintf("if exist %s\\*.obj del /q %s\\*.obj", obj_dir, obj_dir);
|
||||
return run_sync(cmd);
|
||||
}
|
||||
|
||||
// Cleans object directories that are linked through wildcards.
|
||||
bool clean_build_object_directories(void) {
|
||||
const char *dirs[] = {
|
||||
const char* dirs[] = {
|
||||
"obj\\boot", "obj\\kernel", "obj\\lwip", "obj\\hal",
|
||||
"obj\\syscall", "obj\\runtime", "obj\\win32", "obj\\posix",
|
||||
"obj\\init", "obj\\shell_win32", "obj\\shell_posix", "obj\\shell_native",
|
||||
"obj\\init", "obj\\rssrv", "obj\\shell_win32", "obj\\shell_posix", "obj\\shell_native",
|
||||
"obj\\async_apc", "obj\\async_cancel", "obj\\apc_return_smoke", "obj\\edit", "obj\\httpget",
|
||||
"obj\\tcpserve", "obj\\udp", "obj\\resolve", "obj\\ping",
|
||||
"obj\\doom", "obj\\video", "obj\\memtop", "obj\\file_stat_smoke", "obj\\handle_dup_smoke", "obj\\named_queue_lifetime_smoke", "obj\\input_api_smoke", "obj\\input_model_smoke", "obj\\timer_smoke", "obj\\stats_abi_smoke", "obj\\realpath_smoke", "obj\\file_lock_smoke", "obj\\process_protection_smoke", "obj\\socket_addr_smoke", "obj\\syscall_contract_smoke", "obj\\would_block_smoke", "obj\\audio_stream_smoke", "obj\\winmm_waveout_smoke", "obj\\win32_condition_variable_smoke", "obj\\win32_mutex_smoke", "obj\\win32_thread_suspend_smoke", "obj\\win32_module_lookup_smoke", "obj\\cwd_peb_smoke", "obj\\mmap_smoke", "obj\\pcache_smoke", "obj\\pcache_pressure", "obj\\dirty_writeback", "obj\\shared_mmap",
|
||||
"obj\\doom", "obj\\video", "obj\\memtop", "obj\\file_stat_smoke", "obj\\handle_dup_smoke", "obj\\security_smoke", "obj\\port_ipc_smoke", "obj\\resource_service_smoke", "obj\\named_queue_lifetime_smoke", "obj\\input_api_smoke", "obj\\input_model_smoke", "obj\\timer_smoke", "obj\\stats_abi_smoke", "obj\\realpath_smoke", "obj\\file_lock_smoke", "obj\\process_protection_smoke", "obj\\process_exit_multithread_smoke", "obj\\process_builder_smoke", "obj\\socket_addr_smoke", "obj\\syscall_contract_smoke", "obj\\would_block_smoke", "obj\\audio_stream_smoke", "obj\\winmm_waveout_smoke", "obj\\win32_condition_variable_smoke", "obj\\win32_mutex_smoke", "obj\\win32_thread_suspend_smoke", "obj\\win32_module_lookup_smoke", "obj\\cwd_userspace_smoke", "obj\\mmap_smoke", "obj\\pcache_smoke", "obj\\pcache_pressure", "obj\\dirty_writeback", "obj\\shared_mmap",
|
||||
"obj\\pcache_invalidate", "obj\\pcache_mmap_read_reuse", "obj\\pcache_multithread",
|
||||
"obj\\all_tests", "obj\\surface_smoke", "obj\\surface_invalid_rect", "obj\\surface_multithread_present", "obj\\net_irp_smoke", "obj\\module_load_smoke", "obj\\posix_module_smoke", "obj\\exception_dispatcher_smoke", "obj\\native_exception_runtime_smoke", "obj\\native_raise_exception_smoke", "obj\\exception_smoke", "obj\\win32_exception_smoke", "obj\\win32_seh_smoke"
|
||||
};
|
||||
@@ -132,21 +135,43 @@ bool create_usbfatroot_if_missing(void) {
|
||||
return nob_mkdir_if_not_exists("usbfatroot");
|
||||
}
|
||||
|
||||
// Utility to copy a local file into a FAT image using mcopy without admin rights.
|
||||
bool mcopy_file(const char *src, const char *vhd_target, const char *dst_path) {
|
||||
const char *cmd = nob_temp_sprintf("mcopy -o -i %s %s ::%s", vhd_target, src, dst_path);
|
||||
// Copies one local file into a FAT image using mcopy without admin rights.
|
||||
bool mcopy_file(const char* src, const char* vhd_target, const char* dst_path) {
|
||||
const char* cmd = nob_temp_sprintf("mcopy -o -i %s %s ::%s", vhd_target, src, dst_path);
|
||||
return run_sync(cmd);
|
||||
}
|
||||
|
||||
// Copies several same-name files into one FAT directory with a single mcopy process.
|
||||
bool mcopy_files_to_dir(const char* vhd_target,
|
||||
const char* dst_dir,
|
||||
const char* const* sources,
|
||||
size_t source_count) {
|
||||
if (!vhd_target || !dst_dir || (!sources && source_count))
|
||||
return false;
|
||||
if (!source_count)
|
||||
return true;
|
||||
|
||||
Nob_String_Builder command = {0};
|
||||
nob_sb_appendf(&command, "mcopy -o -i %s", vhd_target);
|
||||
for (size_t i = 0; i < source_count; ++i)
|
||||
nob_sb_appendf(&command, " %s", sources[i]);
|
||||
nob_sb_appendf(&command, " ::%s", dst_dir);
|
||||
nob_sb_append_null(&command);
|
||||
|
||||
bool ok = run_sync(command.items);
|
||||
nob_sb_free(command);
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Utility to create a directory in a FAT image using mmd.
|
||||
bool mmd_dir(const char *vhd_target, const char *dir_path) {
|
||||
const char *cmd = nob_temp_sprintf("mmd -i %s ::%s 2>nul", vhd_target, dir_path);
|
||||
bool mmd_dir(const char* vhd_target, const char* dir_path) {
|
||||
const char* cmd = nob_temp_sprintf("mmd -i %s ::%s 2>nul", vhd_target, dir_path);
|
||||
run_sync(cmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Writes a 512-byte Connectix VHD Fixed Disk Footer at the end of the file.
|
||||
static void write_vpc_footer(FILE *f, uint64_t disk_size_bytes) {
|
||||
static void write_vpc_footer(FILE* f, uint64_t disk_size_bytes) {
|
||||
uint8_t footer[512] = {0};
|
||||
|
||||
memcpy(&footer[0], "conectix", 8);
|
||||
@@ -208,14 +233,30 @@ static void write_vpc_footer(FILE *f, uint64_t disk_size_bytes) {
|
||||
fwrite(footer, 1, 512, f);
|
||||
}
|
||||
|
||||
// Ensures the managed development VHD carries the stable identity used by boot.ini.
|
||||
static bool ensure_disk_vhd_signature(void) {
|
||||
FILE* f = fopen("disk.vhd", "r+b");
|
||||
if (!f) return false;
|
||||
|
||||
uint32_t signature = DEFAULT_VHD_DISK_SIGNATURE;
|
||||
if (fseek(f, 440, SEEK_SET) != 0 ||
|
||||
fwrite(&signature, sizeof(signature), 1, f) != 1) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Creates a 512 MB partitioned disk.vhd image with a valid VPC footer.
|
||||
bool create_disk_vhd_if_missing(void) {
|
||||
if (nob_file_exists("disk.vhd")) return true;
|
||||
if (nob_file_exists("disk.vhd")) return ensure_disk_vhd_signature();
|
||||
|
||||
nob_log(NOB_INFO, "disk.vhd missing, creating new 512 MB fixed VHD image...");
|
||||
|
||||
const uint64_t disk_size = (uint64_t)512 * 1024 * 1024; // 512 MB Payload
|
||||
FILE *f = fopen("disk.vhd", "wb");
|
||||
FILE* f = fopen("disk.vhd", "wb");
|
||||
if (!f) {
|
||||
nob_log(NOB_ERROR, "Failed to create disk.vhd file!");
|
||||
return false;
|
||||
@@ -230,11 +271,13 @@ bool create_disk_vhd_if_missing(void) {
|
||||
|
||||
// Build standard MBR partition table (Sector 0)
|
||||
uint8_t mbr[512] = {0};
|
||||
uint32_t disk_signature = DEFAULT_VHD_DISK_SIGNATURE;
|
||||
memcpy(&mbr[440], &disk_signature, sizeof(disk_signature));
|
||||
mbr[510] = 0x55;
|
||||
mbr[511] = 0xAA;
|
||||
|
||||
// Partition 1 Entry: 64MB FAT32 @ LBA 2048 (1MB offset)
|
||||
uint8_t *p1 = &mbr[0x01BE];
|
||||
uint8_t* p1 = &mbr[0x01BE];
|
||||
p1[0] = 0x80; // Active / Bootable
|
||||
p1[1] = 0x00; p1[2] = 0x02; p1[3] = 0x00; // CHS Start
|
||||
p1[4] = 0x0C; // FAT32 LBA
|
||||
@@ -245,7 +288,7 @@ bool create_disk_vhd_if_missing(void) {
|
||||
memcpy(&p1[12], &p1_sectors, 4);
|
||||
|
||||
// Partition 2 Entry: 256MB FAT32 @ LBA 133120 (65MB offset)
|
||||
uint8_t *p2 = &mbr[0x01CE];
|
||||
uint8_t* p2 = &mbr[0x01CE];
|
||||
p2[0] = 0x00; // Inactive
|
||||
p2[1] = 0x00; p2[2] = 0x01; p2[3] = 0x08; // CHS Start
|
||||
p2[4] = 0x0C; // FAT32 LBA
|
||||
@@ -272,7 +315,7 @@ bool create_disk_vhd_if_missing(void) {
|
||||
}
|
||||
|
||||
// Runs the requested operation.
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char** argv) {
|
||||
NOB_GO_REBUILD_URSELF(argc, argv);
|
||||
|
||||
if (!create_disk_vhd_if_missing()) return 1;
|
||||
@@ -282,14 +325,25 @@ int main(int argc, char **argv) {
|
||||
|
||||
nob_log(NOB_INFO, "--- Building Core Subsystems ---");
|
||||
|
||||
const char *core_tasks[] = {
|
||||
const char* core_tasks[] = {
|
||||
"ml64 /nologo /c /Foobj\\kernel\\ke_switch.obj code\\kernel\\ke_switch.asm",
|
||||
"ml64 /nologo /c /Foobj\\kernel\\ke_syscall_asm.obj code\\kernel\\ke_syscall.asm",
|
||||
"ml64 /nologo /c /Foobj\\kernel\\ke_gdt_reload.obj code\\kernel\\ke_gdt_reload.asm",
|
||||
"ml64 /nologo /c /Foobj\\syscall\\stubs.obj code\\user\\syscall\\syscall_stubs.asm",
|
||||
"ml64 /nologo /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\stubs_s.obj code\\user\\syscall\\syscall_stubs.asm",
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_BUILD /c /Foobj\\syscall\\pe_loader.obj code\\user\\syscall\\pe_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\pe_loader_s.obj code\\user\\syscall\\pe_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_BUILD /c /Foobj\\syscall\\module_loader.obj code\\user\\syscall\\module_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\module_loader_s.obj code\\user\\syscall\\module_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_BUILD /c /Foobj\\syscall\\process_loader.obj code\\user\\syscall\\process_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\process_loader_s.obj code\\user\\syscall\\process_loader.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_BUILD /c /Foobj\\syscall\\resource.obj code\\user\\syscall\\resource.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\resource_s.obj code\\user\\syscall\\resource.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_BUILD /c /Foobj\\syscall\\path.obj code\\user\\syscall\\path.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DNTL_SYSCALL_STATIC /c /Foobj\\syscall\\path_s.obj code\\user\\syscall\\path.c", UserCflags),
|
||||
"for %f in (code\\boot\\uefi\\*.asm) do ml64 /nologo /c /Fo\"obj\\boot\\%~nf.obj\" \"%f\"",
|
||||
|
||||
nob_temp_sprintf("cl %s /MP /c /Foobj\\ code\\common\\printf.c code\\common\\ini_parser.c", CommonCflags),
|
||||
nob_temp_sprintf("cl %s /MP /c /Foobj\\ code\\common\\printf.c", CommonCflags),
|
||||
"cl /nologo /c /Foobj\\libc.obj code\\common\\libc.c",
|
||||
nob_temp_sprintf("cl %s /c /Foobj\\runtime\\user_heap.obj code\\user\\runtime\\heap.c", UserCflags),
|
||||
nob_temp_sprintf("cl %s /c /Foobj\\runtime\\user_heap_exports.obj code\\user\\runtime\\heap_exports.c", UserCflags),
|
||||
@@ -298,18 +352,19 @@ int main(int argc, char **argv) {
|
||||
nob_temp_sprintf("cl %s /c /Foobj\\runtime\\posix_start.obj code\\user\\runtime\\posix_start.c", UserCflags),
|
||||
|
||||
// Bootloader.
|
||||
nob_temp_sprintf("cl %s /MP /c /Icode\\boot\\uefi\\include /Foobj\\boot\\ code\\boot\\uefi\\*.c && link %s /FORCE:MULTIPLE /SUBSYSTEM:EFI_APPLICATION /ENTRY:UefiMain /OUT:bin\\bootx64.efi obj\\libc.obj obj\\ini_parser.obj code\\boot\\uefi\\efilib.lib obj\\boot\\*.obj", BootCflags, LFLAGS),
|
||||
nob_temp_sprintf("cl %s /MP /c /Icode\\boot\\uefi\\include /Foobj\\boot\\ code\\boot\\uefi\\*.c code\\common\\boot_volume_selector.c && link %s /FORCE:MULTIPLE /SUBSYSTEM:EFI_APPLICATION /ENTRY:UefiMain /OUT:bin\\bootx64.efi obj\\libc.obj code\\boot\\uefi\\efilib.lib obj\\boot\\*.obj", BootCflags, LFLAGS),
|
||||
|
||||
// HAL.
|
||||
nob_temp_sprintf("cl %s /MP /c /Foobj\\hal\\ code\\kernel\\hal\\*.c && link %s /DLL /OUT:bin\\hal.dll /ENTRY:HalInitialize /IGNORE:4216 obj\\printf.obj obj\\libc.obj obj\\hal\\*.obj", KernelCflags, LFLAGS),
|
||||
nob_temp_sprintf("cl %s /DNTL_HAL_BUILD /MP /c /Foobj\\hal\\ code\\kernel\\hal\\*.c && link %s /DLL /FIXED /DYNAMICBASE:NO /HIGHENTROPYVA:NO /RELEASE /BASE:0xFFFF800010000000 /OUT:bin\\hal.dll /NOENTRY /IGNORE:4216 obj\\printf.obj obj\\libc.obj obj\\hal\\*.obj", KernelCflags, LFLAGS),
|
||||
|
||||
// Kernel.
|
||||
nob_temp_sprintf("cl %s /DKE_DISPLAY_BUILD /MP /c /Foobj\\kernel\\ code\\kernel\\*.c && link %s /SUBSYSTEM:NATIVE /ENTRY:KernelMain /OUT:bin\\kernel.exe bin\\hal.lib obj\\ini_parser.obj obj\\printf.obj obj\\libc.obj obj\\kernel\\*.obj", KernelCflags, LFLAGS),
|
||||
nob_temp_sprintf("cl %s /DKE_DISPLAY_BUILD /MP /c /Foobj\\kernel\\ code\\kernel\\*.c code\\common\\boot_volume_selector.c && link %s /SUBSYSTEM:NATIVE /FIXED /DYNAMICBASE:NO /HIGHENTROPYVA:NO /RELEASE /BASE:0xFFFF800000000000 /ENTRY:KernelMain /OUT:bin\\kernel.exe bin\\hal.lib obj\\printf.obj obj\\libc.obj obj\\kernel\\*.obj", KernelCflags, LFLAGS),
|
||||
|
||||
// Subsystem DLLs.
|
||||
"link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\syscall.dll obj\\syscall\\stubs.obj",
|
||||
nob_temp_sprintf("cl %s /DUSER_HEAP_EXPORTS /DNTL_EXCEPTION_EXPORTS /MP /c /Foobj\\win32\\ code\\user\\runtime\\heap.c code\\user\\runtime\\heap_exports.c code\\user\\runtime\\native_exception.c code\\user\\personalities\\win32\\*.c && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\win32.dll bin\\syscall.lib obj\\libc.obj obj\\win32\\*.obj", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DUSER_HEAP_EXPORTS /MP /c /Foobj\\posix\\ code\\user\\runtime\\heap.c code\\user\\runtime\\heap_exports.c code\\user\\personalities\\posix\\*.c && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\posix.dll bin\\syscall.lib obj\\libc.obj obj\\posix\\*.obj", UserCflags)
|
||||
"link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL " USER_IMAGE_FLAGS_LITERAL " /OUT:bin\\syscall.dll obj\\syscall\\stubs.obj obj\\syscall\\pe_loader.obj obj\\syscall\\module_loader.obj obj\\syscall\\process_loader.obj obj\\syscall\\resource.obj obj\\syscall\\path.obj obj\\libc.obj",
|
||||
"lib /nologo /OUT:bin\\syscall_s.lib obj\\syscall\\stubs_s.obj obj\\syscall\\pe_loader_s.obj obj\\syscall\\module_loader_s.obj obj\\syscall\\process_loader_s.obj obj\\syscall\\resource_s.obj obj\\syscall\\path_s.obj",
|
||||
nob_temp_sprintf("cl %s /DUSER_HEAP_EXPORTS /DNTL_EXCEPTION_EXPORTS /MP /c /Foobj\\win32\\ code\\user\\runtime\\heap.c code\\user\\runtime\\heap_exports.c code\\user\\runtime\\native_exception.c code\\user\\personalities\\win32\\*.c && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL " USER_IMAGE_FLAGS_LITERAL " /OUT:bin\\win32.dll bin\\syscall.lib obj\\libc.obj obj\\win32\\*.obj", UserCflags),
|
||||
nob_temp_sprintf("cl %s /DUSER_HEAP_EXPORTS /MP /c /Foobj\\posix\\ code\\user\\runtime\\heap.c code\\user\\runtime\\heap_exports.c code\\user\\personalities\\posix\\*.c && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL " USER_IMAGE_FLAGS_LITERAL " /OUT:bin\\posix.dll bin\\syscall.lib obj\\libc.obj obj\\posix\\*.obj", UserCflags)
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(core_tasks); i++) {
|
||||
@@ -317,8 +372,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
nob_log(NOB_INFO, "--- Building Bus Drivers ---");
|
||||
const char *pci_cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Fo%s\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\%s.sys /IMPLIB:bin\\%s.lib /ENTRY:DriverEntry bin\\hal.lib bin\\kernel.lib obj\\printf.obj obj\\libc.obj %s\\*.obj",
|
||||
const char* pci_cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Fo%s\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\%s.sys /IMPLIB:bin\\%s.lib /ENTRY:DriverEntry bin\\kernel.lib obj\\printf.obj obj\\libc.obj %s\\*.obj",
|
||||
PCI_BUS_DRIVER.cflags, PCI_BUS_DRIVER.obj_dir, PCI_BUS_DRIVER.sources,
|
||||
PCI_BUS_DRIVER.name, PCI_BUS_DRIVER.name, PCI_BUS_DRIVER.obj_dir
|
||||
);
|
||||
@@ -328,9 +383,9 @@ int main(int argc, char **argv) {
|
||||
Nob_Procs procs = {0};
|
||||
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(STANDALONE_DRIVERS); i++) {
|
||||
const Driver_Target *driver = &STANDALONE_DRIVERS[i];
|
||||
const char *cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Fo%s\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\%s.sys /ENTRY:DriverEntry bin\\hal.lib bin\\kernel.lib %s obj\\libc.obj %s\\*.obj",
|
||||
const Driver_Target* driver = &STANDALONE_DRIVERS[i];
|
||||
const char* cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Fo%s\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\%s.sys /ENTRY:DriverEntry bin\\kernel.lib %s obj\\libc.obj %s\\*.obj",
|
||||
driver->cflags, driver->obj_dir, driver->sources, driver->name,
|
||||
driver->libs ? driver->libs : "", driver->obj_dir
|
||||
);
|
||||
@@ -349,11 +404,12 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
nob_sb_append_null(&lwip_files);
|
||||
nob_da_append(&procs, run_async(nob_temp_sprintf("cl %s /MP /c /Foobj\\lwip\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\lwip.sys /ENTRY:DriverEntry bin\\hal.lib bin\\kernel.lib obj\\libc.obj obj\\lwip\\*.obj", LwipCflags, lwip_files.items)));
|
||||
nob_da_append(&procs, run_async(nob_temp_sprintf("cl %s /MP /c /Foobj\\lwip\\ %s && link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:bin\\lwip.sys /ENTRY:DriverEntry bin\\kernel.lib obj\\libc.obj obj\\lwip\\*.obj", LwipCflags, lwip_files.items)));
|
||||
}
|
||||
|
||||
const char *apps[][4] = {
|
||||
const char* apps[][4] = {
|
||||
{"system\\init", NATIVE_INIT_LIBS_LITERAL, "init", "/ENTRY:_start"},
|
||||
{"system\\rssrv", NATIVE_SERVICE_LIBS_LITERAL, "rssrv", "/ENTRY:_start"},
|
||||
{"tests\\all_tests", NATIVE_EXE_LIBS_LITERAL, "all_tests", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"apps\\shell_win32", WIN32_EXE_LIBS_LITERAL, "shell_win32", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"apps\\shell_posix", POSIX_EXE_LIBS_LITERAL, "shell_posix", "/ENTRY:PosixStart"},
|
||||
@@ -363,6 +419,9 @@ int main(int argc, char **argv) {
|
||||
{"tests\\async_cancel", NATIVE_EXE_LIBS_LITERAL, "async_cancel", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\file_stat_smoke", NATIVE_EXE_LIBS_LITERAL, "file_stat_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\handle_dup_smoke", NATIVE_EXE_LIBS_LITERAL, "handle_dup_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\security_smoke", NATIVE_EXE_LIBS_LITERAL, "security_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\port_ipc_smoke", NATIVE_EXE_LIBS_LITERAL, "port_ipc_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\resource_service_smoke", NATIVE_EXE_LIBS_LITERAL, "resource_service_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\named_queue_lifetime_smoke", NATIVE_EXE_LIBS_LITERAL, "named_queue_lifetime_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\input_api_smoke", NATIVE_EXE_LIBS_LITERAL, "input_api_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\input_model_smoke", NATIVE_EXE_LIBS_LITERAL, "input_model_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
@@ -371,6 +430,8 @@ int main(int argc, char **argv) {
|
||||
{"tests\\realpath_smoke", NATIVE_EXE_LIBS_LITERAL, "realpath_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\file_lock_smoke", NATIVE_EXE_LIBS_LITERAL, "file_lock_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\process_protection_smoke", NATIVE_EXE_LIBS_LITERAL, "process_protection_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\process_exit_multithread_smoke", NATIVE_EXE_LIBS_LITERAL, "process_exit_multithread_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\process_builder_smoke", "bin\\syscall_s.lib obj\\libc.obj " NATIVE_RUNTIME_OBJS_LITERAL, "process_builder_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\socket_addr_smoke", NATIVE_EXE_LIBS_LITERAL, "socket_addr_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\net_irp_smoke", NATIVE_EXE_LIBS_LITERAL, "net_irp_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\module_load_smoke", NATIVE_EXE_LIBS_LITERAL, "module_load_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
@@ -389,7 +450,7 @@ int main(int argc, char **argv) {
|
||||
{"tests\\win32_mutex_smoke", WIN32_EXE_LIBS_LITERAL, "win32_mutex_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\win32_thread_suspend_smoke", WIN32_EXE_LIBS_LITERAL, "win32_thread_suspend_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\win32_module_lookup_smoke", WIN32_EXE_LIBS_LITERAL, "win32_module_lookup_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\cwd_peb_smoke", NATIVE_EXE_LIBS_LITERAL, "cwd_peb_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\cwd_userspace_smoke", NATIVE_EXE_LIBS_LITERAL, "cwd_userspace_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\mmap_smoke", NATIVE_EXE_LIBS_LITERAL, "mmap_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\pcache_smoke", NATIVE_EXE_LIBS_LITERAL, "pcache_smoke", NATIVE_EXE_ENTRY_LITERAL},
|
||||
{"tests\\pcache_pressure", NATIVE_EXE_LIBS_LITERAL, "pcache_pressure", NATIVE_EXE_ENTRY_LITERAL},
|
||||
@@ -413,8 +474,8 @@ int main(int argc, char **argv) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(apps); i++) {
|
||||
const char *cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Foobj\\%s\\ code\\user\\%s\\*.c && link %s /SUBSYSTEM:NATIVE %s /OUT:bin\\%s.exe /PDB:bin\\%s.pdb %s obj\\%s\\*.obj",
|
||||
const char* cmd = nob_temp_sprintf(
|
||||
"cl %s /MP /c /Foobj\\%s\\ code\\user\\%s\\*.c && link %s /SUBSYSTEM:NATIVE " USER_IMAGE_FLAGS_LITERAL " %s /OUT:bin\\%s.exe /PDB:bin\\%s.pdb %s obj\\%s\\*.obj",
|
||||
UserCflags, apps[i][2], apps[i][0], LFLAGS, apps[i][3], apps[i][2], apps[i][2], apps[i][1], apps[i][2]
|
||||
);
|
||||
nob_da_append(&procs, run_async(cmd));
|
||||
@@ -431,106 +492,129 @@ int main(int argc, char **argv) {
|
||||
run_sync("mformat -i " VHD_PART1 " -F");
|
||||
run_sync("mformat -i " VHD_PART2 " -F");
|
||||
|
||||
mmd_dir(VHD_PART1, "apps");
|
||||
mmd_dir(VHD_PART1, "system");
|
||||
mmd_dir(VHD_PART1, "drivers");
|
||||
mmd_dir(VHD_PART1, "EFI");
|
||||
mmd_dir(VHD_PART1, "EFI/BOOT");
|
||||
mmd_dir(VHD_PART1, "EFI/NTLite");
|
||||
mmd_dir(VHD_PART1, "EFI/NTLite/fs");
|
||||
mmd_dir(VHD_PART2, "apps");
|
||||
mmd_dir(VHD_PART2, "system");
|
||||
mmd_dir(VHD_PART2, "drivers");
|
||||
mmd_dir(VHD_PART2, "tests");
|
||||
|
||||
const char *copies[][3] = {
|
||||
{"bin\\bootx64.efi", VHD_PART1, "EFI/BOOT/bootx64.efi"},
|
||||
{"bin\\kernel.exe", VHD_PART1, "system/colonel.exe"},
|
||||
{"bin\\hal.dll", VHD_PART1, "system/hal.dll"},
|
||||
{"bin\\syscall.dll", VHD_PART1, "system/syscall.dll"},
|
||||
{"bin\\win32.dll", VHD_PART1, "system/win32.dll"},
|
||||
{"bin\\posix.dll", VHD_PART1, "system/posix.dll"},
|
||||
{"code\\settings.ini", VHD_PART1, "system/settings.ini"},
|
||||
{"bin\\init.exe", VHD_PART1, "system/init.exe"},
|
||||
|
||||
{"bin\\pci.sys", VHD_PART1, "drivers/pci.sys"},
|
||||
{"bin\\ps2.sys", VHD_PART1, "drivers/ps2.sys"},
|
||||
{"bin\\serial.sys", VHD_PART1, "drivers/serial.sys"},
|
||||
{"bin\\hda.sys", VHD_PART1, "drivers/hda.sys"},
|
||||
{"bin\\ata.sys", VHD_PART1, "drivers/ata.sys"},
|
||||
{"bin\\ahci.sys", VHD_PART1, "drivers/ahci.sys"},
|
||||
{"bin\\fat.sys", VHD_PART1, "drivers/fat.sys"},
|
||||
{"bin\\ntfs.sys", VHD_PART1, "drivers/ntfs.sys"},
|
||||
{"bin\\vmwaresvga.sys", VHD_PART1, "drivers/vmwaresvga.sys"},
|
||||
{"bin\\lwip.sys", VHD_PART1, "drivers/lwip.sys"},
|
||||
{"bin\\usb.sys", VHD_PART1, "drivers/usb.sys"},
|
||||
{"bin\\rtl816x.sys", VHD_PART1, "drivers/rtl816x.sys"},
|
||||
{"bin\\rtl8139.sys", VHD_PART1, "drivers/rtl8139.sys"},
|
||||
{"code\\drivers\\drivers.ini", VHD_PART1, "drivers/drivers.ini"},
|
||||
{"code\\boot.ini", VHD_PART1, "boot.ini"},
|
||||
// The ESP is only the boot anchor; the configured system volume carries the OS payload.
|
||||
if (!mcopy_file("bin\\bootx64.efi", VHD_PART1, "EFI/BOOT/bootx64.efi")) return 1;
|
||||
if (!mcopy_file("code\\boot.ini", VHD_PART1, "boot.ini")) return 1;
|
||||
if (!run_sync("if exist code\\boot\\uefi\\fs\\*.efi mcopy -o -i " VHD_PART1 " code\\boot\\uefi\\fs\\*.efi ::EFI/NTLite/fs/")) return 1;
|
||||
|
||||
{"bin\\shell_win32.exe", VHD_PART1, "apps/shell_win32.exe"},
|
||||
{"bin\\shell_posix.exe", VHD_PART1, "apps/shell_posix.exe"},
|
||||
{"bin\\shell_native.exe", VHD_PART1, "apps/shell_native.exe"},
|
||||
{"bin\\edit.exe", VHD_PART1, "apps/edit.exe"},
|
||||
{"bin\\httpget.exe", VHD_PART1, "apps/httpget.exe"},
|
||||
{"bin\\tcpserve.exe", VHD_PART1, "apps/tcpserve.exe"},
|
||||
{"bin\\udp.exe", VHD_PART1, "apps/udp.exe"},
|
||||
{"bin\\resolve.exe", VHD_PART1, "apps/resolve.exe"},
|
||||
{"bin\\ping.exe", VHD_PART1, "apps/ping.exe"},
|
||||
{"bin\\doom.exe", VHD_PART1, "apps/doom.exe"},
|
||||
{"bin\\video.exe", VHD_PART1, "apps/video.exe"},
|
||||
{"bin\\memtop.exe", VHD_PART1, "apps/memtop.exe"},
|
||||
if (!mcopy_file("bin\\kernel.exe", VHD_PART2, "system/colonel.exe")) return 1;
|
||||
|
||||
// Partition 2 Apps
|
||||
{"bin\\all_tests.exe", VHD_PART2, "tests/all_tests.exe"},
|
||||
{"bin\\async_apc.exe", VHD_PART2, "tests/async_apc.exe"},
|
||||
{"bin\\async_cancel.exe", VHD_PART2, "tests/async_cancel.exe"},
|
||||
{"bin\\apc_return_smoke.exe", VHD_PART2, "tests/apc_return_smoke.exe"},
|
||||
{"bin\\file_stat_smoke.exe", VHD_PART2, "tests/file_stat_smoke.exe"},
|
||||
{"bin\\handle_dup_smoke.exe", VHD_PART2, "tests/handle_dup_smoke.exe"},
|
||||
{"bin\\named_queue_lifetime_smoke.exe", VHD_PART2, "tests/named_queue_lifetime_smoke.exe"},
|
||||
{"bin\\input_api_smoke.exe", VHD_PART2, "tests/input_api_smoke.exe"},
|
||||
{"bin\\input_model_smoke.exe", VHD_PART2, "tests/input_model_smoke.exe"},
|
||||
{"bin\\timer_smoke.exe", VHD_PART2, "tests/timer_smoke.exe"},
|
||||
{"bin\\stats_abi_smoke.exe", VHD_PART2, "tests/stats_abi_smoke.exe"},
|
||||
{"bin\\realpath_smoke.exe", VHD_PART2, "tests/realpath_smoke.exe"},
|
||||
{"bin\\file_lock_smoke.exe", VHD_PART2, "tests/file_lock_smoke.exe"},
|
||||
{"bin\\process_protection_smoke.exe", VHD_PART2, "tests/process_protection_smoke.exe"},
|
||||
{"bin\\socket_addr_smoke.exe", VHD_PART2, "tests/socket_addr_smoke.exe"},
|
||||
{"bin\\net_irp_smoke.exe", VHD_PART2, "tests/net_irp_smoke.exe"},
|
||||
{"bin\\module_load_smoke.exe", VHD_PART2, "tests/module_load_smoke.exe"},
|
||||
{"bin\\posix_module_smoke.exe", VHD_PART2, "tests/posix_module_smoke.exe"},
|
||||
{"bin\\exception_dispatcher_smoke.exe", VHD_PART2, "tests/exception_dispatcher_smoke.exe"},
|
||||
{"bin\\native_exception_runtime_smoke.exe", VHD_PART2, "tests/native_exception_runtime_smoke.exe"},
|
||||
{"bin\\native_raise_exception_smoke.exe", VHD_PART2, "tests/native_raise_exception_smoke.exe"},
|
||||
{"bin\\exception_smoke.exe", VHD_PART2, "tests/exception_smoke.exe"},
|
||||
{"bin\\win32_exception_smoke.exe", VHD_PART2, "tests/win32_exception_smoke.exe"},
|
||||
{"bin\\win32_seh_smoke.exe", VHD_PART2, "tests/win32_seh_smoke.exe"},
|
||||
{"bin\\syscall_contract_smoke.exe", VHD_PART2, "tests/syscall_contract_smoke.exe"},
|
||||
{"bin\\would_block_smoke.exe", VHD_PART2, "tests/would_block_smoke.exe"},
|
||||
{"bin\\audio_stream_smoke.exe", VHD_PART2, "tests/audio_stream_smoke.exe"},
|
||||
{"bin\\winmm_waveout_smoke.exe", VHD_PART2, "tests/winmm_waveout_smoke.exe"},
|
||||
{"bin\\win32_condition_variable_smoke.exe", VHD_PART2, "tests/win32_condition_variable_smoke.exe"},
|
||||
{"bin\\win32_mutex_smoke.exe", VHD_PART2, "tests/win32_mutex_smoke.exe"},
|
||||
{"bin\\win32_thread_suspend_smoke.exe", VHD_PART2, "tests/win32_thread_suspend_smoke.exe"},
|
||||
{"bin\\win32_module_lookup_smoke.exe", VHD_PART2, "tests/win32_module_lookup_smoke.exe"},
|
||||
{"bin\\cwd_peb_smoke.exe", VHD_PART2, "tests/cwd_peb_smoke.exe"},
|
||||
{"bin\\mmap_smoke.exe", VHD_PART2, "tests/mmap_smoke.exe"},
|
||||
{"bin\\pcache_smoke.exe", VHD_PART2, "tests/pcache_smoke.exe"},
|
||||
{"bin\\pcache_pressure.exe", VHD_PART2, "tests/pcache_pressure.exe"},
|
||||
{"bin\\dirty_writeback.exe", VHD_PART2, "tests/dirty_writeback.exe"},
|
||||
{"bin\\shared_mmap.exe", VHD_PART2, "tests/shared_mmap.exe"},
|
||||
{"bin\\pcache_invalidate.exe", VHD_PART2, "tests/pcache_invalidate.exe"},
|
||||
{"bin\\pcache_mmap_read_reuse.exe", VHD_PART2, "tests/pcache_mmap_read_reuse.exe"},
|
||||
{"bin\\pcache_multithread.exe", VHD_PART2, "tests/pcache_multithread.exe"},
|
||||
{"bin\\surface_smoke.exe", VHD_PART2, "tests/surface_smoke.exe"},
|
||||
{"bin\\surface_invalid_rect.exe", VHD_PART2, "tests/surface_invalid_rect.exe"},
|
||||
{"bin\\surface_multithread_present.exe", VHD_PART2, "tests/surface_multithread_present.exe"}
|
||||
const char* system_files[] = {
|
||||
"bin\\hal.dll",
|
||||
"bin\\syscall.dll",
|
||||
"bin\\win32.dll",
|
||||
"bin\\posix.dll",
|
||||
"code\\settings.ini",
|
||||
"bin\\init.exe",
|
||||
"bin\\rssrv.exe",
|
||||
};
|
||||
if (!mcopy_files_to_dir(VHD_PART2, "system/", system_files, NOB_ARRAY_LEN(system_files))) return 1;
|
||||
|
||||
for (size_t i = 0; i < NOB_ARRAY_LEN(copies); i++) {
|
||||
mcopy_file(copies[i][0], copies[i][1], copies[i][2]);
|
||||
}
|
||||
const char* driver_files[] = {
|
||||
"bin\\pci.sys",
|
||||
"bin\\ps2.sys",
|
||||
"bin\\serial.sys",
|
||||
"bin\\hda.sys",
|
||||
"bin\\ata.sys",
|
||||
"bin\\ahci.sys",
|
||||
"bin\\fat.sys",
|
||||
"bin\\ntfs.sys",
|
||||
"bin\\vmwaresvga.sys",
|
||||
"bin\\lwip.sys",
|
||||
"bin\\usb.sys",
|
||||
"bin\\rtl816x.sys",
|
||||
"bin\\rtl8139.sys",
|
||||
"code\\drivers\\drivers.ini",
|
||||
};
|
||||
if (!mcopy_files_to_dir(VHD_PART2, "drivers/", driver_files, NOB_ARRAY_LEN(driver_files))) return 1;
|
||||
|
||||
if (nob_file_exists("code\\user\\apps\\video\\bink2w64.dll")) mcopy_file("code\\user\\apps\\video\\bink2w64.dll", VHD_PART1, "apps/bink2w64.dll");
|
||||
if (nob_file_exists("code\\user\\apps\\video\\video.bk2")) mcopy_file("code\\user\\apps\\video\\video.bk2", VHD_PART1, "apps/video.bk2");
|
||||
if (nob_file_exists("code\\user\\apps\\doom\\doom1.wad")) mcopy_file("code\\user\\apps\\doom\\doom1.wad", VHD_PART1, "apps/doom1.wad");
|
||||
const char* app_files[] = {
|
||||
"bin\\shell_win32.exe",
|
||||
"bin\\shell_posix.exe",
|
||||
"bin\\shell_native.exe",
|
||||
"bin\\edit.exe",
|
||||
"bin\\httpget.exe",
|
||||
"bin\\tcpserve.exe",
|
||||
"bin\\udp.exe",
|
||||
"bin\\resolve.exe",
|
||||
"bin\\ping.exe",
|
||||
"bin\\doom.exe",
|
||||
"bin\\video.exe",
|
||||
"bin\\memtop.exe",
|
||||
};
|
||||
if (!mcopy_files_to_dir(VHD_PART2, "apps/", app_files, NOB_ARRAY_LEN(app_files))) return 1;
|
||||
|
||||
const char* test_files[] = {
|
||||
"bin\\all_tests.exe",
|
||||
"bin\\async_apc.exe",
|
||||
"bin\\async_cancel.exe",
|
||||
"bin\\apc_return_smoke.exe",
|
||||
"bin\\file_stat_smoke.exe",
|
||||
"bin\\handle_dup_smoke.exe",
|
||||
"bin\\security_smoke.exe",
|
||||
"bin\\port_ipc_smoke.exe",
|
||||
"bin\\resource_service_smoke.exe",
|
||||
"bin\\named_queue_lifetime_smoke.exe",
|
||||
"bin\\input_api_smoke.exe",
|
||||
"bin\\input_model_smoke.exe",
|
||||
"bin\\timer_smoke.exe",
|
||||
"bin\\stats_abi_smoke.exe",
|
||||
"bin\\realpath_smoke.exe",
|
||||
"bin\\file_lock_smoke.exe",
|
||||
"bin\\process_protection_smoke.exe",
|
||||
"bin\\process_exit_multithread_smoke.exe",
|
||||
"bin\\process_builder_smoke.exe",
|
||||
"bin\\socket_addr_smoke.exe",
|
||||
"bin\\net_irp_smoke.exe",
|
||||
"bin\\module_load_smoke.exe",
|
||||
"bin\\posix_module_smoke.exe",
|
||||
"bin\\exception_dispatcher_smoke.exe",
|
||||
"bin\\native_exception_runtime_smoke.exe",
|
||||
"bin\\native_raise_exception_smoke.exe",
|
||||
"bin\\exception_smoke.exe",
|
||||
"bin\\win32_exception_smoke.exe",
|
||||
"bin\\win32_seh_smoke.exe",
|
||||
"bin\\syscall_contract_smoke.exe",
|
||||
"bin\\would_block_smoke.exe",
|
||||
"bin\\audio_stream_smoke.exe",
|
||||
"bin\\winmm_waveout_smoke.exe",
|
||||
"bin\\win32_condition_variable_smoke.exe",
|
||||
"bin\\win32_mutex_smoke.exe",
|
||||
"bin\\win32_thread_suspend_smoke.exe",
|
||||
"bin\\win32_module_lookup_smoke.exe",
|
||||
"bin\\cwd_userspace_smoke.exe",
|
||||
"bin\\mmap_smoke.exe",
|
||||
"bin\\pcache_smoke.exe",
|
||||
"bin\\pcache_pressure.exe",
|
||||
"bin\\dirty_writeback.exe",
|
||||
"bin\\shared_mmap.exe",
|
||||
"bin\\pcache_invalidate.exe",
|
||||
"bin\\pcache_mmap_read_reuse.exe",
|
||||
"bin\\pcache_multithread.exe",
|
||||
"bin\\surface_smoke.exe",
|
||||
"bin\\surface_invalid_rect.exe",
|
||||
"bin\\surface_multithread_present.exe",
|
||||
};
|
||||
if (!mcopy_files_to_dir(VHD_PART2, "tests/", test_files, NOB_ARRAY_LEN(test_files))) return 1;
|
||||
|
||||
const char* optional_app_files[3];
|
||||
size_t optional_app_count = 0;
|
||||
if (nob_file_exists("code\\user\\apps\\video\\bink2w64.dll"))
|
||||
optional_app_files[optional_app_count++] = "code\\user\\apps\\video\\bink2w64.dll";
|
||||
if (nob_file_exists("code\\user\\apps\\video\\video.bk2"))
|
||||
optional_app_files[optional_app_count++] = "code\\user\\apps\\video\\video.bk2";
|
||||
if (nob_file_exists("code\\user\\apps\\doom\\doom1.wad"))
|
||||
optional_app_files[optional_app_count++] = "code\\user\\apps\\doom\\doom1.wad";
|
||||
if (!mcopy_files_to_dir(VHD_PART2, "apps/", optional_app_files, optional_app_count)) return 1;
|
||||
|
||||
nob_log(NOB_INFO, "Build complete!");
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user