Kernel: Demo the initrd using TarStream
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
1d6092341a
commit
6c3b7672a0
@ -4,14 +4,18 @@
|
|||||||
#include "arch/Serial.h"
|
#include "arch/Serial.h"
|
||||||
#include "arch/Timer.h"
|
#include "arch/Timer.h"
|
||||||
#include "boot/Init.h"
|
#include "boot/Init.h"
|
||||||
|
#include "boot/bootboot.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "memory/Heap.h"
|
#include "memory/Heap.h"
|
||||||
#include "memory/KernelVM.h"
|
#include "memory/KernelVM.h"
|
||||||
#include "memory/MemoryManager.h"
|
#include "memory/MemoryManager.h"
|
||||||
#include "thread/Scheduler.h"
|
#include "thread/Scheduler.h"
|
||||||
#include <luna/Result.h>
|
#include <luna/Result.h>
|
||||||
|
#include <luna/TarStream.h>
|
||||||
#include <luna/Units.h>
|
#include <luna/Units.h>
|
||||||
|
|
||||||
|
extern const BOOTBOOT bootboot;
|
||||||
|
|
||||||
void async_thread()
|
void async_thread()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
@ -49,6 +53,15 @@ Result<void> init()
|
|||||||
kinfoln("Used memory: %s", to_dynamic_unit(MemoryManager::used()).release_value().chars());
|
kinfoln("Used memory: %s", to_dynamic_unit(MemoryManager::used()).release_value().chars());
|
||||||
kinfoln("Reserved memory: %s", to_dynamic_unit(MemoryManager::reserved()).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();
|
Thread::init();
|
||||||
Scheduler::init();
|
Scheduler::init();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user