From 6c3b7672a02692da1bc4dca39f271a5c025eaaf7 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 18 Dec 2022 16:39:35 +0100 Subject: [PATCH] Kernel: Demo the initrd using TarStream Yes, we're using the physical address. Not optimal, this is only for demo purposes. --- kernel/src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index 1535bed2..7592b85f 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -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 +#include #include +extern const BOOTBOOT bootboot; + void async_thread() { while (true) @@ -49,6 +53,15 @@ Result 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();