Kernel/x86: Bake the Prekernel and the Kernel into one image

The new baked image is a Prekernel and a Kernel baked together now, so
essentially we no longer need to pass the Prekernel as -kernel and the
actual kernel image as -initrd to QEMU, leaving the option to pass an
actual initrd or initramfs module later on with multiboot.
This commit is contained in:
Liav A
2023-03-24 20:31:53 +03:00
committed by Tim Schumacher
parent 90a46cdc98
commit d068af89d5
10 changed files with 83 additions and 44 deletions

View File

@@ -99,9 +99,6 @@ extern "C" USB::DriverInitFunction driver_init_table_end[];
extern "C" u8 end_of_kernel_image[];
multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
size_t multiboot_copy_boot_modules_count;
READONLY_AFTER_INIT SetOnce g_not_in_early_boot;
namespace Kernel {
@@ -152,14 +149,14 @@ READONLY_AFTER_INIT StringView kernel_cmdline;
READONLY_AFTER_INIT u32 multiboot_flags;
READONLY_AFTER_INIT multiboot_memory_map_t* multiboot_memory_map;
READONLY_AFTER_INIT size_t multiboot_memory_map_count;
READONLY_AFTER_INIT multiboot_module_entry_t* multiboot_modules;
READONLY_AFTER_INIT size_t multiboot_modules_count;
READONLY_AFTER_INIT PhysicalAddress multiboot_framebuffer_addr;
READONLY_AFTER_INIT u32 multiboot_framebuffer_pitch;
READONLY_AFTER_INIT u32 multiboot_framebuffer_width;
READONLY_AFTER_INIT u32 multiboot_framebuffer_height;
READONLY_AFTER_INIT u8 multiboot_framebuffer_bpp;
READONLY_AFTER_INIT u8 multiboot_framebuffer_type;
READONLY_AFTER_INIT PhysicalAddress multiboot_module_physical_ptr;
READONLY_AFTER_INIT size_t multiboot_module_length;
}
Atomic<Graphics::Console*> g_boot_console;
@@ -188,8 +185,8 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT NO_SANITIZE_COVERAGE void init([[maybe_
multiboot_flags = boot_info.multiboot_flags;
multiboot_memory_map = (multiboot_memory_map_t*)boot_info.multiboot_memory_map;
multiboot_memory_map_count = boot_info.multiboot_memory_map_count;
multiboot_modules = (multiboot_module_entry_t*)boot_info.multiboot_modules;
multiboot_modules_count = boot_info.multiboot_modules_count;
multiboot_module_physical_ptr = PhysicalAddress { boot_info.multiboot_module_physical_ptr };
multiboot_module_length = boot_info.multiboot_module_length;
multiboot_framebuffer_addr = PhysicalAddress { boot_info.multiboot_framebuffer_addr };
multiboot_framebuffer_pitch = boot_info.multiboot_framebuffer_pitch;
multiboot_framebuffer_width = boot_info.multiboot_framebuffer_width;
@@ -218,8 +215,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT NO_SANITIZE_COVERAGE void init([[maybe_
multiboot_memory_map = mmap;
multiboot_memory_map_count = 2;
multiboot_modules = nullptr;
multiboot_modules_count = 0;
multiboot_module_length = 0;
// FIXME: Read the /chosen/bootargs property.
kernel_cmdline = RPi::Mailbox::the().query_kernel_command_line(s_command_line_buffer);
#elif ARCH(RISCV64)
@@ -235,11 +231,6 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT NO_SANITIZE_COVERAGE void init([[maybe_
// We need to copy the command line before kmalloc is initialized,
// as it may overwrite parts of multiboot!
CommandLine::early_initialize(kernel_cmdline);
if (multiboot_modules_count > 0) {
VERIFY(multiboot_modules);
memcpy(multiboot_copy_boot_modules_array, multiboot_modules, multiboot_modules_count * sizeof(multiboot_module_entry_t));
}
multiboot_copy_boot_modules_count = multiboot_modules_count;
new (&bsp_processor()) Processor();
bsp_processor().early_initialize(0);