Kernel: Demo the initrd using TarStream
All checks were successful
continuous-integration/drone/push Build is passing

Yes, we're using the physical address. Not optimal, this is only for demo purposes.
This commit is contained in:
apio 2022-12-18 16:39:35 +01:00
parent 1d6092341a
commit 6c3b7672a0
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -4,14 +4,18 @@
#include "arch/Serial.h"
#include "arch/Timer.h"
#include "boot/Init.h"
#include "boot/bootboot.h"
#include "config.h"
#include "memory/Heap.h"
#include "memory/KernelVM.h"
#include "memory/MemoryManager.h"
#include "thread/Scheduler.h"
#include <luna/Result.h>
#include <luna/TarStream.h>
#include <luna/Units.h>
extern const BOOTBOOT bootboot;
void async_thread()
{
while (true)
@ -49,6 +53,15 @@ Result<void> init()
kinfoln("Used memory: %s", to_dynamic_unit(MemoryManager::used()).release_value().chars());
kinfoln("Reserved memory: %s", to_dynamic_unit(MemoryManager::reserved()).release_value().chars());
TarStream stream((void*)bootboot.initrd_ptr, bootboot.initrd_size);
TarStream::Entry entry;
while (TRY(stream.read_next_entry().try_set_value_with_specific_error(entry, 0)))
{
if (entry.type == TarStream::EntryType::RegularFile)
kinfoln("Found file %s in initial ramdisk, of size %s", entry.name,
to_dynamic_unit(entry.size).release_value().chars());
}
Thread::init();
Scheduler::init();