From 28ec505b78629ac62a35672d120b2a5cca85dd76 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 11 May 2023 18:34:49 +0300 Subject: [PATCH] Create an empty root if initrd failed to be loaded --- Kernel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Kernel.cpp b/Kernel.cpp index e4dd3f8..33ca060 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -426,6 +426,15 @@ EXTERNC NIF void Main() } } + if (vfs->GetRootNode()->Children.size() == 0) + { + VirtualFileSystem::FileSystemOperations null_op = { + .Name = "null", + }; + + vfs->CreateRoot("/", &null_op); + } + if (!vfs->PathExists("/system")) vfs->Create("/system", NodeFlags::DIRECTORY);