Start fixing NBOOT FAT Driver (it seems to be unable to read inside directories for some reason?) i may end up hard-coding it to only be able to read from /boot
This commit is contained in:
parent
df69f7479c
commit
1df9c19f58
5
Makefile
5
Makefile
@ -21,9 +21,10 @@ $(BUILD_DIR)/main_floppy.img: bootloader kernel
|
||||
dd if=$(BUILD_DIR)/stage1.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/stage2.bin "::stage2.bin"
|
||||
mmd -i $(BUILD_DIR)/main_floppy.img "::boot"
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin" # move to boot dir
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
|
||||
mmd -i $(BUILD_DIR)/main_floppy.img "::misc"
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img test.txt "::test.txt" # move to misc dir
|
||||
mcopy -v -i $(BUILD_DIR)/main_floppy.img kernelparams "::misc"
|
||||
mcopy -i $(BUILD_DIR)/main_floppy.img test "::misc"
|
||||
|
||||
#
|
||||
# Bootloader
|
||||
|
||||
@ -0,0 +1 @@
|
||||
verbose
|
||||
@ -325,13 +325,14 @@ FAT_File* FAT_Open(DISK* disk, const char* path)
|
||||
// ignore leading slash
|
||||
if (path[0] == '/')
|
||||
path++;
|
||||
|
||||
printf("Path: %s\r\n", path);
|
||||
FAT_File* current = &g_Data->RootDirectory.Public;
|
||||
|
||||
while (*path) {
|
||||
// extract next file name from path
|
||||
bool isLast = false;
|
||||
const char* delim = strchr(path, '/');
|
||||
printf("DELIM: %s\r\n", delim);
|
||||
if (delim != NULL)
|
||||
{
|
||||
memcpy(name, path, delim - path);
|
||||
@ -349,10 +350,17 @@ FAT_File* FAT_Open(DISK* disk, const char* path)
|
||||
|
||||
// find directory entry in current directory
|
||||
FAT_DirectoryEntry entry;
|
||||
if (FAT_FindFile(disk, current, name, &entry))
|
||||
if (!FAT_FindFile(disk, current, name, &entry))
|
||||
{
|
||||
FAT_Close(current);
|
||||
|
||||
printf("FAT: %s not found\r\n", name);
|
||||
return NULL;
|
||||
} else
|
||||
{
|
||||
FAT_Close(current);
|
||||
printf("We make it here.\r\n");
|
||||
|
||||
// check if directory
|
||||
if (!isLast && entry.Attributes & FAT_ATTRIBUTE_DIRECTORY == 0)
|
||||
{
|
||||
@ -363,13 +371,6 @@ FAT_File* FAT_Open(DISK* disk, const char* path)
|
||||
// open new directory entry
|
||||
current = FAT_OpenEntry(disk, &entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAT_Close(current);
|
||||
|
||||
printf("FAT: %s not found\r\n", name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
|
||||
@ -67,31 +67,44 @@ void* g_data = (void*)0x20000;
|
||||
printf("Failed!\nDisk Initialization Error!\n");
|
||||
goto end;
|
||||
}
|
||||
printf("Done!\n");
|
||||
// printf("Done!\n");
|
||||
|
||||
// test fat driver
|
||||
printf("Testing FAT Driver...");
|
||||
// read test.txt
|
||||
FAT_File* ft = FAT_Open(&disk, "/");
|
||||
char buffer[100];
|
||||
uint32_t testread;
|
||||
ft = FAT_Open(&disk, "test.txt"); // move test.txt in MISC folder later (TM)
|
||||
while ((testread = FAT_Read(&disk, ft, sizeof(buffer), buffer)))
|
||||
{
|
||||
for (uint32_t i = 0; i < testread; i++)
|
||||
{
|
||||
if (buffer[i] == '\n')
|
||||
putc('\r');
|
||||
putc(buffer[i]);
|
||||
}
|
||||
}
|
||||
FAT_Close(ft);
|
||||
// // test fat driver
|
||||
// printf("Testing FAT Driver...");
|
||||
// // read test.txt
|
||||
// FAT_File* ft = FAT_Open(&disk, "/misc");
|
||||
// char buffer[100];
|
||||
// uint32_t testread;
|
||||
// ft = FAT_Open(&disk, "test"); // move test.txt in MISC folder later (TM)
|
||||
// while ((testread = FAT_Read(&disk, ft, sizeof(buffer), buffer)))
|
||||
// {
|
||||
// for (uint32_t i = 0; i < testread; i++)
|
||||
// {
|
||||
// if (buffer[i] == '\n')
|
||||
// putc('\r');
|
||||
// putc(buffer[i]);
|
||||
// }
|
||||
// }
|
||||
// FAT_Close(ft);
|
||||
|
||||
printf("Detecting Memory...\n");
|
||||
printf("Detecting Memory...");
|
||||
// prep boot params
|
||||
g_BootParams.BootDevice = bootDrive;
|
||||
Memory_Detect(&g_BootParams.Memory);
|
||||
|
||||
printf("Done!\n");
|
||||
// // kernel params...
|
||||
// FAT_File* kp = FAT_Open(&disk, "/misc");
|
||||
// uint32_t kernelparams;
|
||||
// while ((kernelparams = FAT_Read(&disk, kp, sizeof(buffer), buffer)))
|
||||
// {
|
||||
// for (uint32_t i = 0; i < kernelparams; i++)
|
||||
// {
|
||||
// if (buffer[i] == '\n')
|
||||
// putc('\r');
|
||||
// putc(buffer[i]);
|
||||
// }
|
||||
// }
|
||||
// FAT_Close(kp);
|
||||
|
||||
// load kernel from disk
|
||||
printf("Loading Kernel...");
|
||||
|
||||
@ -6,8 +6,10 @@
|
||||
#pragma once
|
||||
|
||||
void Print_Key(int scancode);
|
||||
|
||||
typedef enum { // ill do it LATER!
|
||||
// Scancodes for a QWERTY layout;
|
||||
// Will add support for alt layouts like for example DVORAK (my layout of choice)
|
||||
// Kinda need to tbh, cuz even with QEMU i can't type lolololol
|
||||
typedef enum {
|
||||
KEYSCAN_ESC = 1 ,
|
||||
KEYSCAN_1 = 2 ,
|
||||
KEYSCAN_2 = 3 ,
|
||||
|
||||
6
src/kernel/dri/serial.c
Normal file
6
src/kernel/dri/serial.c
Normal file
@ -0,0 +1,6 @@
|
||||
/*----------------*\
|
||||
|Nanite OS |
|
||||
|Copyright (C) 2025|
|
||||
|Tyler McGurrin |
|
||||
\*----------------*/
|
||||
#include "serial.h"
|
||||
6
src/kernel/dri/serial.h
Normal file
6
src/kernel/dri/serial.h
Normal file
@ -0,0 +1,6 @@
|
||||
/*----------------*\
|
||||
|Nanite OS |
|
||||
|Copyright (C) 2025|
|
||||
|Tyler McGurrin |
|
||||
\*----------------*/
|
||||
#pragma once
|
||||
@ -22,5 +22,6 @@ typedef struct
|
||||
|
||||
typedef struct {
|
||||
MemoryInfo Memory;
|
||||
char KernelParams;
|
||||
uint8_t BootDevice;
|
||||
} BootParams;
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
#pragma once
|
||||
|
||||
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
|
||||
#define VERSION "RD-00015"
|
||||
#define VERSION "RD-00017"
|
||||
#define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user