From fb9627cc985912a57de8b4bedc98991e290e4075 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 20 Nov 2024 11:43:08 +0100 Subject: Fetch the initrd address from the DTB blob MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kernel entry has a pointer to the DTB blob as a parameter. From this pointer we can parse the the DTB blob to find the properties "chosen->linux,initrd-start" and "chosen->linux,initrd-start". These properties are guaranteed to have 64-bit addresses which point where the initrd is in memory, which we need to fetch the binaries to be loaded. Signed-off-by: Miquel Sabaté Solà --- kernel/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'kernel/main.c') diff --git a/kernel/main.c b/kernel/main.c index 07188b9..11f2721 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -13,13 +13,14 @@ struct task_struct init_task = { .stack = init_stack }; * function can (and will) assume that everything has been reset and that we can * start the whole thing. */ -__noreturn __kernel void start_kernel(uintptr_t *dtb) +__noreturn __kernel void start_kernel(void *dtb) { // TODO: disable irqs, etc. printk("Welcome to FizzBuzz OS!\n"); - parse_dtb(dtb); + struct initrd_addr addr = find_dt_initrd_addr(dtb); + __unused(addr); // TODO // TODO: reenable stuff -- cgit v1.2.3