mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Driver directory can be modified by config
This commit is contained in:
parent
89c173bb31
commit
971f64b958
@ -282,7 +282,7 @@ namespace Driver
|
|||||||
|
|
||||||
Driver::Driver()
|
Driver::Driver()
|
||||||
{
|
{
|
||||||
FileSystem::FILE *DriverDirectory = vfs->Open("/system/drivers");
|
FileSystem::FILE *DriverDirectory = vfs->Open(Config.DriverDirectory);
|
||||||
if (DriverDirectory->Status == FileSystem::FileStatus::OK)
|
if (DriverDirectory->Status == FileSystem::FileStatus::OK)
|
||||||
foreach (auto driver in DriverDirectory->Node->Children)
|
foreach (auto driver in DriverDirectory->Node->Children)
|
||||||
if (driver->Flags == FileSystem::NodeFlags::FS_FILE)
|
if (driver->Flags == FileSystem::NodeFlags::FS_FILE)
|
||||||
|
29
KConfig.cpp
29
KConfig.cpp
@ -37,6 +37,12 @@ static struct cag_option ConfigOptions[] = {
|
|||||||
.value_name = "MODE",
|
.value_name = "MODE",
|
||||||
.description = "Tasking mode (multi, single)"},
|
.description = "Tasking mode (multi, single)"},
|
||||||
|
|
||||||
|
{.identifier = 'd',
|
||||||
|
.access_letters = "dD",
|
||||||
|
.access_name = "drvdir",
|
||||||
|
.value_name = "VALUE",
|
||||||
|
.description = "Directory to load drivers from"},
|
||||||
|
|
||||||
{.identifier = 'h',
|
{.identifier = 'h',
|
||||||
.access_letters = "h",
|
.access_letters = "h",
|
||||||
.access_name = "help",
|
.access_name = "help",
|
||||||
@ -48,7 +54,10 @@ KernelConfig ParseConfig(char *Config)
|
|||||||
int argc = 0;
|
int argc = 0;
|
||||||
char **argv = nullptr;
|
char **argv = nullptr;
|
||||||
|
|
||||||
struct KernelConfig config = {Memory::MemoryAllocatorType::Pages, 0, 0};
|
struct KernelConfig config = {Memory::MemoryAllocatorType::Pages,
|
||||||
|
0,
|
||||||
|
{'/', 's', 'y', 's', 't', 'e', 'm', '/', 'd', 'r', 'i', 'v', 'e', 'r', 's', '\0'},
|
||||||
|
0};
|
||||||
|
|
||||||
if (Config == NULL)
|
if (Config == NULL)
|
||||||
{
|
{
|
||||||
@ -56,7 +65,10 @@ KernelConfig ParseConfig(char *Config)
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
KPrint("Kernel parameters: %s", Config);
|
||||||
goto Parse;
|
goto Parse;
|
||||||
|
}
|
||||||
|
|
||||||
Parse:
|
Parse:
|
||||||
{
|
{
|
||||||
@ -119,7 +131,7 @@ Parse:
|
|||||||
{
|
{
|
||||||
case '\0':
|
case '\0':
|
||||||
{
|
{
|
||||||
KPrint("\eFF2200Unterminated string constant in kernel parameters.");
|
KPrint("\eFF2200Unterminated string constant in kernel parameters. (0)");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -132,7 +144,7 @@ Parse:
|
|||||||
{
|
{
|
||||||
case '\0':
|
case '\0':
|
||||||
{
|
{
|
||||||
KPrint("\eFF2200Unterminated string constant in kernel parameters.");
|
KPrint("\eFF2200Unterminated string constant in kernel parameters. (1)");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -162,7 +174,7 @@ Parse:
|
|||||||
{
|
{
|
||||||
case '\0':
|
case '\0':
|
||||||
{
|
{
|
||||||
KPrint("\eFF2200Unterminated string constant in kernel parameters.");
|
KPrint("\eFF2200Unterminated string constant in kernel parameters. (2)");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -197,7 +209,7 @@ Parse:
|
|||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
{
|
{
|
||||||
KPrint("\eFF2200Unterminated string constant in kernel parameters.");
|
KPrint("\eFF2200Unterminated string constant in kernel parameters. (3)");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,6 +314,13 @@ ParseSuccess:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'd':
|
||||||
|
{
|
||||||
|
value = cag_option_get_value(&context);
|
||||||
|
strcpy(config.DriverDirectory, value);
|
||||||
|
KPrint("\eAAFFAAUsing %s as driver directory", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'h':
|
case 'h':
|
||||||
{
|
{
|
||||||
KPrint("\n---------------------------------------------------------------------------\nUsage: kernel.fsys [OPTION]...\nKernel configuration.");
|
KPrint("\n---------------------------------------------------------------------------\nUsage: kernel.fsys [OPTION]...\nKernel configuration.");
|
||||||
|
@ -8,6 +8,7 @@ struct KernelConfig
|
|||||||
{
|
{
|
||||||
Memory::MemoryAllocatorType AllocatorType;
|
Memory::MemoryAllocatorType AllocatorType;
|
||||||
bool SchedulerType;
|
bool SchedulerType;
|
||||||
|
char DriverDirectory[256];
|
||||||
int Cores;
|
int Cores;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user