mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Update filesystem structure
This commit is contained in:
parent
81c40be73a
commit
e8162bc3cb
@ -24,7 +24,7 @@
|
|||||||
#include <cwalk.h>
|
#include <cwalk.h>
|
||||||
#include <md5.h>
|
#include <md5.h>
|
||||||
|
|
||||||
#include "../../Drivers/drv.hpp"
|
#include "../../Modules/drv.hpp"
|
||||||
#include "../../kernel.h"
|
#include "../../kernel.h"
|
||||||
#include "../../DAPI.hpp"
|
#include "../../DAPI.hpp"
|
||||||
#include "../../Fex.hpp"
|
#include "../../Fex.hpp"
|
||||||
|
41
Kernel.cpp
41
Kernel.cpp
@ -205,7 +205,6 @@ PCI::PCI *PCIManager = nullptr;
|
|||||||
Tasking::Task *TaskManager = nullptr;
|
Tasking::Task *TaskManager = nullptr;
|
||||||
Time::time *TimeManager = nullptr;
|
Time::time *TimeManager = nullptr;
|
||||||
VirtualFileSystem::Virtual *vfs = nullptr;
|
VirtualFileSystem::Virtual *vfs = nullptr;
|
||||||
VirtualFileSystem::Virtual *bootanim_vfs = nullptr;
|
|
||||||
|
|
||||||
KernelConfig Config = {
|
KernelConfig Config = {
|
||||||
.AllocatorType = Memory::MemoryAllocatorType::XallocV1,
|
.AllocatorType = Memory::MemoryAllocatorType::XallocV1,
|
||||||
@ -403,9 +402,6 @@ EXTERNC NIF void Main()
|
|||||||
KPrint("Initializing Filesystem...");
|
KPrint("Initializing Filesystem...");
|
||||||
vfs = new VirtualFileSystem::Virtual;
|
vfs = new VirtualFileSystem::Virtual;
|
||||||
|
|
||||||
if (Config.BootAnimation)
|
|
||||||
bootanim_vfs = new VirtualFileSystem::Virtual;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < MAX_MODULES; i++)
|
for (size_t i = 0; i < MAX_MODULES; i++)
|
||||||
{
|
{
|
||||||
if (!bInfo.Modules[i].Address)
|
if (!bInfo.Modules[i].Address)
|
||||||
@ -418,13 +414,6 @@ EXTERNC NIF void Main()
|
|||||||
if (!initrd++)
|
if (!initrd++)
|
||||||
new VirtualFileSystem::USTAR((uintptr_t)bInfo.Modules[i].Address, vfs);
|
new VirtualFileSystem::USTAR((uintptr_t)bInfo.Modules[i].Address, vfs);
|
||||||
}
|
}
|
||||||
if (strcmp(bInfo.Modules[i].CommandLine, "bootanim") == 0 && Config.BootAnimation)
|
|
||||||
{
|
|
||||||
debug("Found bootanim at %p", bInfo.Modules[i].Address);
|
|
||||||
static char bootanim = 0;
|
|
||||||
if (!bootanim++)
|
|
||||||
new VirtualFileSystem::USTAR((uintptr_t)bInfo.Modules[i].Address, bootanim_vfs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vfs->GetRootNode()->Children.size() == 0)
|
if (vfs->GetRootNode()->Children.size() == 0)
|
||||||
@ -436,45 +425,42 @@ EXTERNC NIF void Main()
|
|||||||
vfs->CreateRoot("/", &null_op);
|
vfs->CreateRoot("/", &null_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vfs->PathExists("/system"))
|
if (!vfs->PathExists("/dev"))
|
||||||
vfs->Create("/system", NodeFlags::DIRECTORY);
|
DevFS = vfs->Create("/dev", NodeFlags::DIRECTORY);
|
||||||
|
|
||||||
if (!vfs->PathExists("/system/dev"))
|
|
||||||
DevFS = vfs->Create("/system/dev", NodeFlags::DIRECTORY);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File dev = vfs->Open("/system/dev");
|
File dev = vfs->Open("/dev");
|
||||||
if (dev.node->Flags != NodeFlags::DIRECTORY)
|
if (dev.node->Flags != NodeFlags::DIRECTORY)
|
||||||
{
|
{
|
||||||
KPrint("\eE85230/system/dev is not a directory! Halting...");
|
KPrint("\eE85230/dev is not a directory! Halting...");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
}
|
}
|
||||||
vfs->Close(dev);
|
vfs->Close(dev);
|
||||||
DevFS = dev.node;
|
DevFS = dev.node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vfs->PathExists("/system/mnt"))
|
if (!vfs->PathExists("/mnt"))
|
||||||
MntFS = vfs->Create("/system/mnt", NodeFlags::DIRECTORY);
|
MntFS = vfs->Create("/mnt", NodeFlags::DIRECTORY);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File mnt = vfs->Open("/system/mnt");
|
File mnt = vfs->Open("/mnt");
|
||||||
if (mnt.node->Flags != NodeFlags::DIRECTORY)
|
if (mnt.node->Flags != NodeFlags::DIRECTORY)
|
||||||
{
|
{
|
||||||
KPrint("\eE85230/system/mnt is not a directory! Halting...");
|
KPrint("\eE85230/mnt is not a directory! Halting...");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
}
|
}
|
||||||
vfs->Close(mnt);
|
vfs->Close(mnt);
|
||||||
MntFS = mnt.node;
|
MntFS = mnt.node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vfs->PathExists("/system/proc"))
|
if (!vfs->PathExists("/proc"))
|
||||||
ProcFS = vfs->Create("/system/proc", NodeFlags::DIRECTORY);
|
ProcFS = vfs->Create("/proc", NodeFlags::DIRECTORY);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File proc = vfs->Open("/system/proc", nullptr);
|
File proc = vfs->Open("/proc", nullptr);
|
||||||
if (proc.node->Flags != NodeFlags::DIRECTORY)
|
if (proc.node->Flags != NodeFlags::DIRECTORY)
|
||||||
{
|
{
|
||||||
KPrint("\eE85230/system/proc is not a directory! Halting...");
|
KPrint("\eE85230/proc is not a directory! Halting...");
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
}
|
}
|
||||||
vfs->Close(proc);
|
vfs->Close(proc);
|
||||||
@ -571,9 +557,6 @@ EXTERNC __no_stack_protector void BeforeShutdown(bool Reboot)
|
|||||||
if (vfs)
|
if (vfs)
|
||||||
delete vfs, vfs = nullptr;
|
delete vfs, vfs = nullptr;
|
||||||
|
|
||||||
if (bootanim_vfs)
|
|
||||||
delete bootanim_vfs, bootanim_vfs = nullptr;
|
|
||||||
|
|
||||||
if (TimeManager)
|
if (TimeManager)
|
||||||
delete TimeManager, TimeManager = nullptr;
|
delete TimeManager, TimeManager = nullptr;
|
||||||
|
|
||||||
|
@ -258,9 +258,9 @@ void TestSyscallsKernel()
|
|||||||
Execute::SpawnData SpawnInit()
|
Execute::SpawnData SpawnInit()
|
||||||
{
|
{
|
||||||
const char *envp[5] = {
|
const char *envp[5] = {
|
||||||
"PATH=/system:/system/bin",
|
"PATH=/bin:/usr/bin",
|
||||||
"TERM=tty",
|
"TERM=tty",
|
||||||
"HOME=/",
|
"HOME=/root",
|
||||||
"USER=root",
|
"USER=root",
|
||||||
nullptr};
|
nullptr};
|
||||||
|
|
||||||
@ -283,11 +283,11 @@ void BootLogoAnimationThread()
|
|||||||
char BootAnimPath[16];
|
char BootAnimPath[16];
|
||||||
while (FrameCount < 27)
|
while (FrameCount < 27)
|
||||||
{
|
{
|
||||||
sprintf(BootAnimPath, "%ld.tga", FrameCount);
|
sprintf(BootAnimPath, "/etc/boot/%ld.tga", FrameCount);
|
||||||
File ba = bootanim_vfs->Open(BootAnimPath);
|
File ba = vfs->Open(BootAnimPath);
|
||||||
if (!ba.IsOK())
|
if (!ba.IsOK())
|
||||||
{
|
{
|
||||||
bootanim_vfs->Close(ba);
|
vfs->Close(ba);
|
||||||
debug("Failed to load boot animation frame %s", BootAnimPath);
|
debug("Failed to load boot animation frame %s", BootAnimPath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ void BootLogoAnimationThread()
|
|||||||
FrameSizes[FrameCount] = s_cst(uint32_t, ba.node->Length);
|
FrameSizes[FrameCount] = s_cst(uint32_t, ba.node->Length);
|
||||||
Frames[FrameCount] = new uint8_t[ba.node->Length];
|
Frames[FrameCount] = new uint8_t[ba.node->Length];
|
||||||
memcpy((void *)Frames[FrameCount], (void *)ba.node->Address, ba.node->Length);
|
memcpy((void *)Frames[FrameCount], (void *)ba.node->Address, ba.node->Length);
|
||||||
bootanim_vfs->Close(ba);
|
vfs->Close(ba);
|
||||||
FrameCount++;
|
FrameCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ void KernelMainThread()
|
|||||||
KPrint("Initializing Disk Manager...");
|
KPrint("Initializing Disk Manager...");
|
||||||
DiskManager = new Disk::Manager;
|
DiskManager = new Disk::Manager;
|
||||||
|
|
||||||
KPrint("Loading Drivers...");
|
KPrint("Loading Modules...");
|
||||||
DriverManager = new Driver::Driver;
|
DriverManager = new Driver::Driver;
|
||||||
DriverManager->LoadDrivers();
|
DriverManager->LoadDrivers();
|
||||||
|
|
||||||
|
2
Makefile
2
Makefile
@ -200,4 +200,4 @@ endif
|
|||||||
$(NM) $@
|
$(NM) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.bin *.o *.elf *.sym kernel.map kernel_dump.map kernel_dump_intel.map $(OBJ) $(STACK_USAGE_OBJ) $(GCNO_OBJ) $(KERNEL_FILENAME)
|
rm -f kernel.map kernel_dump.map kernel_dump_intel.map $(OBJ) $(STACK_USAGE_OBJ) $(GCNO_OBJ) $(KERNEL_FILENAME)
|
||||||
|
@ -47,7 +47,7 @@ namespace Recovery
|
|||||||
WidgetCollection *wdgDbgWin = nullptr;
|
WidgetCollection *wdgDbgWin = nullptr;
|
||||||
Window *DbgWin = nullptr;
|
Window *DbgWin = nullptr;
|
||||||
|
|
||||||
char *AudioFile = (char *)"/home/default/Music/Ludwig van Beethoven - Fur Elise.mp3";
|
char *AudioFile = (char *)"none";
|
||||||
|
|
||||||
void PlayAudio()
|
void PlayAudio()
|
||||||
{
|
{
|
||||||
@ -185,13 +185,6 @@ namespace Recovery
|
|||||||
void BufBight90() { Display->SetBrightness(90, 200); }
|
void BufBight90() { Display->SetBrightness(90, 200); }
|
||||||
void BufBight100() { Display->SetBrightness(100, 200); }
|
void BufBight100() { Display->SetBrightness(100, 200); }
|
||||||
|
|
||||||
// void audio_dev_connected() { AudioFile = (char *)"/system/config/audio/media/dev_connected.mp3"; }
|
|
||||||
// void audio_dev_disconnected() { AudioFile = (char *)"/system/config/audio/media/dev_disconnected.mp3"; }
|
|
||||||
// void audio_dev_error() { AudioFile = (char *)"/system/config/audio/media/dev_error.mp3"; }
|
|
||||||
// void audio_error() { AudioFile = (char *)"/system/config/audio/media/error.mp3"; }
|
|
||||||
// void audio_notification() { AudioFile = (char *)"/system/config/audio/media/notification.mp3"; }
|
|
||||||
// void audio_warning() { AudioFile = (char *)"/system/config/audio/media/warning.mp3"; }
|
|
||||||
|
|
||||||
void KernelRecovery::RecoveryThread()
|
void KernelRecovery::RecoveryThread()
|
||||||
{
|
{
|
||||||
while (wdgDbgWin == nullptr || DbgWin == nullptr)
|
while (wdgDbgWin == nullptr || DbgWin == nullptr)
|
||||||
|
@ -149,13 +149,13 @@ static uintptr_t sys_kernelctl(SyscallsFrame *Frame, enum KCtl Command, uint64_t
|
|||||||
switch (retries)
|
switch (retries)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FullPath = "/system/lib/";
|
FullPath = "/lib/";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
FullPath = "/system/lib64/";
|
FullPath = "/usr/lib/";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
FullPath = "/system/";
|
FullPath = "/";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace VirtualFileSystem
|
namespace VirtualFileSystem
|
||||||
{
|
{
|
||||||
/* Manage /system/dev */
|
/* Manage /dev */
|
||||||
class Device
|
class Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -33,7 +33,7 @@ namespace VirtualFileSystem
|
|||||||
~Device();
|
~Device();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/mnt */
|
/* Manage /mnt */
|
||||||
class Mount
|
class Mount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -43,7 +43,7 @@ namespace VirtualFileSystem
|
|||||||
~Mount();
|
~Mount();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/prc */
|
/* Manage /prc */
|
||||||
class Process
|
class Process
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -51,7 +51,7 @@ namespace VirtualFileSystem
|
|||||||
~Process();
|
~Process();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/drv */
|
/* Manage /drv */
|
||||||
class Driver
|
class Driver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -60,7 +60,7 @@ namespace VirtualFileSystem
|
|||||||
~Driver();
|
~Driver();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/net */
|
/* Manage /net */
|
||||||
class Network
|
class Network
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -69,7 +69,7 @@ namespace VirtualFileSystem
|
|||||||
~Network();
|
~Network();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/dev/serialX */
|
/* Manage /dev/serialX */
|
||||||
class Serial
|
class Serial
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -77,7 +77,7 @@ namespace VirtualFileSystem
|
|||||||
~Serial();
|
~Serial();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/dev/random */
|
/* Manage /dev/random */
|
||||||
class Random
|
class Random
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -85,7 +85,7 @@ namespace VirtualFileSystem
|
|||||||
~Random();
|
~Random();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/dev/null */
|
/* Manage /dev/null */
|
||||||
class Null
|
class Null
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -93,7 +93,7 @@ namespace VirtualFileSystem
|
|||||||
~Null();
|
~Null();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/dev/zero */
|
/* Manage /dev/zero */
|
||||||
class Zero
|
class Zero
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -101,7 +101,7 @@ namespace VirtualFileSystem
|
|||||||
~Zero();
|
~Zero();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Manage /system/dev/fbX */
|
/* Manage /dev/fbX */
|
||||||
class FB
|
class FB
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
1
kernel.h
1
kernel.h
@ -55,7 +55,6 @@ extern KernelConfig Config;
|
|||||||
extern Tasking::Task *TaskManager;
|
extern Tasking::Task *TaskManager;
|
||||||
extern Time::time *TimeManager;
|
extern Time::time *TimeManager;
|
||||||
extern VirtualFileSystem::Virtual *vfs;
|
extern VirtualFileSystem::Virtual *vfs;
|
||||||
extern VirtualFileSystem::Virtual *bootanim_vfs;
|
|
||||||
extern Driver::Driver *DriverManager;
|
extern Driver::Driver *DriverManager;
|
||||||
extern Disk::Manager *DiskManager;
|
extern Disk::Manager *DiskManager;
|
||||||
extern NetworkInterfaceManager::NetworkInterface *NIManager;
|
extern NetworkInterfaceManager::NetworkInterface *NIManager;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user