summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core/kmain.wtf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/Core/kmain.wtf.cpp')
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp46
1 files changed, 36 insertions, 10 deletions
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
index 0486702..ad11eaf 100644
--- a/Source/Kernel/Core/kmain.wtf.cpp
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -7,6 +7,7 @@
#include <Devices/Display/VESADisplay.class.h>
#include <Devices/Keyboard/PS2Keyboard.class.h>
#include <Devices/Floppy/FloppyDrive.class.h>
+#include <Devices/ATA/ATAController.class.h>
#include <Devices/Timer.class.h>
#include <DeviceManager/Disp.ns.h>
#include <DeviceManager/Dev.ns.h>
@@ -25,6 +26,7 @@
#include <Rand.ns.h>
#include <VFS/Part.ns.h>
#include <FileSystems/RamFS/RamFS.class.h>
+#include <FileSystems/FAT/FATFS.class.h>
#include <VFS/FileNode.class.h>
#include <VFS/VFS.ns.h>
#include <VFS/DirectoryNode.class.h>
@@ -37,6 +39,8 @@ extern u32int end; //Placement address
extern "C" void kmain(multiboot_info_t* mbd, u32int magic);
+SimpleVT* kvt;
+
u32int logoAnimation(void* p) {
SimpleVT& vt = *((SimpleVT*)p);
vt.setColor(8);
@@ -83,7 +87,7 @@ u32int logoAnimation(void* p) {
void selectVideoMode(SimpleVT& v) {
Disp::getModes();
- v << "\n\nPlease select a graphic mode in the list below:\n";
+ v << "\nPlease select a graphic mode in the list below:\n";
for (u32int i = 0; i < Disp::modes.size(); i++) {
Disp::mode_t& m = Disp::modes[i];
@@ -140,9 +144,9 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
Disp::setText(vgaout);
//Create a VT for logging what kernel does
- SimpleVT *kvt = new ScrollableVT(25, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR);
+ kvt = new ScrollableVT(25, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR);
kvt->map(0, 0);
- *kvt << "Melon is loading...";
+ *kvt << "Melon is loading...\n";
IDT::init(); //Setup interrupts
@@ -164,13 +168,17 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
//*************************************** PARSE COMMAND LINE
Vector<String> opts = kcmdline.split(" ");
- String keymap = "fr", init = "/System/Applications/PaperWork.app";
+ String keymap = "builtin", init = "/System/Applications/PaperWork.app";
+ String root = "ramfs:0";
+ Vector<String> mount;
bool enableVESA = true;
for (u32int i = 0; i < opts.size(); i++) {
Vector<String> opt = opts[i].split(":");
if (opt[0] == "vesa" && opt[1] != "enabled") enableVESA = false;
if (opt[0] == "keymap") keymap = opt[1];
if (opt[0] == "init") init = opt[1];
+ if (opt[0] == "root") root = opts[i].substr(5);
+ if (opt[0] == "mount") mount.push(opts[i].substr(6));
}
//*************************************** DEVICE SETUP
@@ -179,17 +187,35 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
Kbd::setFocus(kvt); //Set focus to virtual terminal
if (enableVESA) Dev::registerDevice(new VESADisplay());
FloppyController::detect();
+ ATAController::detect();
- //*************************************** MOUNT ROOT FILESYSTEM
+ //*************************************** MOUNT FILESYSTEMS
- FileSystem* fs = RamFS::mount((u8int*)mods[0].mod_start, 1024 * 1024, NULL);
+ { // mount root filesystem
+ if (!VFS::mount(String("/:") += root, kvt, mbd)) PANIC("Cannot mount root filesystem.");
+ }
DirectoryNode* cwd;
- cwd = fs->getRootNode();
+ cwd = VFS::getRootNode();
Task::currProcess()->setCwd(cwd);
- VFS::setRootNode(cwd);
+
+ // mount other filesystems
+ for (u32int i = 0; i < mount.size(); i++) {
+ VFS::mount(mount[i], kvt, mbd);
+ }
+
+ {
+ TextFile mounts("/System/Configuration/Mount", FM_READ);
+ while (mounts.valid() && !mounts.eof()) {
+ String m = mounts.readLine();
+ if (!m.empty() && m[0] != WChar("#")) VFS::mount(m, kvt, mbd);
+ }
+ }
+
+
+ //*************************************** LOAD SYSTEM STUFF
if (keymap != "builtin") {
- if (!Kbd::loadKeymap(keymap)) *kvt << "\nWARNING : Could not load keymap " << keymap << ", using built-in keymap instead.";
+ if (!Kbd::loadKeymap(keymap)) *kvt << "WARNING : Could not load keymap " << keymap << ", using built-in keymap instead.";
}
Log::init(KL_STATUS); //Setup logging
@@ -199,7 +225,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
Log::log(KL_STATUS, "kmain : User list loaded");
if (init.empty()) {
- *kvt << "\n\n";
+ *kvt << "\n";
new KernelShell(cwd, kvt);
while (KernelShell::getInstances() > 0) {
Task::currThread()->sleep(100);