feature (kernel): Requesting RAMDISK archive module from bootloader
This commit is contained in:
parent
c32988aa72
commit
87ee378144
7
build.sh
7
build.sh
|
@ -32,6 +32,11 @@ limine_install() {
|
|||
echo ""
|
||||
}
|
||||
|
||||
generate_initial_ramdisk() {
|
||||
echo " --> Generating initrd"
|
||||
tar -C ramdisk -cvf build/initrd.tar .
|
||||
}
|
||||
|
||||
generate_image() {
|
||||
echo " --> Generating Image"
|
||||
cd build
|
||||
|
@ -43,6 +48,7 @@ generate_image() {
|
|||
cp limine/limine-cd-efi.bin iso
|
||||
cp limine/limine.sys iso
|
||||
cp ../limine.cfg iso
|
||||
cp initrd.tar iso
|
||||
cp cmake/kernel/kernel iso/kernel.elf
|
||||
|
||||
xorriso -as mkisofs -b limine-cd.bin \
|
||||
|
@ -64,6 +70,7 @@ echo "!=====[ NoxOS build script ]=====!"
|
|||
workspace_setup
|
||||
kernel_build
|
||||
[ ! -d "build/limine" ] && limine_install
|
||||
generate_initial_ramdisk
|
||||
generate_image
|
||||
|
||||
echo "!=====[ Finished ]=====!"
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
#include "limine.h"
|
||||
|
||||
typedef struct {
|
||||
struct limine_framebuffer_response* framebuffer;
|
||||
struct limine_terminal_response* terminal;
|
||||
struct limine_memmap_response* memory_map;
|
||||
struct limine_kernel_file_response* kernel_file;
|
||||
void* rsdp;
|
||||
struct limine_framebuffer_response* framebuffer;
|
||||
struct limine_terminal_response* terminal;
|
||||
struct limine_memmap_response* memory_map;
|
||||
struct limine_file* kernel_file;
|
||||
struct limine_file* ramdisk_file;
|
||||
void* rsdp;
|
||||
} boot_info_T;
|
||||
|
||||
#endif //NOX_BOOT_INFO_H
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "boot/boot_info.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/core.h"
|
||||
#include "utils/memory.h"
|
||||
|
||||
extern void kmain(boot_info_T boot_info);
|
||||
|
||||
|
@ -39,6 +40,11 @@ static volatile struct limine_kernel_file_request kernel_file_request = {
|
|||
.revision = 3
|
||||
};
|
||||
|
||||
static volatile struct limine_module_request module_request = {
|
||||
.id = LIMINE_MODULE_REQUEST,
|
||||
.revision = 4
|
||||
};
|
||||
|
||||
|
||||
void _start() {
|
||||
boot_info_T boot_info;
|
||||
|
@ -69,7 +75,28 @@ void _start() {
|
|||
CORE_HALT_FOREVER
|
||||
}
|
||||
log(LOG_INFO, "( LimineEntry ) Found Kernel File");
|
||||
boot_info.kernel_file = kernel_file_request.response;
|
||||
boot_info.kernel_file = kernel_file_request.response->kernel_file;
|
||||
|
||||
if (module_request.response == NULL) {
|
||||
log(LOG_ERROR, "( LimineEntry ) no module response!");
|
||||
CORE_HALT_FOREVER
|
||||
}
|
||||
struct limine_file* ramdisk_file = NULL;
|
||||
for (int i = 0; i < module_request.response->module_count; i++) {
|
||||
struct limine_file* file = module_request.response->modules[i];
|
||||
log(LOG_INFO, "( LimineEntry ) MODULE: %s", file->path);
|
||||
|
||||
if (memory_compare(file->path, "/initrd.tar", string_length(file->path))) {
|
||||
ramdisk_file = file;
|
||||
}
|
||||
}
|
||||
|
||||
if (ramdisk_file == NULL) {
|
||||
log(LOG_ERROR, "( LimineEntry ) no ramdisk module!");
|
||||
CORE_HALT_FOREVER
|
||||
}
|
||||
log(LOG_INFO, "( LimineEntry ) Found Ramdisk File");
|
||||
boot_info.ramdisk_file = ramdisk_file;
|
||||
|
||||
kmain(boot_info);
|
||||
}
|
|
@ -3,3 +3,4 @@ TIMEOUT=2
|
|||
:NoxOS
|
||||
PROTOCOL=limine
|
||||
KERNEL_PATH=boot:///kernel.elf
|
||||
MODULE_PATH=boot:///initrd.tar
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Proin molestie porta erat eu interdum.
|
||||
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
|
||||
Cras semper porta ligula quis condimentum.
|
||||
Aliquam sed bibendum diam, sit amet gravida orci.
|
||||
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
|
||||
Proin vitae urna vel magna luctus pulvinar.
|
||||
Etiam diam diam, vulputate nec eros a, bibendum tristique velit.
|
||||
Donec interdum consectetur vehicula.
|
||||
Vestibulum gravida varius nisi non fringilla.
|
||||
Nam eu accumsan erat, ac condimentum massa.
|
Loading…
Reference in New Issue